Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.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
Android 使用Parse.com从推送通知中提取文本_Android_Text_Push Notification_Broadcastreceiver_Parse Platform - Fatal编程技术网

Android 使用Parse.com从推送通知中提取文本

Android 使用Parse.com从推送通知中提取文本,android,text,push-notification,broadcastreceiver,parse-platform,Android,Text,Push Notification,Broadcastreceiver,Parse Platform,我试图让一个接收者从Parse.com提供的推送通知中提取文本,我收到了通知,但看起来我的BroadcastReceiver没有被调用,因为Log.d没有记录 my MainActivity.java onCreate() my Manifest.xml接收器 <service android:name="com.parse.PushService" /> <receiver android:name="com.parse.ParseBroadcastReceiver

我试图让一个接收者从Parse.com提供的推送通知中提取文本,我收到了通知,但看起来我的BroadcastReceiver没有被调用,因为Log.d没有记录

my MainActivity.java onCreate()

my Manifest.xml接收器

<service android:name="com.parse.PushService" />

    <receiver android:name="com.parse.ParseBroadcastReceiver" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.intent.action.USER_PRESENT" />
        </intent-filter>
    </receiver>
    <receiver
        android:name="com.example.parsepushnotificationreceiver.MyCustomReceiver"
        android:exported="false" >
        <intent-filter>
            <action android:name="com.example.parsepushnotificationreceiver.UPDATE_STATUS" />
        </intent-filter>
    </receiver>
    <receiver
        android:name="com.parse.GcmBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

            <category android:name="com.example.parsepushnotificationreceiver" />
        </intent-filter>
    </receiver>
我的包裹是

package com.example.parsepushnotificationreceiver;
谢谢,

解决方案:


让它工作起来,想法是在json对象中使用sen-it self,模板{“action”:“com.example.parsepushnotificationreceiver.UPDATE_STATUS”, “姓名”:“沃恩”, “新闻项目”:“人咬狗”}

解决方案:


让它工作起来,想法是在json对象中使用sen-it self,模板{“action”:“com.example.parsepushnotificationreceiver.UPDATE_STATUS”,“name”:“Vaughn”,“newsItem”:“人咬狗”}

您可能不应该在问题中发布您的个人解析应用程序ID和解析客户端密钥…@LarryMcKenzie没关系,反正这是一个测试应用程序,但我删除了它们,谢谢,有什么解决方案吗?thxI从未使用过它,但我正在阅读文档。@LarryMcKenzie很好,谢谢你的帮助:)让它工作起来,想法是json对象本身就是sen-it,模板{“action”:“com.example.parsepushnotificationreceiver.UPDATE_STATUS”,“name”:“Vaughn”,“newsItem”:“人咬狗”}
@Override
public void onReceive(Context context, Intent intent) {
    try {
        String action = intent.getAction();
        String channel = intent.getExtras().getString("com.parse.Channel");
        JSONObject json = new JSONObject(intent.getExtras().getString(
                "com.parse.Data"));

        Log.d(TAG, "got action " + action + " on channel " + channel
                + " with:");
        Iterator itr = json.keys();
        while (itr.hasNext()) {
            String key = (String) itr.next();
            Log.d(TAG, "..." + key + " => " + json.getString(key));
        }
    } catch (JSONException e) {
        Log.d(TAG, "JSONException: " + e.getMessage());
    }
}
}
package com.example.parsepushnotificationreceiver;