0

in my app i am using google maps with pickup and drop place search box on top.I am using autocomplete textview based on the following links https://github.com/seatgeek/android-PlacesAutocompleteTextView.now i am going to release my apk. my code is repositories { mavenCentral() maven(){ url "https://oss.sonatype.org/content/repositories/snapshots" } } compile 'com.seatgeek:placesautocomplete:0.2-SNAPSHOT' xml file is:

    app:pacv_historyFile="@string/pacv_default_history_file_name"
    app:pacv_googleMapsApiKey="AIzaSyCDtiMxC1BvScyGOFibjo16MPFe-eQcGRE"/>

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    PlacesAutocompleteTextView placesAutocomplete=(PlacesAutocompleteTextView)findViewById(R.id.places_autocomplete);


    placesAutocomplete.setOnPlaceSelectedListener(
            new OnPlaceSelectedListener() {
                @Override
                public void onPlaceSelected(final Place place) {
                    // do something awesome with the selected place
                }
            }
    );

what i did:: i go to google API CONSOLE and enabled google maps places api for android.i didnot add any restrictions and then i got a api key with yellow color warning mark.i paste it in the xml file at " app:pacv_googleMapsApiKey="AIzaSyCDtiMxC1BvScyGOFibjo16MPFe-eQcGRE"/> ".

mydoubt:: my autocomplete textview is working properly showing suggestions while i am testing.my doubt is that when i release apk in playstore it will work or not.please help me.

shyamyy
  • 29
  • 3

2 Answers2

1

Key will be same(Your product key) just enable google place web service api in your project from google console.If you are using auto complete text view else you can also use the new placeAutoCompleteFragment or google place picker api(New).

http://www.truiton.com/2015/04/using-new-google-places-api-android/

This link is for google place picker.

Rishabh Mahatha
  • 1,251
  • 9
  • 19
  • com.seatgeek.placesautocomplete.model.PlacesApiException: This IP, site or mobile application is not authorized to use this API key. Request received from IP address 49.205.134.13, with empty referer i m getting these eror – shyamyy Dec 19 '16 at 06:38
  • you are using the api key for same application, which is in the google console made by you? – Rishabh Mahatha Dec 19 '16 at 06:44
  • else go through this link http://stackoverflow.com/questions/21933247/this-ip-site-or-mobile-application-is-not-authorized-to-use-this-api-key – Rishabh Mahatha Dec 19 '16 at 06:46
-1

If you do not add any restriction when it will not effect. In case you really want to put restriction for API key then you should add "Package name : fingerprint" so any app will not have match with this. So after that this key will only associated with your application.enter image description here

Please see this image.

bharat7777
  • 323
  • 3
  • 15
  • @bharat...thankyou.i followed this and getting error like this "This IP, site or mobile application is not authorized to use this API key. Request received from IP address 2405:205:8005:20b8:e964:b1fe:fc27:bdb3, with empty referer"..how to clear this – shyamyy Dec 20 '16 at 05:21
  • "2405:205:8005:20b8:e964:b1fe:fc27:bdb3" what kind of ip address is this. I think have mentioned above for adding application signature and package name right? – bharat7777 Dec 20 '16 at 05:47
  • yes i added my project app fingerprint and package name.then i am getting these error.but without adding these key restriction ,its working corectly – shyamyy Dec 20 '16 at 05:52