Android Question GoogleMaps: Ignoring event: mapfragment1_ready

eurojam

Well-Known Member
Licensed User
Longtime User
For some unkown reasons sometimes I get the message in the logs "Ignoring event: mapfragment1_ready" (Release mode). In that case any action between the user and the google map leeds to an error: java.lang.RuntimeException: Object should first be initialized (GoogleMap).
The mapfragment is added with the designer as a custom type, the B4A Version is 6.00.
Any hints or help is very appreciated

best
stefan
 

eurojam

Well-Known Member
Licensed User
Longtime User
No, the example works perfect without the ignore message - so I have to check my code again...thank you Erel
 
Upvote 0

eurojam

Well-Known Member
Licensed User
Longtime User
No I didn't get that solved, as I mentioned, this happens sometimes, I guess that this something asynchronous between the map_ready event and the google response.

Best
Stefan
 
Upvote 0

Serdar K.

Member
Licensed User
Longtime User
Sorry, No, that was not it. The issue came up again.
But still once it worked.

The issue is coming up when you put gmap object in "Process_Globals" instead of "Globals".

I found the solution as adding another reference object as :

B4X:
Sub Process_Globals
    Dim gmapglobal As GoogleMap
end sub

and updating it when i get gmap.

B4X:
...
gmap = MapFragment2.GetMap
gmapglobal  = gmap
...

to use from other activities. I am not sure that i get the location correct then, but it works :

B4X:
...
      vSurveyLat = Main.gmapglobal.MyLocation.Latitude
      vSurveyLon = Main.gmapglobal.MyLocation.Longitude
...
 
Upvote 0

Serdar K.

Member
Licensed User
Longtime User
I think i have found it this time.
I had a call :
B4X:
If flgLogInShown= False Then
            CallLoginScreen
        flgLogInShown=True
    End If

which was actually closing the form and opening login activity (i think before map initialized completely).

You can check the "pause"s and "resume"s of your activities.

I changed it to :

B4X:
If flgLogInShown= False Then
       CallSubDelayed(Me,"CallLoginScreen")
     flgLogInShown=True
   End If

Now it seems OK. If i find anything additional, i will let you know.
 
Upvote 0
Top