Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Why i received two messages #246

Open
yaooort opened this issue Apr 16, 2017 · 1 comment
Open

Why i received two messages #246

yaooort opened this issue Apr 16, 2017 · 1 comment

Comments

@yaooort
Copy link

yaooort commented Apr 16, 2017

ios

token1 = 'cWbhHNXsnYg:APA91bGAQ6p3f5FZ-K8JlbrBq8oDksVIl70V8U37E6_IDjEkB7-h1pFh6TQ41QgwXBlnR9ZqjypBbUGkRrfTwvRDyTP6nSHIzgsVQjKcyLMkLm8urT01TlKGlzgRhx__QIvPDC-5RIkP'

android

token2 = 'ctbMLcs5mvI:APA91bHPgbZYSV9UxyA15RMQbp6tp-_9CeM2LdiDpO8BIOuSrTVaXHP3Jvapx6yc3YYZJDVF7KijLyMhfhaeaoVTzoNZ0FDblrFEkTdhao2RySVMi6saeb4QiR-mQ87iNblkeUf_oIQ1'
gcm = GCM(API_KEY, debug=True)
data = {
# "notification": {
# "body": "这到底",
# "title": "标题",
# },
"message": "cccccc",
"title": "标题",

"priority": "normal",
"notification": {
    "body": "This week’s edition is now available.",
    "title": "NewsMagazine.com",
    "icon": "new",
},
"data": {
    "volume": "3.21.15",
    "contents": "http://www.news-magazine.com/world-week/21659772"
}

}

Downstream message using JSON request

reg_ids = [token1, token2]

订阅消息类似于 群推

topic = 'china_all'
gcm.send_topic_message(topic=topic, data=data['data'],notification=data['notification'])

Android

*/
// [START receive_message]
@Override
public void onMessageReceived(String from, Bundle data) {

// T.showShort("From: " + from);
// if (from.startsWith("/topics/")) {
// // message received from some topic.
// } else {
// // normal downstream message.
// boolean isShow = (boolean) SPUtils.get("SHOW",false);
// if (isShow) {
// L.e("收到消息" + data.toString());
//
// //sendNotification(bundle);
// }
// Bundle bundle = data.getBundle("notification");
// Intent intent = new Intent("LUCA_GCM");
// intent.putExtra("message",bundle);
// sendBroadcast(intent);
}

@yaooort
Copy link
Author

yaooort commented Apr 16, 2017

I did not write code Will receive two messages When i push it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant