Php Code to send Push Notifications

01:34:00 2 Comments



Hey Guys Below is the code to help you send Push Notifications to your mobile app from your website (php server)

You will need to pass the device id in the url

For Example http://yourwebsite.com/sendpushnotification.php?id=placedeviceuniqueidhere


Below is the sendpushnotification.php you will need to put in your Google Api key on the line  $apiKey = 'yourapikeyhere'.You will get it form the Google Developer Console.

<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );


echo $_GET['id'];
$registrationIds = array( $_GET['id'] );//


// prep the bundle
$msg = array
(
'message' => 'here is a message. message',
'title' => 'This is a title. title',
'subtitle' => 'This is a subtitle. subtitle',
'tickerText' => 'Ticker text here...Ticker text here...Ticker text here',
'vibrate' => 1,
'sound' => 1,
'largeIcon' => 'large_icon',
'smallIcon' => 'small_icon'
);
$fields = array
(
'registration_ids' => array($registrationIds),
'data' => $msg
);

$headers = array
(
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
);

$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://android.googleapis.com/gcm/send' );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
$result = curl_exec($ch );
curl_close( $ch );
echo $result;

Comment Below if you have Doubts or Questions

2 comments:

How to Update Version Cordova PhoneGap App?

00:35:00 0 Comments




Dear Guys,Joel here from JoelWebsites.com :D in this small post I show you how to update your cordova app version
So how is this tutorial Going to be useful?
When uploading apps this happens during updating the existing app on the playstore we get an error that we need to update the Android Version for the app.

So it is really difficult to update the Version if you do not know what are the steps to done.
After lot of searching online.I finally found the solution.

We need to add android-versionCode="yourappversion" to the config.xml file like below.

Your widget tag code should look like below in the config.xml

Here is just an example

<widget android-versionCode="7" id="com.yourapp.YourApp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

You will find the config file in the following directories in your project folder.I made changes in all the config.xml files to make things simpler.





Later on you will see the manifest file updated like below after the build the android project
Your App directory/platforms/android/AndroidManifest.xml

<manifest android:versionCode="7" android:hardwareAccelerated="true" android:versionName="0.0.1" package="com.yourapp.Yourapp" xmlns:android="http://schemas.android.com/apk/res/android">


if android:versionCode is not available then you will need to add it like shown above.

Moreover , Google playstore may say that the version you need should be greater than 10 whereas you would see it to be set as 1 in your AndroidManifest.xml .So do not worry just increase the number and the rebuild the app and you should be fine...View the other article on how to sign and align the apk file for the playstore here

So once again here is the Golden code to change the app version for your Cordova PhoneGap Project in config.xml

<widget android-versionCode="AppVersion" id="com.yourapp.YourApp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">


So I hope that this tutorial was useful do comment below if you have doubts or questions,Thank you

Check my youtube channel here

0 comments:

My skateboard fail 3/17/2013 INDIA Joel Fernandes

23:23:00 0 Comments

0 comments:

Think Before getting a Free theme! Should I Use a paid theme?

23:22:00 0 Comments





Dear Guys!..In this video I just explain some Reasons why its important to think before getting a new theme that is free...Most of the times its Good to opt for themes that are however most of the times it is Good to go for themes that are paid..It Really Depends on the seriousness of your Website.

SO the conclusion is that you should go for free themes if you are just a starter or otherwise Opt for a Paid Theme.

0 comments:

Angularjs for Beginners Simple login page using Angular JS and JSON

23:07:00 2 Comments





Dear Guys,

In this tutorial JoelWebsites have Created a very basic login Page using Angular Js,BootStrap,Json PHP

Its a Very useful tutorial for beginners who want to Learn about Angular and Php Json webservices.

View the full tutorial and download angularlogin the project files using link ( Remove all the javascripts alerts from the code & modify it as per your needs)



http://www.joethemes.com/?ddownload=7377





View the previous Jqery login tutorial here



https://www.youtube.com/watch?v=FdwJk...

Comment Below if you have doubts or Questions or If you have better methods to code



Subscribe to my channel http://www.youtube.com/subscription_c...

2 comments:

Basic Website Questions Answered! basic web development questions

23:05:00 10 Comments







Buy a Hosting or get a Domain from one of the best hosting services Bluehosthttp://www.bluehost.com/track/easyreg...

Arvixe Webhosting Don't forget to use the Arvixe coupon insaneadvantage and linkhttp://www.arvixe.com/11056.html to pick up your web hosting & domain for $4/month

Register on blogger to create a free Blog
http://blogger.com


Comment Below if you have more basic questions...
Hey Guys..Bhavesh Desai takes a very basic web development test an interview sort of where he asks Joel Fernandes JoelWebsites the very basic questions that people have when Creating website projects.
Note that these questions are based on what a common user think.
This video may be a bit funny but I am not sure...Comment your thoughts in the comments :)

I hope you enjoyed watching the video...

Subscribe to my channel http://www.youtube.com/subscription_c...

10 comments: