Hey guys!
I know most of you have never heard of this, but there's a organisation that provides many useful things to use in your app!
It's called "Parse"
Now, I will guide you trough the use of Parse, beginning with Parse Push. Let's get started, shall we?
Section 1:
Okay, so Parse Push is a "library" or service that makes it A LOT easier to send push notifications to the users of your app. I had searched for months on how to send push notifications, but I just never succeeded (And I can't afford a proper server ). But that's where Parse Push comes in!
The first thing you'll have to do to setup Parse Push is download and install the Parse SDK. This is how:
Step 1: Make an account at Parse.com and setup the app you want to include Parse in.
Step 2: Download the SDK: https://parse.com/downloads/android/Parse/latest
Step 3: Unzip it into a random folder
Step 4: Copy all the files in your projects "lib" folder. If your project doesn't have one, simply make one in the root of your directory (e.g /MyApp/lib/)
Step 5: Call the "initialize" method in your onCreate method, like this:
NOTE: You can find you application ID and client key here: https://parse.com/apps/YOUR-APP'S-NAME/edit#app_keys
NOTE: Be sure you also imported these calls:
Step 6: Your app needs the android.permission.INTERNET and android.permission.ACCESS_NETWORK_STATE permission to work with Parse, so add these lines in your AndroidManifest.xml file, right before the <application> tag:
Also, add this between the <application> and </application> tag:
Step 7: Place this code in your onCreate method to track how many times your app has been opened:
Step 8: It's testing time!
To test if your app has been setup the right way, add this code to your onCreate method:
And run your app!
Step 9: Get your data trough a web browser! Go to this site: https://parse.com/apps/YOUR-APP'S-NAME/collections
Then it should say something like: TestObject (1), with the name testname
Step 10: Send a push notification: Goto https://parse.com/apps/YOUR-APP'S-NAME/push_notifications and click on + Send a push
Type in your message, hit Send notification at the bottom and your app will get a push notification!
That's it! You have now setup your app to receive push notifications
I know most of you have never heard of this, but there's a organisation that provides many useful things to use in your app!
It's called "Parse"
Now, I will guide you trough the use of Parse, beginning with Parse Push. Let's get started, shall we?
Section 1:
Okay, so Parse Push is a "library" or service that makes it A LOT easier to send push notifications to the users of your app. I had searched for months on how to send push notifications, but I just never succeeded (And I can't afford a proper server ). But that's where Parse Push comes in!
The first thing you'll have to do to setup Parse Push is download and install the Parse SDK. This is how:
Step 1: Make an account at Parse.com and setup the app you want to include Parse in.
Step 2: Download the SDK: https://parse.com/downloads/android/Parse/latest
Step 3: Unzip it into a random folder
Step 4: Copy all the files in your projects "lib" folder. If your project doesn't have one, simply make one in the root of your directory (e.g /MyApp/lib/)
Step 5: Call the "initialize" method in your onCreate method, like this:
Code:
Parse.initialize(this, "Your application ID", "Your client key");
NOTE: Be sure you also imported these calls:
Code:
import com.parse.Parse;
import com.parse.ParseAnalytics;
Step 6: Your app needs the android.permission.INTERNET and android.permission.ACCESS_NETWORK_STATE permission to work with Parse, so add these lines in your AndroidManifest.xml file, right before the <application> tag:
Code:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Also, add this between the <application> and </application> tag:
Code:
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
Step 7: Place this code in your onCreate method to track how many times your app has been opened:
Code:
ParseAnalytics.trackAppOpened(getIntent());
Step 8: It's testing time!
To test if your app has been setup the right way, add this code to your onCreate method:
Code:
ParseObject object = new ParseObject("TestObject");
object.put("name", "testname");
object.saveInBackground();
Step 9: Get your data trough a web browser! Go to this site: https://parse.com/apps/YOUR-APP'S-NAME/collections
Then it should say something like: TestObject (1), with the name testname
Step 10: Send a push notification: Goto https://parse.com/apps/YOUR-APP'S-NAME/push_notifications and click on + Send a push
Type in your message, hit Send notification at the bottom and your app will get a push notification!
That's it! You have now setup your app to receive push notifications