簡體   English   中英

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

[英]React Native + Parse.com Push Notifications on Android

在Android的React Native上找不到任何有關如何處理來自Parse的推送通知的文檔。 集成SDK后,我可以收到通知,但無法從那里去處理應用程序內的通知。

有任何想法嗎?

沒問題。 這是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。 對不起英語很差

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM