B4A Library Expanded Location Manager Library

andre.astafieff

Member
Licensed User
Longtime User



I found the solution.

Debugging was on my tablet (android 4.0.30, so I had to go into "Settings"> Location Services and enable the options Google Location Service and Location and google search.

I also changed the way of calling the callback function of location.

Sub Location_Locationchanged (The Double Longitude, Latitude As Double, Height As Double, Accuracy The Float The Float Bearing, Provider As String, Speed ​​The Float, The Long Time)
Msgbox (Longitude, "Longitude")
end Sub


Now it works. :sign0060:
 

marcel

Active Member
Licensed User
Longtime User
Hi,

I am new this lib and the location manager. So forgive me when I ask silly questions.

But why need the Location Services enables when you select Network Position Updates in the Demo program. This means that the GPS is still active and consume a lot of power? Correct?

If not how can you see the differences? Or is in my case there no alternative in my neighbourhood and will the GPS selected?
 

Thomas Philip C

Member
Licensed User
Longtime User
HI,

How can i clear an old location that was found . my app seems to record the last location. how would i make the app get the new location instead. (based on network network).

regards,
Tom
 

siddsg

Member
Licensed User
Longtime User
Hello,
I want to be able to detect if the "My Location > Use Wireless Networks" is enabled or not.

Does anyone know how to do that?

Thanks,
Siddharth
 

desbiens

Member
Licensed User
Longtime User
Hello,
On all my phones/tablets I am able to get a proper current wifi location except with one of the galaxy nexus. It gives me my last wifi location which is very far away. How do I get my current wifi location for this phone? All the location settings on the galaxyNexus are ON.
 

romario11

Member
Licensed User
Longtime User
Hi,

Would it be possible to set multiple proximity alerts at once? If so, how to end a specific proximity alert?


hi,
can you set multiple proximity alerts ? im trying and i dont know it

I think it could be done setting multiple

dim location1 as esLocation
dim location2 as esLocation
dim location3 as esLocation
dim location4 as esLocation
dim location5 as esLocation
dim location6 as esLocation

and
location1.addproximityAlert(meters,lat,long,-1)
location2.addproximityAlert(meters,lat,long,-1)
location3.addproximityAlert(meters,lat,long,-1)
location4.addproximityAlert(meters,lat,long,-1)
location5.addproximityAlert(meters,lat,long,-1)
location6.addproximityAlert(meters,lat,long,-1)

and the same events but this is a great fudge ¿?




i need help
 

hookshy

Well-Known Member
Licensed User
Longtime User
If both network listener and gps listener are enabled, Location_changed event is raised both times from the two providers ?
Listening position in this case would be not so accurate if from time to time you receive a location with a bad accuracy.
Do I have to use lm.stopnetworklistening all the time when I use GPS ??
 

Shay

Well-Known Member
Licensed User
Longtime User
I am getting error on line 171 when trying to run the demo
WHILE GPS IS OFF...

B4X:
Error occurred on line: 171 (main)
java.lang.IndexOutOfBoundsException: Invalid index 11, size is 10


    at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
    at java.util.ArrayList.get(ArrayList.java:304)
    at anywheresoftware.b4a.objects.collections.List.Get(List.java:117)
    at com.edsmith.LocationRange.main._updatelocation(main.java:388)
    at com.edsmith.LocationRange.main._activity_create(main.java:347)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:305)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
    at com.edsmith.LocationRange.main.afterFirstLayout(main.java:98)
    at com.edsmith.LocationRange.main.access$100(main.java:16)
    at com.edsmith.LocationRange.main$WaitForLayout.run(main.java:76)
    at android.os.Handler.handleCallback(Handler.java:615)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4921)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
    at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
 

lock255

Well-Known Member
Licensed User
Longtime User
I also have your same error, how did you solve it?
 

Shay

Well-Known Member
Licensed User
Longtime User
Don't remember, just don't use this part of the code
(I think there isn't any 11 in this list)
or check list size
 

lock255

Well-Known Member
Licensed User
Longtime User
Don't remember, just don't use this part of the code
(I think there isn't any 11 in this list)
or check list size
I have not used, but accuracy of the coordinates is bad, you know a way to get delel coordinated through the network, very accurate?
 

sunish

Member
Licensed User
Longtime User
I also have your same error, how did you solve it?
The error happens when there is no data available for a particular location provider, the hard coded array index goes out of bounds.
The following code in Update Location should prevent the error.

B4X:
    If myList.Size >=4 Then
    netTimeTxt.Text = DateTime.Date(myList.Get(1)) & " " & DateTime.Time(myList.Get(1))
    netLatTxt.Text = NumberFormat(myList.Get(2), 0, 9)
    netLongTxt.Text = NumberFormat(myList.Get(3), 0, 9)
    netAccTxt.Text = NumberFormat(myList.Get(4), 0, 9)
    Else
    Log("No Net location data available")
    End If
   
    If myList.Size >=9  Then
    passiveTimeTxt.Text = DateTime.Date(myList.Get(6)) & " " & DateTime.Time(myList.Get(6))
    passiveLatTxt.Text = NumberFormat(myList.Get(7), 0, 9)
    passiveLongTxt.Text = NumberFormat(myList.Get(8), 0, 9)
    passiveAccTxt.Text = NumberFormat(myList.Get(9), 0, 9)
    Else
    Log("No Passive location data available")
    End If
       
    If myList.Size >=14  Then
    gpsTimeTxt.Text = DateTime.Date(myList.Get(11)) & " " & DateTime.Time(myList.Get(11))
    gpsLatTxt.Text = NumberFormat(myList.Get(12), 0, 9)
    gpsLongTxt.Text = NumberFormat(myList.Get(13), 0, 9)
    gpsAccTxt.Text = NumberFormat(myList.Get(14), 0, 9)
    Else
    Log("No GPSlocation data available")
    End If
 

KY Leng

Member
Licensed User
Longtime User
whatever the version of location manager library, it does not work for me.
 

Avansys

Member
Licensed User
Longtime User
Does it work if I use it in a service?
 
Last edited:

Peter van Hoof

Member
Licensed User
Longtime User

First of all thanks for the excellent library. there seems to be an error in the initialize info. The subroutines called are Location_locationchanged etc this is also incorrect in the tooltip.

Peter van Hoof
 

Peter van Hoof

Member
Licensed User
Longtime User

I think there is an error in the documentation. If you use Localit.Initialize("Location") the subroutine fired for changed location is Location_Locationchanged instead of Locationchanged_Location

Peter van Hoof
 

Glenn1963

New Member
Licensed User
Longtime User
For findLastLocation, are the results sorted, hopefully by Time of Fix Desc?

Also, can you direct me to some documentation on ArrayLists? ie. the best way to process them?

Thanks!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…