Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google place picker is not launching on Android Mi phones

I am facing a problem with Google Place Picker in Android Redmi Phones version 5.1.1. I am using the following code for launching the Google Place Picker.

try {
       PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
                    startActivityForResult(builder.build(SelectLocationActivity.this), 1);
    } catch (Exception e) {
              e.printStackTrace();
              Toast.makeText(SelectLocationActivity.this,""+e.getMessage(),Toast.LENGTH_LONG).show();
    }

I have added following permissions and api key and google play service version.

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application>
<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="my-api-key" />
</application>

It is working on Every phone except Android Redmi Note2. Any suggestion would be appreciated. Thanks in advance.

like image 804
Nisha Avatar asked Jun 23 '16 05:06

Nisha


1 Answers

Based on your manifest file, I believe that you added the key inside of manifest tag and not application. Based on Android docs, the key should be added like this:

<application>
...
  <meta-data
      android:name="com.google.android.geo.API_KEY"
      android:value="YOUR_API_KEY"/>
</application>

Unfortunately, I cannot test it with the device you mentioned, but I remember that I a similar issue with a Samsung device (the code was working on every device, except that one). Also, check the logs again, maybe there is a message and you missed it.

like image 179
Iulian Popescu Avatar answered Nov 18 '22 22:11

Iulian Popescu