android - Why MapView returns null if not logged into Google Play Account? -


i created fragment mapview, works fine if user logged google play account. if reset device , launch application, crashes when initialize mapview.

map = mapview.getmap(); 

why happen? , in order prevent crash, should check if user logged google account?

from documentation

it returns googlemap. null if view of map not yet ready. can happen when google play services not available. if google play services becomes available afterwards, calling method again initialize , return googlemap.

and can not access google services until did not logged-in play.


although method googlemap getmap () has been deprecated, should use getmapasync (onmapreadycallback callback)


Comments

Popular posts from this blog

xml - Extract substrings with XSLT -

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

Fatal error: Call to undefined function menu_execute_active_handler() in drupal 7.9 -