0
在我的Android應用程序中,我使用GCM。我收到消息但沒有數據。解析GCM消息中的數據
我這個JSON發送到GCM的服務器:
{
"data": {
"data.senderName": "Marco Minerva",
"data.gcm.collapse_key": "chiave_collassata",
"data.activityId": "42",
"data.senderId": "12",
"data.message": "Hai ricevuto una notifica",
"data.peerProfileImageUrl": null,
"data.landingPage": "MainActivity",
"data.isCorporate": false
},
"collapse_key": "chiave_collassata"
}
和onHandleIntent(Intent intent)
我已經嘗試了所有的這些,沒有工作,所有的變量都爲空:
String message = extras.getString("msg");
String data = extras.getString("data");
String m = extras.getString("message");
String m1 = intent.getStringExtra("msg");
String m2 = intent.getStringExtra("data");
String m3 = intent.getStringExtra("message");
String senderName = intent.getExtras().getString("data.senderName");
String dm = intent.getExtras().getString("data.message");
String jsonString = extras.getString("com.parse.Data");