Google Play に 5000 回ダウンロードされたアプリがあります。
それらの 5000 のうち、900 はサーバーに GCM 登録 ID を保存できませんでした。
失敗率が 18% であることを懸念しており、その理由を突き止めるのに苦労しています。IDをサーバーに渡して保存することは間違いなく問題ではないため、登録の失敗に違いないと思います。プロジェクトでこのようなことに遭遇した人はいますか? 以下のようにコードします。
// Fired every time the app is booted in Main Activity
private void setupGCM()
{
String gcmRegId = GCMRegistrar.getRegistrationId(this);
if (gcmRegId.equals(""))
{
GCMRegistrar.register(this, AppProperties.GCM_SENDER_ID);
} else
{
// This is well tested and is not the issue
ServerUtils.sUpdatePushToken(this, gcmRegId);
}
}
// GCMIntentService Class onRegistered
@Override
protected void onRegistered(Context context, String registrationId)
{
mContext = context;
if (!registrationId.equals(""))
{
AppProperties.GCM_REGISTRATION_ID = registrationId;
new UpdateGCMRegistrationIdAsync().execute();
} else
{
GCMRegistrar.setRegisteredOnServer(context, false);
}
}
// GCMIntentService Class My Async class for updating Reg Id
private class UpdateGCMRegistrationIdAsync extends AsyncTask<Integer, Integer, Void>
{
@Override
protected Void doInBackground(Integer... params)
{
ServerUtils.sUpdatePushToken(mContext, AppProperties.GCM_REGISTRATION_ID);
return null;
}
}