我想使用解析推送通知服务发送自定义数据,但从包中提取时始终返回空值。无法读取解析推送通知包数据
自定义广播接收器:
@Override
public void onReceive(Context context, Intent intent) {
Log.e("Receiver","Invoked");
Bundle bundle = intent.getExtras();
Intent contentIntent = new Intent(context, MainPage.class);
String alertMsg = bundle.getString("heading"); //never get this value
String urlString = bundle.getString("dataString"); //never get this value
contentIntent.putExtra(EXTRA_URL, urlString);
PendingIntent pendingIntent = PendingIntent.getActivity(context,
NOTIFY_REQUEST_CODE, contentIntent, PendingIntent.FLAG_ONE_SHOT);
showNotification(context, notificationId, alertMsg, pendingIntent);
}
舱单申报:
<receiver
android:name=".receiver.NotificationReceiver"
android:exported="false">
<intent-filter>
<action android:name="link_notification"/>
</intent-filter>
</receiver>
,我从parse仪表盘发出以下JSON:
{ "dataString": "objectId", "heading": "type", "action": "link_notification" }
当我记录捆绑数据时,我能够看到标题和dataString,但无法访问它。该包总是返回null。
请帮忙! 谢谢。
什么是在其中与json字符串配对的键的名称? – AabidMulani 2014-10-17 14:05:53