Crash on Android : provider doesn't exist: gps

Hi all,

I am working on an application that uses the location event. It works fine on iOS, however it crashes on Android as soon as I run the line below, and my callback is not even called.

Runtime:addEventListener( "location", locationListenerRef )

Here is the log I get  (adb logcat) :

E/AndroidRuntime( 7300): java.lang.IllegalArgumentException: provider doesn't exist: gps E/AndroidRuntime( 7300): at android.os.Parcel.readException(Parcel.java:1469) E/AndroidRuntime( 7300): at android.os.Parcel.readException(Parcel.java:1419) E/AndroidRuntime( 7300): at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:540) E/AndroidRuntime( 7300): at android.location.LocationManager.requestLocationUpdates(LocationManager.java:860) E/AndroidRuntime( 7300): at android.location.LocationManager.requestLocationUpdates(LocationManager.java:454) E/AndroidRuntime( 7300): at com.ansca.corona.CoronaSensorManager$1.run(CoronaSensorManager.java:180) E/AndroidRuntime( 7300): at android.os.Handler.handleCallback(Handler.java:733) E/AndroidRuntime( 7300): at android.os.Handler.dispatchMessage(Handler.java:95) E/AndroidRuntime( 7300): at android.os.Looper.loop(Looper.java:136) E/AndroidRuntime( 7300): at android.app.ActivityThread.main(ActivityThrea

I have been spending 2 days on this bug, searching the web for a solution. It seems this bug was already mentionned on this forum, but no solution was given:

https://forums.coronalabs.com/topic/35317-after-latest-build-got-my-first-error-report-on-google-play-and-a-second-and-a-third/

As expected for using GPS, my Android settings for usesPermissions are:

“android.permission.ACCESS_FINE_LOCATION”

“android.permission.ACCESS_COARSE_LOCATION”

Of course, I want to use GPS, but not make it required for installing the application in Google Play, so I also have in usesFeatures:

{ name = “android.hardware.location.gps”, required = false },

If the device lacks GPS, the expected behavior would be that my callback is called with event.errorCode and event.errorMessage filled with relevant values, and not an internal crash that stops the application.

Really hope to read some advice.

 

Thanks.

 

Regards

Hi.  I don’t have an answer to help fix the problem.  I do suspect the cause, but first let me suggest the following

  1. Upgrade to latest Corona if you’re using an old release like the public release (2014.2511).

  2.  Build and run the ‘GPS example’ that comes with Corona.

If that works and your app doesn’t then you’ll at least know it’s something in your code.  

However, if the demo fails in the same way, then we (the community) and the Corona staff will have more info to go on to help you, and a way to reproduce the error on our own.

Also,

  • You didn’t say what version of Corona SDK you are using.  This is very important.
    • For example, I just did the above experiment running 2015.2644.
      • I then tested it on my Generation 1 Nexus 7.  
      • It works perfectly.
  • The link you posted was two years old, so it may no longer be relevant to this problem.

My guess is that if you use the latest Corona version, both the demo and your app will work.  However, if I’m wrong please post back.

Meanwhile, best of luck.

Hi,

Thank you for the tips! :slight_smile:

I am using the latest build of Corona Enterprise.

I have built and run the ‘GPS example’ and it crashed the exact same way on the device I use for testing.

I have tested both my app and the gps example on other devices and they work, so I guess the crash only happens on this device. It has Android v4.4.4 and kernel version is 3.0.36+

The crash is in Android libraries and I have no way to catch the exception. Seeing the log, I guess the call to a method of Android’s location manager that is made in CoronaSensorManager.java at line 180 should be wrapped by a try / catch, and when an exception is caught, it should call my callback with adequate error codes and messages.

Time to fill a bug report.

Regards :slight_smile:

I’m glad to see that you got some more info on this and have a path forward (filing a bug).  

My apologies for not noticing this was an Enterprise post.  This time it worked out, but I generally don’t give answers to Enterprise questions because the answer space is so (theoretically) large.  Nonetheless, this worked out partly and I’m glad.

Hi.  I don’t have an answer to help fix the problem.  I do suspect the cause, but first let me suggest the following

  1. Upgrade to latest Corona if you’re using an old release like the public release (2014.2511).

  2.  Build and run the ‘GPS example’ that comes with Corona.

If that works and your app doesn’t then you’ll at least know it’s something in your code.  

However, if the demo fails in the same way, then we (the community) and the Corona staff will have more info to go on to help you, and a way to reproduce the error on our own.

Also,

  • You didn’t say what version of Corona SDK you are using.  This is very important.
    • For example, I just did the above experiment running 2015.2644.
      • I then tested it on my Generation 1 Nexus 7.  
      • It works perfectly.
  • The link you posted was two years old, so it may no longer be relevant to this problem.

My guess is that if you use the latest Corona version, both the demo and your app will work.  However, if I’m wrong please post back.

Meanwhile, best of luck.

Hi,

Thank you for the tips! :slight_smile:

I am using the latest build of Corona Enterprise.

I have built and run the ‘GPS example’ and it crashed the exact same way on the device I use for testing.

I have tested both my app and the gps example on other devices and they work, so I guess the crash only happens on this device. It has Android v4.4.4 and kernel version is 3.0.36+

The crash is in Android libraries and I have no way to catch the exception. Seeing the log, I guess the call to a method of Android’s location manager that is made in CoronaSensorManager.java at line 180 should be wrapped by a try / catch, and when an exception is caught, it should call my callback with adequate error codes and messages.

Time to fill a bug report.

Regards :slight_smile:

I’m glad to see that you got some more info on this and have a path forward (filing a bug).  

My apologies for not noticing this was an Enterprise post.  This time it worked out, but I generally don’t give answers to Enterprise questions because the answer space is so (theoretically) large.  Nonetheless, this worked out partly and I’m glad.