在Android上反应Native + Parse.com推送通知

时间:2015-12-30 08:45:26

标签: android reactjs push react-native

无法找到有关如何处理来自Pact on React Native for Android的推送通知的任何文档。 我可以在集成SDK后收到通知,但无法从那里开始处理应用程序内的通知。

有什么想法吗?

1 个答案:

答案 0 :(得分:-2)

没问题。 这是php代码。

$data = array("alert" => 'Hello, this í' );
                  ParsePush::send(array(
                      "channels" => ["channels"],
                      "data" => $data,
                      "post_id" => '1234',
                  ));

这是Android代码。

Intent intent = getIntent();
Bundle extras = intent.getExtras();
String jsonData = extras.getString("com.parse.Data");
JSONObject json = new JSONObject(jsonData);
String postID = json.getString("post_id");
if (postID != null) {
    Intent parseIntent = new Intent(this, MatchActivity.class);
    parseIntent.putExtra("postID", postID);
    startActivity(parseIntent);

} 在android代码中。你可以从php获得参数post_id。对不起英语非常糟糕