3

Currently I am working on android app which will be in chinese /english version make use of Baidu & Google map respectively. Now, for english version If it is going to be used in china, (Google Map is blocked there) then it has to check for availability of google map. And, if google map fails to load, Baidu map is to be loaded.

I have found some links metioned below, for checking successful loading of google map. But, if there's any other way to check map's availability, I would be glad.

How can I detect pogrammatically whether a Google Map was actually loaded on Android with API v2 (e.g. when network is not available)?

Thanks,

Community
  • 1
  • 1
Binod Lama
  • 226
  • 5
  • 24

1 Answers1

1

What I'm doing in my app is checking is the phone get the GOOGLE SERVICES available.

Do this to get it: GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(getApplicationContext())

Those services are blocked for the phone sold in China. So for those user, you can start your baidu map according to the value returned by isGooglePlayServicesAvailable

HOWEVER for the foreigner like me living in China, you will not be able to check if google will be blocked by the government or not. In my case, on my phone the google services are available but google remains blocked if my VPN is not on.

In this case what you can do is: expecting the user to turn is VPN on, if he s used to China and google it wouldnt be a problem, or change the map you will use after your first attempt to load the map, according to the success or not. For that, use the methods provided by your googlemap object programmatically.

Good luck!

Virthuss
  • 3,142
  • 1
  • 21
  • 39
  • 1
    Thanks, I am checking googleapiavailability as you mentioned. However, I couldn't find methods provided by googlemap for unsuccessful loading attempt. Can you please mention those methods. – Binod Lama Jan 05 '16 at 04:13