behrad
behrad

Reputation: 1278

App won't run without google play services which are not by your device

I have a problem with GoogleMap on some devices(include some emulators and some real devices). When I try to load the map this error happens

App won't run without google play services which are not by your device

, but the GoogleMap application shows its map on its own application. Is there any way to solve it?

Upvotes: 8

Views: 10104

Answers (2)

Aykut Uludağ
Aykut Uludağ

Reputation: 4219

Unfortunately, you can not use Google Maps Platform without Google Play Services. However there is a trick which you can show map with or without Google Play Services.

First determine device has Google Play Services (GPS). Following code works for that purpose:

   int resultCode = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this);
            if (resultCode == ConnectionResult.SUCCESS) {
                 // Load Map as Native
                 // https://developers.google.com/maps/documentation/android-sdk/start
            }else{
                // Load Map in Webview/Customtabs
                // https://developers.google.com/maps/documentation/javascript/overview
            }

If device has GPS and enabled, you can safely load native map. If doesn't you need to load map in WebView or CustomTabs. By this way, you can cover all devices whether GPS is available or not. Best regards.

Note: In your situation, if you are using emulator you need to choose Android Platform with Google APIs.

Upvotes: 1

hientp
hientp

Reputation: 834

You should fall back your app to use Open Street Map if the device is not supported Google Play service. The native google maps app use their own API so it can run independently with Google Play Service

Upvotes: 2

Related Questions