How can I get data or title from receiving notifications?

后端 未结 2 1314
梦如初夏
梦如初夏 2021-01-28 08:10

I create simple \"ParseStarterProject\" as default of parse.com project. It works. I send notification from one device to other device successfully via setchann

相关标签:
2条回答
  • 2021-01-28 08:21

    Create a class that extends BroadcastReceiver, here we call it MyCustomReceiver. Declare the usage of this receiver in your manifest:

    <receiver android:name="com.example.MyCustomReceiver" android:exported="false">
      <intent-filter>
        <action android:name="com.example.UPDATE_STATUS" />
      </intent-filter>
    </receiver>
    

    I'm not sure what you mean by you have problems with "MyCustomReceiver class on the main activity", in your comment to @kingspeech's answer.


    In the worst case, you can create your own Receiver which extends the ParseBroadcastReceiver (and reference the extended class in the manifest). Then it should work by default, but you'll be able to hook into onReceive(Context, Intent)

    0 讨论(0)
  • 2021-01-28 08:39

    As Parse tutorial directs, you ca use JSONObject to set data and you can put whatever you want. Then when you receive Push notification you can have a access to read the previously prepared JSONObject. Please look at the Android tutorial https://parse.com/docs/push_guide#options/Android.

    Hope this helps, Regards.

    0 讨论(0)
提交回复
热议问题