I'm answering myself:

So actually it works well. I was expecting the broadcast to be sent
more frequently, but it looks like my G1 is keeping the connection
open all the time. The easiest way to test the broadcast is to go to
settings and switch to 2G and back to 3G. The event is fired.

Cheers,

Kuba

On Jan 23, 8:12 pm, Kuba Lipiński <[email protected]> wrote:
> Hello,
>
> I would like my service to be started when the phone is connected to
> the Internet.
>
> I created a class MyReciever which extends BroadcastReceiver and
> starts my service when onReceive is called with intent
> android.net.conn.CONNECTIVITY_CHANGE as parameter.
>
> I added following lines to my application manifest:
>
>                 <receiver android:name=".MyReceiver"
>                  android:enabled="true"
>                  android:priority = "0">
>                     <intent-filter>
>                         <action 
> android:name="android.net.conn.CONNECTIVITY_CHANGE" /
>
>                     </intent-filter>
>                 </receiver>
>
>     </application>
>
>         <uses-permission
> android:name="android.permission.ACCESS_NETWORK_STATE" />
>         <uses-permission android:name="android.permission.INTERNET" />
>
> Unfortunatelly MyReciever.onReceive is never call when I establish the
> Internet connection using any different application. Why is that?
>
> Cheers,
>
> Kuba
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to