在棒棒糖驱动的Android设备上解析推送通知

时间:2016-06-27 05:50:34

标签: android parsing push-notification

我是Parse Push通知的新手。我已经集成了Parse推送通知,我在除Lollipop之外的所有Android设备上都收到此通知。我无法确定问题所在。这是我的Parse推送接收器类

public class ParsePushReceiver extends ParsePushBroadcastReceiver {
    @Override
    protected void onPushReceive(Context context, Intent intent) {
        super.onPushReceive(context, intent);

        JSONObject json = null;
        try {

            json = new JSONObject(intent.getExtras().getString("com.parse.Data"));
            Log.e("PUSh", "push has been received=====" + json);

            NotificationUtils utils = new NotificationUtils();
            //String message=json.getJSONObject("data").getString("message");
            String message = json.getString("alert");
            utils.showNotification(message, context);
        } catch (JSONException e) {
            e.printStackTrace();
        }


    }

    @Override
    protected void onPushOpen(Context context, Intent intent) {
        super.onPushOpen(context, intent);
    }
}

0 个答案:

没有答案