【问题标题】:React Native + Parse.com Push Notifications on AndroidAndroid 上的 React Native + Parse.com 推送通知
【发布时间】:2015-12-30 08:45:25
【问题描述】:

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

有什么想法吗?

【问题讨论】:

    标签: android reactjs push react-native


    【解决方案1】:

    没问题。 这是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);
    

    } 在安卓代码中。您可以从 php.ini 获取参数 post_id。对不起英语很差

    【讨论】:

    • 嗨,我正在度假,所以无法回复。我的意思是我想控制如何使用 JS 处理通知 - 反应原生。目前我所能做的就是查看通知 - 但我希望点击它会转到正确的文章,方法是执行在反应本机应用程序本身上声明的函数。像这里的东西:github.com/zo0r/react-native-push-notification 但对于 Parse。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多