B4A Library GoogleMapsExtras

GoogleMapsExtras is an ongoing project to implement more of the Google Maps Android v2 classes in Basic4Android.

Currently the library allows you to create these objects:

Tutorials for each object will be uploaded to the Google Maps Android v2 tutorial thread.

Martin.
 

Attachments

  • GoogleMapsExtras_v1_71.zip
    59.6 KB · Views: 2,853
  • MapsForgeTileProvider_v1.01.zip
    173.1 KB · Views: 2,733
  • GoogleMapsExtras_v2_0_library_files.zip
    82.5 KB · Views: 3,154
Last edited:

marcel

Active Member
Licensed User
Longtime User
Hi,

Would it be possible to implement onMapLoaded event?


I need an event that warns me every time when the map is moved and loaded again.
 

marcel

Active Member
Licensed User
Longtime User
Hi,

I don't think so. This event is only triggered when you change the camera position, I guess.

I would like to have an event when the you move a map with your finger and when the map is loaded. Map End Drag would also be ok but I am not sure this is available.

I have a image view in the center of the screen above the map. When you move the map or change the zoomlevel and this is fnished I will ask the GPS coordinate of this image using projection to get the address.

So I need some kind of trigger when this move/zoom of the map is stopped.

Regards,

Marcel
 

Nostrildumbass

Member
Licensed User
Longtime User
This is awesome. I have a row of records from my database (with coordinates and some data) being loaded as markers on my map with InfoWindows containing some relevant data.

Is there a "close" event handler for the InfoWindowAdapter? Or perhaps a Marker deselected event? When the user taps a marker on my map (opening an InfoWindow) that marker's title is assigned to a String variable (i.e. selectedMarker). If the InfoWindow is closed, I need that String variable to be switched to null.
 

Mbm

Member
Licensed User
Longtime User
Hello,

I have an app that uses GoogleMapsExtras Library an it was working fine for months in all kind of devices but this week, something started to fail. In devices with version of google play services 6.7.76(I think that was released 23th of february) I get an error with the code:

B4X:
Dim MarkerOptions1 As MarkerOptions
MarkerOptions1.Initialize
MarkerOptions1.Position2(cont.Latitude,cont.Longitude).Snippet(line1).Title(str2).Visible(True)

The error is:

B4X:
** Activity (lastpositionmap) Resume **


map ready


java.lang.NullPointerException


    at com.google.k.a.cj.a(Unknown Source)
    at com.google.maps.api.android.lib6.c.dc.<init>(Unknown Source)
    at com.google.maps.api.android.lib6.c.db.a(Unknown Source)
    at com.google.maps.api.android.lib6.c.aj.<init>(Unknown Source)
    at com.google.maps.api.android.lib6.c.al.a(Unknown Source)
    at com.google.maps.api.android.lib6.c.el.a(Unknown Source)
    at com.google.android.gms.maps.internal.l.onTransact(SourceFile:167)
    at android.os.Binder.transact(Binder.java:361)
    at com.google.android.gms.maps.internal.IGoogleMapDelegate$a$a.addMarker(Unknown Source)
    at com.google.android.gms.maps.GoogleMap.addMarker(Unknown Source)
    at uk.co.martinpearman.b4a.googlemapsextras.GoogleMapsExtras.AddMarker(GoogleMapsExtras.java:48)
    at com.mbm.distromel.incidencias.lastpositionmap._fillmap(lastpositionmap.java:543)
    at com.mbm.distromel.incidencias.lastpositionmap._map_ready(lastpositionmap.java:604)
    at java.lang.reflect.Method.invokeNative(Native Method)


    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
    at anywheresoftware.b4a.objects.MapFragmentWrapper$MyMapFragment.onViewCreated(MapFragmentWrapper.java:191)
    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:904)
    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
    at android.app.BackStackRecord.run(BackStackRecord.java:684)
    at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
    at android.app.FragmentManagerImpl$1.run(FragmentManager.java:443)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:157)
    at android.app.ActivityThread.main(ActivityThread.java:5335)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
    at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException

I have been reading and I have realized that maybe I should update my google play services so I have tried to do it but I get this error:

B4X:
java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 4452000 but found 0.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

I have copied google-play-services.jar from <android sdk>\extras\google\google_play_services\libproject\google-play-services_lib\libs to the additional libraries folder and i have added in my main module:

B4X:
#AdditionalRes: C:\Archivos de programa\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res,com.google.android.gms

but it doen´t work and I´m stuck with this problem.

I´ll be glad if someone could help me.

Thank you in advance.
 

Mbm

Member
Licensed User
Longtime User
I have replaced the application editor code for this:

B4X:
AddManifestText( <permission
          android:name="$PACKAGE$.permission.MAPS_RECEIVE"
          android:protectionLevel="signature"/>
      <uses-feature android:glEsVersion="0x00020000" android:required="true"/>)

AddApplicationText(<meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="AIzxxxxxxxxxxxx"/>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"
    />)

And i have replaced my old google_play_services.jar for a new one (version 22) in my Addlibs folder, now I don´t get this error:

B4X:
Code:
java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 4452000 but found 0.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

But still get the error:

B4X:
** Activity (lastpositionmap) Create, isFirst = true **


** Activity (lastpositionmap) Resume **


map ready


java.lang.NullPointerException


    at com.google.k.a.cj.a(Unknown Source)
    at com.google.maps.api.android.lib6.c.dc.<init>(Unknown Source)
    at com.google.maps.api.android.lib6.c.db.a(Unknown Source)
    at com.google.maps.api.android.lib6.c.aj.<init>(Unknown Source)
    at com.google.maps.api.android.lib6.c.al.a(Unknown Source)
    at com.google.maps.api.android.lib6.c.el.a(Unknown Source)
    at com.google.android.gms.maps.internal.l.onTransact(SourceFile:167)
    at android.os.Binder.transact(Binder.java:361)
    at com.google.android.gms.maps.internal.IGoogleMapDelegate$a$a.addMarker(Unknown Source)
    at com.google.android.gms.maps.GoogleMap.addMarker(Unknown Source)
    at uk.co.martinpearman.b4a.googlemapsextras.GoogleMapsExtras.AddMarker(GoogleMapsExtras.java:48)
    at com.mbm.distromel.incidencias.lastpositionmap._fillmap(lastpositionmap.java:543)
    at com.mbm.distromel.incidencias.lastpositionmap._map_ready(lastpositionmap.java:604)
    at java.lang.reflect.Method.invokeNative(Native Method)


    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
    at anywheresoftware.b4a.objects.MapFragmentWrapper$MyMapFragment.onViewCreated(MapFragmentWrapper.java:191)
    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:904)
    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
    at android.app.BackStackRecord.run(BackStackRecord.java:684)
    at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
    at android.app.FragmentManagerImpl$1.run(FragmentManager.java:443)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:157)
    at android.app.ActivityThread.main(ActivityThread.java:5335)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
    at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
** Service (newinst2) Start **


-- AppUpdating.NewInst2: processing service_start

Maybe the googlemapsextras library has a problem with the new google play services, in devices with google play services lower than 6.7.76 works fine.
 

Mbm

Member
Licensed User
Longtime User
Without using GoogleMapsExtras it works fine i have tested it, but I use googlemapsextras because i had problems with adding bitmaps to the markers in the googlemaps library they were shown cut or bad resized,this do not happen with GoogleMapsExtras
 

Mbm

Member
Licensed User
Longtime User
The same code with a previous versión of google play services works fine.
The icons are the same only is different the version of the google play services
 
Top