In addition to permissions
There are a few things that make Parse not send push notifications correctly. Parse does not do much work to drill them down, but from what I have experienced with Parse, I can try to shed light on things that are not always so obvious.
If you check the Parse control panel and can see your device recorder, thatβs good. However, you need to make sure that the Token device is registered on this device. If this does not happen, I can almost guarantee that if you check the push tab, you will see that the success rate of this push was 0% or unsuccessful.
Make sure DeviceToken is logged In addition to simply initializing Parse, make sure the package name of your application matches the name you use to communicate with your Android manifest. If this is not the case, this is certainly the reason for not getting the shocks.
Parallel analysis
private void initializeParse() { Parse.enableLocalDatastore(this); Parse.initialize(this); ParseInstallation.getCurrentInstallation().saveInBackground(); Log.d(LOG_TAG, "Initializing parse with app id: " + getString(R.string.parse_app_id) + " client_key: " + getString(R.string.parse_client_key)); }
Listening for taps
public class ParsePluginReceiver extends ParsePushBroadcastReceiver { private static final String TAG = "ParsePluginReceiver"; private static final String RECEIVED_IN_FOREGROUND = "receivedInForeground"; private static int badgeCount = 0; public static final String FORWARD_EXTRA = "FORWARD_ACTIVITY"; @Override protected void onPushReceive(Context context, Intent intent) { JSONObject pushData = getPushData(intent); if (pushData != null) { Log.d(TAG, "JSON Payload: " + pushData.toString()); super.onPushReceive(context, intent); } } protected void onPushOpen(Context context, Intent intent) { JSONObject pushData = getPushData(intent); Log.d(TAG, "JSON Payload: " + pushData.toString()); if (pushData != null) { try { super.onPushOpen(context, intent); } catch (Exception ex) { } } }
As a reference, Parse Sdk is here: https://parse.com/docs/android/guide
Side Note Pars should be deprecated early next year.
paul_hundal
source share