3
使用前に端末側でGCMが使えるか確認しましょう。多分ですが使用されている実機がGoogle Play Servicesを利用できない状況になっていると思われます。
https://developer.android.com/intl/ja/google/gcm/client.html
に、確認するためのコードが提示されているので下記に引用しておきます。
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (...
2
新しいアプリケーションはFirebase Cloud Messaging (FCM)でスタートせよ、既存のユーザにも移行を推奨する、との事です。
If you are integrating messaging in a new app, start with FCM.
GCM users are strongly recommended to upgrade to FCM, in order to benefit from new FCM features today and in the future.
https://developers.google.com/cloud-messaging/gcm
この書き方からすると、新しくGCMを使い始める事は出来なそうですね。
1
単純に名称が間違っていました。
誤り
android:name="org.techbooster.gcmsample.GCMIntentService"
android:name="org.techbooster.gcmsample.GCMBroadcastReceiver"
正しい
android:name="org.techbooster.gcmsample.GcmIntentService"
android:name="org.techbooster.gcmsample.GcmBroadcastReceiver"
1
一部端末でできないようなのでこれかもしれません。
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
Android 4.0.4 以前(4.0.4含まない)では上記のパーミッションが必要です。
4.0.4を含むそれ以降は必要ありません。
1
Firebase Cloud MessagingになりMessage Pushの信頼性も改善されたようですが, GCMがクライアントに届かないケースはあります.
こちらでいくつか取り上げられているので参考になれば幸いです.
他にもAndroid6.0で追加された機能Dozeではhigh-priorityなPushでないとTTLに従って破棄されます.
when using normal priority (the default priority), there are a number of different behaviors when the device is in Doze, including:
The most important change is that messages will be ...
1
おそらく質問当初と状況は変わっていると想いますが、https://firebase.google.com/docs/cloud-messaging/android/legacy-regid?hl=ja から引用します。
クライアント アプリの更新: クライアント アプリを更新するときは、既存の登録 ID
が新しいバージョンで動作することが保証されないため、その ID を無効にする必要があります。おすすめの方法は、登録 ID
を保存する際に現在のアプリのバージョンを格納し、クライアント
アプリが起動された際に、この保存した値を現在のアプリのバージョンと比較することです。両者が一致しない場合は、保存されたデータを無効にして再度登録処理を開始します。
バックアップと復元: クライアント ...
上位に投票された、最小文字数のコミュニティ wiki 以外の回答のみが対象となります