Android Question GeoLocation Library ERROR

Alex_Puz

Member
Licensed User
Longtime User
Hello,
SDK=30, Android 12, Oppo-Reno5
if GeoLocation is OFF then error invoike
Logger connected to: OPPO CPH2211
--------- beginning of main
** Service (starter) Destroy (ignored)**
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Error occurred on line: 46 (Main)
java.lang.Exception: Sub geolocation_location signature does not match expected signature.
public static anywheresoftware.b4a.pc.RemoteObject b4a.example.main_subs_0._geolocation_location(anywheresoftware.b4a.pc.RemoteObject,anywheresoftware.b4a.pc.RemoteObject,anywheresoftware.b4a.pc.RemoteObject,anywheresoftware.b4a.pc.RemoteObject,anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception
class anywheresoftware.b4a.pc.RemoteObject, class anywheresoftware.b4a.pc.RemoteObject, class anywheresoftware.b4a.pc.RemoteObject, class anywheresoftware.b4a.pc.RemoteObject,
Code: Copy
LocationProvidersAllowed = Phone1.GetSettings("location_providers_allowed")
    Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
wait for Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then
Try
GeoLoc.Initialize("GeoLocation")
Catch
Log(LastException)
End Try
End If
The error manager does not catch ERROR. The App crashed.
Is there any solution?

Thanks
 
3) And as in Post #8 to fix the crashing bug if GetLocation failed (and to also make sure this event sub's signature matches):

 
Upvote 0
3) And as in Post #8 to fix the crashing bug if GetLocation failed (and to also make sure this event sub's signature matches):

There was a problem before geolocation library sent events.
B4X: Copy
GeoLoc.Initialize("GeoLocation")
 
Upvote 0
In your posted log, it has the line:

java.lang.Exception: Sub geolocation_location signature does not match expected signature.

So, my below change to the sub definition might fix that problem:
B4X: Copy
Sub GeoLocation_Location(success As Boolean, Lattitude As Double, Longitude As Double, info As String, isMockLocation As Boolean)
    Log($"GeoLocation_Location(${success}, ${Lattitude}, ${Longitude}, ${info}, ${isMockLocation})"$)
 
Upvote 0
In your posted log, it has the line:

java.lang.Exception: Sub geolocation_location signature does not match expected signature.

So, my below change to the sub definition might fix that problem:
B4X: Copy
Sub GeoLocation_Location(success As Boolean, Lattitude As Double, Longitude As Double, info As String, isMockLocation As Boolean)
    Log($"GeoLocation_Location(${success}, ${Lattitude}, ${Longitude}, ${info}, ${isMockLocation})"$)
that is already after
B4X: Copy
GeoLoc.Initialize("GeoLocation")
I guess the problem is in a library but why method TRY.. Catch can not handle this error.
I will try use some library to detect My location first and then if succeed use library gelocation, any other idea?
 
Last edited:
Upvote 0
If that doesn't work, maybe you might have better luck with this other lib:

 
Upvote 0
If that doesn't work, maybe you might have better luck with this other lib:

Thanks John will try it.
 
Upvote 0
I will try use some library to detect My location first and then if succeed use library gelocation, any other idea?
That sounds like a good idea :)
 
Upvote 0
Back
Top