PPNS

Parse Push Notification Service (PPNS) is a Internet-real-time push notification system developed by Parse.com. It uses sockets to deliver Internet-real-time messages to devices. Typically PPNS is used in situations where GCM (Google Cloud Messaging) is unavailable, for instance in China, or on non-Google Play devices like Amazon’s Fire tablets. Currently there is client support for Android.

To use PPNS in your Android app you need to do the following:
1. Include Parse on Buddy Android SDK in your project.
2. Configure your project to use PPNS.

Include the Parse on Buddy Android SDK in your project

For details on how to include the Parse on Buddy Android SDK, see https://buddy.com/mobile-backend/android/.
 
Configure your project to use PPNS

The following manifest settings need to be placed in your project’s AndroidManifest.xml file like so:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />

<service android:name="com.parse.PushService" />

<receiver android:name="com.parse.ParseBroadcastReceiver">
  <intent-filter>
    <action android:name="android.intent.action.BOOT_COMPLETED" />
    <action android:name="android.intent.action.USER_PRESENT" />
  </intent-filter>
</receiver>

<receiver android:name="com.parse.ParsePushBroadcastReceiver" android:exported="false">
  <intent-filter>
    <action android:name="com.parse.push.intent.RECEIVE" />
    <action android:name="com.parse.push.intent.OPEN" />
    <action android:name="com.parse.push.intent.DELETE" />
  </intent-filter>
</receiver>

 
The default ParsePushBroadcastReceiver (as referenced in the above configuration) processes pushes as described here. You can also subclass and/or override the ParsePushBroadcastReceiver’s onReceive method, to customize push reception.

In addition to the above configuration, you can also configure your Android app to use GCM push notifications (see here and here for details). Keep in mind that when an Android app is configured for both PPNS and GCM, it will use PPNS only if the Google Play Services are not available on the device the app is installed on, for instance if the app is installed on an Amazon Fire tablet.

If you are using only PPNS and not GCM, it is necessary to manually upload the app’s device installation data; this data is used to identify your device so PPNS can communicate with it. This is because the Android SDK’s GCM implementation handles the upload on your behalf, but PPNS does not. To manually upload, you need to call saveEventually() on the current installation, after Parse.initialize() is called upon app initialization. Here’s an example:

Parse.Configuration.Builder builder =
    new Parse.Configuration.Builder(this);
builder.applicationId("your app ID");
builder.server("https://api.parse.buddy.com/parse/");
builder.clientKey("");
Parse.initialize(builder.build());

// add the following line
ParseInstallation.getCurrentInstallation().saveEventually();