In the class C2DMBaseReceiver in the method handleRegistration
The retry code supplied is **WRONG**!
The am.set method takes in the time since bootup in milliseconds that the the
intent should fire at. We are passing in 30000, 60000, 120000 etc. All these
values will be WELL in the past. What we should pass in is:
am.set(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() + backoffTimeMs,
retryPIntent);
This means we are saying the next intent should be fired at now +
backOffTimeMs. This is the first bug in the published code.
The second bug is that there is no BroadcastReceiver that is wired up to
receive the
com.google.android.c2dm.intent.RETRY
intent!
So, we include the following addition in the manifest file:
<receiver android:name="com.google.android.c2dm.C2DMBroadcastReceiver">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RETRY"/>
<category android:name="io.modem" />
</intent-filter>
</receiver>
(this is an additional block, leave all other things as is)
And there you go! It will start working!
Original issue reported on code.google.com by varun.ch...@gmail.com on 5 Oct 2011 at 6:50
Original issue reported on code.google.com by
varun.ch...@gmail.com
on 5 Oct 2011 at 6:50