我需要獲取GCM推送通知實施的註冊ID嗎?由於我使用的是GoogleCloudMessaging類,但沒有獲得ID。如何獲取Google Cloud Messenger的註冊ID
0
A
回答
0
使用GoogleCloudMessaging類和發送您從google開發人員Api控制檯獲得的senderId的註冊函數。
GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(context);
String regid = gcm.register(senderId);
+0
現在,這已被棄用,請使用intent並在其中調用instanceID.getToken()。 –
0
現在怎麼做到這一點可以在https://developers.google.com/cloud-messaging/android/client
找到它歸結爲創建一個RegistrationIntentService並使用該接收的令牌。對於刷新令牌創建一個InstanceIDListenerService,並在那裏進行檢索,並首次啓動RegistrationIntentService如下:
Intent regIntent = new Intent(this, myRegistrationIntentService.class);
startService(regIntent);
相關問題
- 1. Google Cloud Messaging註冊 - 項目ID
- 2. Google Cloud Messaging - 註冊ID狀態
- 3. 何時註冊Google Cloud Messaging?
- 4. 如何處理在iOS上刷新Google Cloud Messaging的註冊ID?
- 5. 服務器如何找到GCM(Google Cloud Messaging)註冊ID
- 6. Google Cloud Messaging註冊AUTHENTICATION_FAILED
- 7. 如何通過單個Google帳戶爲Google Cloud Messaging生成多個註冊ID
- 8. 如何從使用php的客戶端獲取註冊ID?
- 9. android c2dm註冊ID
- 10. 如何註冊gcm從gcm獲得註冊ID
- 11. 使用asynctask獲取GCM註冊ID
- 12. 無法使用GCMRegister獲取註冊ID
- 13. 如何在ServiceWorker中的推送事件中獲取註冊ID?
- 14. Google Cloud Endpoints Multi獲取
- 15. Android GCM註冊ID
- 16. 如何在用戶註冊時獲取Firebase Cloud Functions中的訪問令牌?
- 17. 如何獲取ID等於用戶註冊
- 18. 如何從C2DM服務器獲取註冊ID?
- 19. 如何在註冊後在wordpress中獲取用戶ID?
- 20. Google如何從Google Cloud Messaging中獲利?
- 21. 在哪裏,何時和多久註冊一次Google Cloud Messaging
- 22. Google Cloud Messaging(GCM)問題每個設備和用戶有多少個註冊ID?
- 23. 每次應用程序啓動時請求Google Cloud Messaging(GCM)註冊ID
- 24. 如何解決Messenger Messenger註冊不觸發操作時的疑難問題?
- 25. Google GCM,令牌與註冊ID
- 26. 獲取註冊表
- 27. Android Google雲消息傳遞註冊ID更改
- 28. GCM註冊令牌是否等於GCM註冊ID?
- 29. 如何獲取某人的Google+ ID
- 30. Android服務器註冊時的Google Cloud消息傳遞問題?
這裏有一個例子,以獲得registrationId http://developer.android.com /google/gcm/client.html#sample-register – josuadas
您是否已從開發者控制檯激活GCM服務? –
不,如何做? –