1

I have a service that runs at boot to update the user's database, but i need to wait until they have an internet connection, or my service fails. here is what i have so far -

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<receiver android:name=".ClockReceiver">
<intent-filter >
   <action android:name="android.intent.action.BOOT_COMPLETED"/>
   <action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>

is it possible to have the broadcast wait until an internet connection is available?

Shmuel
  • 3,916
  • 2
  • 27
  • 45
  • 1
    No, BroadcastReceiver has life time of 10 seconds only. – Lucifer Apr 04 '13 at 06:30
  • Of course it is possible to achieve what you want, but you're asking the wrong question. ;) – class stacker Apr 04 '13 at 06:37
  • 1
    Use two BroadcastReceivers. Register a BroadcastReceiver that waits until a connection is established. And use your current ClockReceiver that sets a flag to tell you that the system has rebooted (or you could probably just query the last boot time and compare it that way). http://stackoverflow.com/questions/7140061/broadcast-receiver-and-internet-connection – Stephan Branczyk Apr 04 '13 at 06:37

0 Answers0