Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 解析接收机参数_Java_Android_Parse Platform - Fatal编程技术网

Java 解析接收机参数

Java 解析接收机参数,java,android,parse-platform,Java,Android,Parse Platform,我正在使用Parse在我的应用程序上发送推送通知 我正在推它并在我的数据库中插入一个对象。我需要在数据库中获取这个对象,我的意思是,将参数传递给parsenotification 我有一个扩展了ParsePushBroadcastReceiver的类,现在我如何传递和获取参数?Parse可以轻松地从您在中创建的推送通知中获取参数,或者: 现在,使用推送通知中数据对象中包含的密钥名称从ParsePushBroadcastReceiver获取参数: public class MyParsePushB

我正在使用Parse在我的应用程序上发送推送通知

我正在推它并在我的数据库中插入一个对象。我需要在数据库中获取这个对象,我的意思是,将参数传递给parsenotification


我有一个扩展了ParsePushBroadcastReceiver的类,现在我如何传递和获取参数?

Parse可以轻松地从您在中创建的推送通知中获取参数,或者:

现在,使用推送通知中数据对象中包含的密钥名称从ParsePushBroadcastReceiver获取参数:

public class MyParsePushBroadcastReceiver extends ParsePushBroadcastReceiver {


    @Override
    public void onReceive(Context context, Intent intent) {
        try {
            JSONObject pushData = new JSONObject(intent.getStringExtra("com.parse.Data"));

            String customValue = pushData.optString("someCustomKey","");
            String title = pushData.optString("title","");


        } catch (JSONException e) {
            Log.v("MyBroadcastReceiver", "Unexpected JSONException when receiving push data: ", e);
        }
   }

}
现在,您可以根据提供的值指示应用程序执行什么操作

public class MyParsePushBroadcastReceiver extends ParsePushBroadcastReceiver {


    @Override
    public void onReceive(Context context, Intent intent) {
        try {
            JSONObject pushData = new JSONObject(intent.getStringExtra("com.parse.Data"));

            String customValue = pushData.optString("someCustomKey","");
            String title = pushData.optString("title","");


        } catch (JSONException e) {
            Log.v("MyBroadcastReceiver", "Unexpected JSONException when receiving push data: ", e);
        }
   }

}