Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google map not showing when app is downloaded from playstore but showing fine when installed directly signed apk

I am facing an issue in google map.Google map is not showing when I download the apk from google play store but it works fine when I manually install(by transferring to device) same apk which was uploaded to play store.

I have rechecked my debug and release keys which are present here

Please find permission in manifest file:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />

And in Application node:

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />

and my java file says:

@Override
public void onMapReady(GoogleMap googleMap) {

    try {

        map = googleMap;
        // it will hide navigation and gps pointer buttons on map
        map.getUiSettings().setMapToolbarEnabled(false);
        //            map.getUiSettings().setZoomControlsEnabled(false);

        if (TextUtils.isEmpty(companyDetailModel.getSupplierCompanyDetailsRS().getResponseDetail().getCompanyDetail().getLatitude())) {


            if (!PermissionUtil.checkPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION)) {

                PermissionUtil.requestPermission(getActivity(), android.Manifest.permission.ACCESS_FINE_LOCATION, LOCATION_PERMISSION_CODE);

            } else {
                map.setMyLocationEnabled(true);

                GoogleMap.OnMyLocationChangeListener myLocationChangeListener = new GoogleMap.OnMyLocationChangeListener() {
                    @Override
                    public void onMyLocationChange(Location location) {
                        LatLng loc = new LatLng(location.getLatitude(), location.getLongitude());
                        map.animateCamera(CameraUpdateFactory.newLatLngZoom(loc, 16.0f));
                    }
                };
                map.setOnMyLocationChangeListener(myLocationChangeListener);

            }


        } else {

            LatLng latLng = new LatLng(Double.parseDouble(companyDetailModel.getSupplierCompanyDetailsRS().getResponseDetail().getCompanyDetail().getLatitude()), Double.parseDouble(companyDetailModel.getSupplierCompanyDetailsRS().getResponseDetail().getCompanyDetail().getLongitude()));
            map.addMarker(new MarkerOptions().position(latLng)/*.title("" + companyDetailModel.getSupplierCompanyDetailsRS().getResponseDetail().getCompanyDetail().getAddress())/*.icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_launcher))*/);
            map.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 14.0f));
        }


        map.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
            @Override
            public void onMapClick(LatLng latLng) {
                showFullScreenMap();
            }
        });

    } catch (Exception e) {
        Log.i("LatLng exception", "" + e);
        Utils.showToast(getActivity(), "" + e);
    }

}
like image 749
Rohit Sharma Avatar asked Jun 21 '17 06:06

Rohit Sharma


People also ask

Why can't I find an app in the Google Play store?

The most common explanation for why you can't download certain apps from Google Play is that the app's developers have marked it as "incompatible" with your device. You'll see a message stating "this app is not available for your device" or "this app is not available for any of your devices" in this case.

Why I cannot use Google map?

There are various reasons why this happens. It's possible the location accuracy option is disabled, you're using an older version of the app, or you don't have proper access to the internet. The Google Maps app itself may have issues, too. Cache files and other app data can sometimes cause various issues with the app.


2 Answers

I recently Upload the APK on Google Play store and I faced the same issue after checking the Play Console I found the solution for this problem.

Their is no problem with your key but the problem is with your SHA-1. You signed your APK with your SHA-1 that is fine and then upload the APK it also fine.

But as per the new update for Play Console when you signed your APK with SHA-1 and upload the APK it only signed by you but as per the new update it is also signed by Google Play for more security. Have a look here some part of Google Play section:

With Google Play App Signing: You sign your app with your upload key. Then, Google verifies and removes the upload key signature. Finally, Google re-signs the app with the original app signing key you provided and delivers your app to the user.

You can refer Documentation here.

Now, The Answer of your question is After successfully upload the APK you can see that in the section with Two SHA-1 the 1st SHA-1 is Google created its own and 2nd SHA-1 is its yours.

So just copy the Google SHA-1 and paste it to your console where you generate the Google Map API Key.

like image 190
Andy Developer Avatar answered Oct 29 '22 03:10

Andy Developer


After a long research about App Signing feature, I came to solution that Google ADDED App Signing feature for app publishing over Google Play. This feature is added due to Keystore mismatch/lost issue faced by all client/developer.

Generally, in new Update of Google Play Developer Console when we upload any apk file over Google Developer , it default provide the service of app signing by Google-Play Self istead Development/Release Keystore has been lost User can update app with new certificate.

App signing key: The key used to sign the APK that's on a user's device. You currently hold the app signing key and use it to sign your APKs. When you complete the program sign-up flow you will upload this key to Google.

Upload key: A new key you generate during your enrollment in the program. You will use the upload key to sign all future APKs prior to uploading them to the Play Console.

So if you accept the App Signing feature during app publishing, then On Google Console you have to provide the Google's App Signing Key SHA-1 key instead of Your uploaded certificate key. So just change it with App Signing SHA-1 Certificate.

You can find App Signing Certificate SHA-1 key from below Tabs.

Google Play Developer Console > Dashboard > Release Management > App Signing.

like image 22
Krishna Avatar answered Oct 29 '22 02:10

Krishna