Friday, 24 May 2019

Implement Sharing Location Places Picker same like WhatsApp without Places Picker Since it got deprecated

We had a requirement of sharing location which is a similar kind of WhatsApp with respective to User Interface & functionality.

I have come across that Google Place Picker has got deprecated and also migrated to Places Clients.

Say Like as,

and when they are trying to search,

May be, I am not good at explaining my idea but overall I am in the search of the above kind of implementation.

And also I came to know that Google Charges for the search or the places from the below Url,

https://github.com/rtchagas/pingplacepicker

What all I have tired is,

Coding Part:

Places.initialize(applicationContext, "Google API Key")
placesClient = Places.createClient(this)



val autocompleteFragment =
          getSupportFragmentManager().findFragmentById(R.id.autocomplete_fragment) as AutocompleteSupportFragment

autocompleteFragment.setPlaceFields(Arrays.asList(Place.Field.ID, Place.Field.NAME));

autocompleteFragment.setOnPlaceSelectedListener(object : PlaceSelectionListener {
            override fun onPlaceSelected(p0: Place) {
                TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
            }

            override fun onError(p0: Status) {
                TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
            }
        });

 val intent = Autocomplete.IntentBuilder(
            AutocompleteActivityMode.FULLSCREEN, fields
        )
            .build(this);
        startActivityForResult(intent, AUTOCOMPLETE_REQUEST_CODE);

After searching for two three places I am get an error saying Retry. Don't know the reason.

Error:

enter image description here

Help is really appreciated.



from Implement Sharing Location Places Picker same like WhatsApp without Places Picker Since it got deprecated

No comments:

Post a Comment