小编Nis*_*nt.的帖子

通过单击Parse的推送通知打开活动

我想从Parse接收推送通知并打开List活动并在开始活动之前使用intent.putextra("dataFromParse").我能够接收推送,但只使用以下命令打开MainActivity:

PushService.setDefaultPushCallback(this, MainActivity.class);
ParseInstallation.getCurrentInstallation().saveInBackground();
Run Code Online (Sandbox Code Playgroud)

我希望将此作为默认值,但也应该能够启动List活动.我也试过使用客户接收器,但是我只能在接收推送时直接打开活动,而不是点击它.

manifest.xml文件:

<receiver android:name="com.example.Push android:exported="false">
    <intent-filter>
        <action android:name="com.example.UPDATE_STATUS" />
    </intent-filter>
</receiver>
Run Code Online (Sandbox Code Playgroud)

Push.java:

public class Push extends BroadcastReceiver {

  @Override
  public void onReceive(Context context, Intent intent) {
      //Start activity
     }
}
Run Code Online (Sandbox Code Playgroud)

我不确定的是我应该如何在后台捕获推送,并说当用户单击通知时它应该使用特定的intent.putExtra("dataFromParse")打开List活动.我应该在哪里编码以及如何编码?在MainActivity中,在List活动中,还是在客户接收器上执行其他操作?

notifications android broadcastreceiver push-notification parse-platform

11
推荐指数
1
解决办法
1万
查看次数