I am working on a app and I keep getting an exception whenever I try to access the location on it. I looked at other answers and it's always they either did not put the location permissions in the manifest file or they misspelled something. However, after copying and pasting several bits of those examples, I keep having the same problem. It's in the following function.
public void startLocationUpdates()
{
try
{
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
int a = 0;
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
}
Here's my entire AndroidManifest.xml files, since maybe I put the permission tags in the wrong place.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sample.app" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<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>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
</manifest>
Edit: I'm not really that familiar with the Android Studio interface so I'm not sure what parts of the LogCat I should put. However, the following keeps popping up.
09-30 13:58:47.974 1274-1287/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
09-30 13:58:48.989 1274-1287/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
09-30 13:58:49.429 1274-1287/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
09-30 13:58:50.722 1274-1287/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
09-30 13:58:50.807 1274-1287/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
09-30 13:58:50.810 1274-1287/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
09-30 13:58:50.921 1274-1287/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
09-30 13:58:50.924 1274-1287/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
09-30 13:58:50.927 1274-1287/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
09-30 13:58:50.931 1274-1287/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
09-30 13:58:50.932 1274-1287/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
Does this mean anything to anyone?
-Edit Updated to show the misspelled "permissions" was not the cause. -Edit Here's the "Info" log files. It's running on an emulated Nexus 4. I'm using an emulator because I'm having issues with my phone, but I can get another phone if you guys really think that's the issue. And yes, wifi and gps is turned on the emulated device.
10-01 10:09:35.609 1296-1309/system_process W/GpsLocationProvider﹕ Could not open GPS configuration file /etc/gps.conf
10-01 10:09:35.610 1296-1309/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
10-01 10:09:36.587 1296-1309/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
10-01 10:09:40.549 1296-1309/system_process W/GpsLocationProvider﹕ Could not open GPS configuration file /etc/gps.conf
10-01 10:09:40.549 1296-1309/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
10-01 10:09:40.550 1296-1309/system_process W/GpsLocationProvider﹕ Could not open GPS configuration file /etc/gps.conf
10-01 10:09:40.550 1296-1309/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
10-01 10:09:40.551 1296-1309/system_process W/GpsLocationProvider﹕ Could not open GPS configuration file /etc/gps.conf
10-01 10:09:40.551 1296-1309/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
10-01 10:09:40.572 1296-1309/system_process W/GpsLocationProvider﹕ Could not open GPS configuration file /etc/gps.conf
10-01 10:09:40.572 1296-1309/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
10-01 10:09:40.576 1296-1309/system_process W/GpsLocationProvider﹕ Could not open GPS configuration file /etc/gps.conf
10-01 10:09:40.576 1296-1309/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
10-01 10:09:40.577 1296-1309/system_process W/GpsLocationProvider﹕ Could not open GPS configuration file /etc/gps.conf
10-01 10:09:40.577 1296-1309/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
10-01 10:09:41.400 1296-1309/system_process W/GpsLocationProvider﹕ Could not open GPS configuration file /etc/gps.conf
10-01 10:09:41.400 1296-1309/system_process E/GpsLocationProvider﹕ no AGPS interface in set_agps_server
And it doesn't really give me a stack trace. In the Exception object, this is the value for the stack trace: java.lang.StackTraceElement[0]@4145