How to receive parse push notifiactions on an android device using parse.com

android, android-intent, parse-platform

Solution

Use like this :

  public class Application extends android.app.Application {

  public Application() {
  }

  @Override
  public void onCreate() {
    super.onCreate();
    Parse.initialize(this, "YOUR_APP_ID", "YOUR_CLIENT_KEY");

    PushService.setDefaultPushCallback(this, MainActivity.class);
  }
}

//MainActivity.java - Activity you need to open when the notification is clicked.

In your Manifest file add this application.

<application    android:name="com.parse.tutorials.pushnotifications.Application"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.parse.tutorials.pushnotifications.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity> </application>

And add this line in your MainActivity class which you need to open when the notification is clicked.

Bundle mBundle = getIntent().getExtras();
if (mBundle != null) {
    String mData = mBundle.getString("com.parse.Data");
    System.out.println("DATA : xxxxx : " + mData);
}

Problem

How to intent from parse push notification. i f anybody implemented parse push please help. ``` Parse.initialize(Splash.this,"id","id"); ParseInstallation.getCurrentInstallation().saveInBackground(); PushService.setDefaultPushCallback(Splash.this, ParsePush.class); ``` implementing like this. can't get any values in jsonData. ``` public class ParsePush extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); ParseInstallation.getCurrentInstallation().saveInBackground(); Intent intent = getIntent(); Bundle extras = intent.getExtras(); String jsonData = extras.getString("com.parse.Data"); System.out.println("Data Json : " + jsonData); } } ``` need to implement an intent from the push notification (parse). that is need to show an activity on clicking the push.. please help.

Original source