Confused with GPRS and GPS?? before using the GPS, you would have to enable it in settings.
-Kumar Bibek http://techrdroid.kbeanie.com On Sep 17, 12:20 pm, mayank bisht <[email protected]> wrote: > I have android HTC mobile os version - 1.6 . I have GPRS setting in my > mobile. I can access internet through mobile. But in my programme to > findout my current latitude and longitude i checked the gps enabled it > shows false.Can anyone help me why it is so ? My code is below > > LocationManager mlocManager = > (LocationManager)getSystemService(Context.LOCATION_SERVICE); > LocationListener mlocListener = new location(); > > List<String> providers = mlocManager.getAllProviders(); > > boolean gprsenabled = > mlocManager.isProviderEnabled(LocationManager.GPS_PROVIDER); > Toast.makeText(getApplicationContext(), > ((Boolean)gprsenabled).toString(), Toast.LENGTH_LONG).show(); > > boolean ntwrkenabled = > mlocManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); > Toast.makeText(getApplicationContext(), > ((Boolean)ntwrkenabled).toString(), Toast.LENGTH_LONG).show(); > > if(gprsenabled) > > mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, > mlocListener); > > if(!gprsenabled) > > mlocManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, > 0, 0, mlocListener); > > if(!gprsenabled && !ntwrkenabled) > Toast.makeText(getApplicationContext(), "No GPRS and No CellId is > enabled", Toast.LENGTH_LONG).show(); -- 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

