简体   繁体   中英

React Native + Parse.com Push Notifications on Android

Couldn't find any documentation on how to handle push notifications coming from Parse on React Native for Android. I am able to receive the notification after integrating the SDK, but couldn't go from there in order to handle the notification inside the app.

Any ideas?

No Problem. This is php code.

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

And this is Android code.

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);

} In android code. You can get parametter post_id from php. Sorry English verry bad

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM