Android Question Geo-point PlacePicker

peacemaker

Expert
Licensed User
Longtime User
Anyone tried to implement ?
https://developers.google.com/places/android-api/placepicker

No ide how to do next:

B4X:
Sub Process_Globals
    Private ion As Object
    Dim PLACE_PICKER_REQUEST = 1
End sub

Sub butGetPlace_Click
Dim i As Intent
i.Initialize(i.ACTION_VIEW, "geo:0,0?q=""""")
i.WrapAsIntentChooser("Select map point:")
StartActivityForResult(i)
End Sub

Sub StartActivityForResult(i As Intent)
   Dim jo As JavaObject = GetBA
   ion = jo.CreateEvent("anywheresoftware.b4a.IOnActivityResult", "ion", Null)
   jo.RunMethod("startActivityForResult", Array As Object(ion, i))
End Sub

Sub GetContext As JavaObject
  Return GetBA.GetField("context")
End Sub

Sub GetBA As JavaObject
  Dim jo As JavaObject
  Dim cls As String = Me
  cls = cls.SubString("class ".Length)
  jo.InitializeStatic(cls)
  Return jo.GetFieldJO("processBA")
End Sub

Sub ion_Event (MethodName As String, Args() As Object) As Object
Log("resultCode = " & Args(0))
If Args(0) = -1 Then 'resultCode = RESULT_OK
Else If Args(0) = 0 Then 'resultCode = RESULT_CANCELED
Else If Args(0) = 1 Then 'resultCode = RESULT_FIRST_USER
End If
Dim i As Intent = Args(1)
Log(i.ExtrasToString)

Return Null
End Sub


How should be picker used ?

Or any other way - how to choose the geo point by another app and get the coordinates back to my app ? Without building in any map service into my app.
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…