Re: [android-developers] Unable to register CONNECTIVITY_ACTION in a service

2012-10-04 Thread Robert Greenwalt
You are registering in your constructor. I think you need to register in onCreate. You appear to not have a context when your constructor is called. On Wed, Oct 3, 2012 at 9:17 PM, Subodh Nijsure subodh.nijs...@gmail.comwrote: Hello Robert, Below is the stack trace that I see when system

[android-developers] Unable to register CONNECTIVITY_ACTION in a service

2012-10-03 Thread Subodh Nijsure
Hello, I am trying to implement a service that is supposed to download stuff from a cloud service. So I want this service to be notified whenever phone/tablet looses network connectivity. So I implemented code that looks like this: receiver = new ConnectivityReceiver();

Re: [android-developers] Unable to register CONNECTIVITY_ACTION in a service

2012-10-03 Thread Rahul Kaushik
hi subodh try this package com.FranConnectMobile; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import android.app.Activity; import android.content.Context; import android.net.ConnectivityManager; public class chkInternet extends Activity { public

Re: [android-developers] Unable to register CONNECTIVITY_ACTION in a service

2012-10-03 Thread Robert Greenwalt
Checking network types explicitly like this is bad - what happens if the device is connected through a bluetooth tether or via ethernet adapter? You could use getActiveNetworkInfo() and check it's connection, but this is still polling. If you need to get notified when a connection comes or goes

Re: [android-developers] Unable to register CONNECTIVITY_ACTION in a service

2012-10-03 Thread Subodh Nijsure
Hello Robert, Below is the stack trace that I see when system catches the exception: Not sure if you had any chance glancing at my sample code on original email, and see if anything obviously wrong there? I/System.out(12738): java.lang.NullPointerException I/System.out(12738):at