Open activity by clicking on the push notification from Parse

前端 未结 4 1073
抹茶落季
抹茶落季 2021-02-14 06:29

I want to receive a push notification from Parse and open an List activity and use intent.putextra(\"dataFromParse\") before starting the activity. I\'m able to receive the push

4条回答
  •  清歌不尽
    2021-02-14 07:11

    Try this ... it works perfectly....

    try {
            Intent intent = getIntent();
            Bundle extras = intent.getExtras();
            if (extras != null) {
                String jsonData = extras.getString("com.parse.Data");
                JSONObject json;
                json = new JSONObject(jsonData);
                String pushStore = json.getString("alert");
                data.setText(pushStore);
            }
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    

提交回复
热议问题