Mam aplikację w Google Play z 5000 pobrań.Android GCM Niektóre urządzenia nie rejestrujące się
Z tych 5000, 900 nie udało się zapisać identyfikatora rejestracji GCM na moim serwerze.
Obawiam się, że wskaźnik 18% niepowodzenia i staram się dowiedzieć, dlaczego tak się dzieje. To zdecydowanie nie jest problem z przekazaniem Id do mojego serwera i przechowywaniem, więc zakładam, że musi to być awaria rejestracji. Czy ktoś ma coś takiego w swoich projektach? Kod jak poniżej:
// 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;
}
}
.equals ("") nie jest zalecane. spróbuj regId.trim(). length()> 0 – drulabs
lub '.isEmpty()' – 323go
Doceń swoją odpowiedź, jednak jest to udokumentowane przez google w demo GCM z .equals (""). Plus czy to działałoby na 4100 urządzeń, a nie na 900? – TommyGuns21