Add <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
too in manifest..
unable to get longitude and latitude in android for real device
-
19-07-2023 - |
Vra
When I run the App on android emulator and pass the longitude and latitude values from DDMS i get the proper values and also the city name but when I install the .apk file into real device the values of longitude and latitude is set to 0.0 and 0.0. I turned on the gps and every other settings required but still unable to get the co-ordinates.
Manifest file:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
<activity android:name="MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Oplossing
Gelisensieer onder: CC-BY-SA met toeskrywing
Nie verbonde aan StackOverflow