Androidアプリで GCMIntentService を利用したPush通知を実装したのですが、 ある端末だけ、GCMRegistrarでSenderID登録時に SERVICE_NOT_AVAILABLE というエラーで登録ができない現象が出ております。 原因はさまざまあるようですが、 このエラーが発生する原因についてご存知の方、 あるいは同じ現象を経験され方でどのように対処されたかなど、 教えていただけないでしょうか? リファレンスでは SERVICE_NOT_AVAILABLE について下記のように説明されています。(http://www.techdoctranslator.com/android/guide/google/gcm/gcm) 「デバイスはレスポンスを読めない、またはサーバから、後でリトライできるかもしれない 500/503 が返された。Android アプリケーションは、エクスポテンシャル バックオフを使ってリトライしなくてはならない。」 この現象は Sony Xperia AX (SO-01E)の特定の端末1台で発生しておりが、同機種・同OSバージョンの別の端末では正常に動作しております。 ほかにも十機種ほど試しておりますが、どれも正常に動作しております。 問題の端末はお客様所有のものであるため初期化等はできません。 なんとか別の端末でこの現象を再現させ、原因について説明したいと考えておりますが、再現できずにおります。 ネットでは下記の原因で SERVICE_NOT_AVAILABLE が発生したという情報がありましたが、手持ちの端末では再現できませんでした。 ・端末の時計が正しくない ・端末にGoogleアカウントが設定されていない ・アップデートによってアプリのバージョンが変わったとき コード側では、Push通知設定のボタンをタップすると下記を実行します。 ================================ private void registToken() { // GCM登録 String regId = GCMRegistrar.getRegistrationId(getApplicationContext()); if (regId.equals("")) { GCMRegistrar.register(getApplicationContext(), GCM_SENDER_ID); } } ================================ 上記のコードを実行すると下記のようなログが出力されます。 SERVICE_NOT_AVAILABLE 発生時のリトライは GCMBaseIntentService に実装されています。 ================================ 02-08 14:38:21.783: D/GCMRegistrar(9132): resetting backoff for jp.co.myapp 02-08 14:38:21.803: V/GCMRegistrar(9132): Registering app jp.co.myapp of senders 427105258087 02-08 14:38:21.843: D/memalloc(9132): ion: Unmapping buffer base:0x5dd97000 size:1413120 02-08 14:38:21.853: D/memalloc(9132): ion: Unmapping buffer base:0x5def0000 size:1413120 02-08 14:38:21.853: D/memalloc(9132): ion: Unmapping buffer base:0x5e049000 size:1413120 02-08 14:38:21.873: V/GCMBroadcastReceiver(9132): onReceive: com.google.android.c2dm.intent.REGISTRATION 02-08 14:38:21.873: V/GCMBroadcastReceiver(9132): GCM IntentService class: jp.co.myapp.GCMIntentService 02-08 14:38:21.873: V/GCMBaseIntentService(9132): Acquiring wakelock 02-08 14:38:21.883: D/GCMBaseIntentService(9132): handleRegistration: registrationId = null, error = SERVICE_NOT_AVAILABLE, unregistered = null 02-08 14:38:21.883: D/GCMBaseIntentService(9132): Registration error: SERVICE_NOT_AVAILABLE 02-08 14:38:21.883: D/GCMBaseIntentService(9132): Scheduling registration retry, backoff = 4354 (3000) 02-08 14:38:21.893: V/GCMBaseIntentService(9132): Releasing wakelock 02-08 14:38:26.248: V/GCMBroadcastReceiver(9132): onReceive: com.google.android.gcm.intent.RETRY 02-08 14:38:26.248: V/GCMBroadcastReceiver(9132): GCM IntentService class: jp.co.myapp.GCMIntentService 02-08 14:38:26.248: V/GCMBaseIntentService(9132): Acquiring wakelock 02-08 14:38:26.278: V/GCMRegistrar(9132): Registering app jp.co.myapp of senders 427105258087 02-08 14:38:26.288: V/GCMBaseIntentService(9132): Releasing wakelock 02-08 14:38:26.338: V/GCMBroadcastReceiver(9132): onReceive: com.google.android.c2dm.intent.REGISTRATION 02-08 14:38:26.338: V/GCMBroadcastReceiver(9132): GCM IntentService class: jp.co.myapp.GCMIntentService 02-08 14:38:26.338: V/GCMBaseIntentService(9132): Acquiring wakelock 02-08 14:38:26.348: D/GCMBaseIntentService(9132): handleRegistration: registrationId = null, error = SERVICE_NOT_AVAILABLE, unregistered = null 02-08 14:38:26.348: D/GCMBaseIntentService(9132): Registration error: SERVICE_NOT_AVAILABLE 02-08 14:38:26.348: D/GCMBaseIntentService(9132): Scheduling registration retry, backoff = 6012 (6000) 02-08 14:38:26.358: V/GCMBaseIntentService(9132): Releasing wakelock 02-08 14:38:32.374: V/GCMBroadcastReceiver(9132): onReceive: com.google.android.gcm.intent.RETRY 02-08 14:38:32.374: V/GCMBroadcastReceiver(9132): GCM IntentService class: jp.co.myapp.GCMIntentService 02-08 14:38:32.374: V/GCMBaseIntentService(9132): Acquiring wakelock ================================ 質問させていただくにあたり掲載情報に不足がございましたら追って掲載させていただきます。 SERVICE_NOT_AVAILABLE が発生する原因について、どんな些細なことでも構いませんので情報のご提供をお願いいたします。
↧