Hi,
In mainfest file plz add the internet permissions after the application tag.
Here is sample comde...
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="android.permission.ACCESS_COARSE_LOCATION">
</uses-permission>
</manifest>
Regards,
On Fri, Sep 17, 2010 at 9:20 AM, 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
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