@Mark, it worked..thanks a lot..it was just a typo which i overlooked.. On Jan 4, 8:07 pm, Namrata <[email protected]> wrote: > I am writing 1 application which has one service class. This service > class uses ConnectionManager.getAllNetworkInfo() api to access network > related info. > But if I use this api i get error like > 01-04 20:05:58.243: WARN/System.err(711): java.lang.SecurityException: > ConnectivityService: Neither user 10023 nor current process has > android.permission.ACCESS_NETWORK_STATE. > > Declaration of Service in manifest is as follows > > <service android:name="com.abc.xyz.MyService"> > <intent-filter> > <action > android:name="com.abc.xyz.IMyServiceListener" /> > </intent-filter> > </service> > > Also have included <uses-permission > android:name="android.permission.ACESS_NETWORK_STATE" /> in manifest. > > Tried using same permission tag in service tag but of no use. > > The way I am starting this service in activity is > private void startService() { > try { > startService(new Intent(this, MyService.class)); > bindService(new > Intent(IMyServiceListener.class.getName()), > mConnection, Context.BIND_AUTO_CREATE); > > } catch (Throwable th) { > } > } > > public IMyServiceListener mService = null; > > private ServiceConnection mConnection = new ServiceConnection() { > //@override > public void onServiceConnected(ComponentName className, IBinder > service) { > mService = IMyServiceListener.Stub.asInterface(service); > } > > //@override > public void onServiceDisconnected(ComponentName name) { > mService = null; > } > }; > > Now the MyService class code where I am accessing > ConnectionManager.getAllNetworkInfo() > > public static void IsConnectable() { > ConnectivityManager cm = (ConnectivityManager) _instance.get > ().getSystemService(CONNECTIVITY_SERVICE); //I am getting error here > NetworkInfo infos[] = cm.getAllNetworkInfo(); > > for (NetworkInfo info : infos) { > //TODO: any action can be taken; > } > } > > May be I am missing something here..Anybody knows what I am doing > wrong? Or what else needs to add/remove in/from code to make it > working? > > Thanks in Advance
-- 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

