0

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

user2850818
  • 345
  • 1
  • 3
  • 17
  • what's the api version ? You may want to read http://developer.android.com/training/location/retrieve-current.html – Pedro Lobito Sep 30 '15 at 21:04
  • wrong spelling of permission for coarse location? – headuck Sep 30 '15 at 21:05
  • 1
    Yeah, that spelling was one of the copy and paste. But even after correcting it(because I had is spelled right before) it still gives me the same exception. – user2850818 Sep 30 '15 at 21:09
  • what is the phone model you are using??? perhaps it doesnt use gps rather uses a-gps. – Zahan Safallwa Sep 30 '15 at 21:38
  • "I keep getting an exception whenever I try to access the location on it" -- then post the stack trace associated with the exception: https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this – CommonsWare Oct 01 '15 at 00:10
  • Are you trying to run your app on an emulator? Try and run it on a real device to see if your still get the same message. Also, I know that this may be a stupid suggestion, but sometimes people forget the obvious bits: do you have wifi or mobile data enabled on the phone you are using for testing? You might also want to run `LocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)` to make sure it is on. – panonski Oct 01 '15 at 08:13

0 Answers0