How to make a search with autosuggest in the Bing Maps SDK? - java

I am trying to use the Bing Maps SDK to display a map in which I show a SearchView. In this SearchView I want to search for locations and when I click on a suggested location, put a marker on the map at that location.
I have previously used the HERE SDK which has a documentation to do this but on Android I can't find any documentation about this Bing Maps SDK.
What I want to achieve is this in Android: https://www.bing.com/api/maps/sdk/mapcontrol/isdk/autosuggestui#TS

Documentation on Bing Maps autosuggest service can be found here: https://learn.microsoft.com/en-us/bingmaps/rest-services/autosuggest
You can use this with Androids AutoCompleteTextView to create a suggestion UI. You will retrieve the suggestions asynchronously from the above service. Here are a few good samples:
https://www.truiton.com/2018/06/android-autocompletetextview-suggestions-from-webservice-call/
How to implement autocompletetextview in Android Studio with an API call?
This service does not return coordinates. This is done so that it isn't used as a replacement for the geocoding service and thus allows them to make this a lower cost service. When a suggestion is selected by the user, you will need to make a single call to a geocoder to get the coordinates of the formattedAddress, then you can use that to display a marker on the map. I recommend setting the result limit to 1 since you only want to top result.
In summary;
Use addTextChangedListener event of AutoCompleteTextView to retrieve suggestions from the autosuggest service.
Use setOnItemClickListener event of AutoCompleteTextView to retrieve the selection from the user, and pass the formattedAddress value into the geocoding service.
Use the coordinates from the geocoder response to create a marker and add to the map.

Related

get data from api and show in recyclerview

i want to get data from API and show that in RecyclerView, then after click on any items, go to another activity and show the result that a get from another api.
i share image from postman with you and i hope you could help me for this
i'm using android stdio and java and i prefer to use retrofit for call from api
thanks for your attention...
Brands Api for MainActivity.java
Products Api for Second Activity
you need to use Retrofit for getting data from API.. you can checkout a tutorial like this - https://howtodoandroid.com/retrofit-android-example/

Google Map Big Markers inaccuracy on tap

I am facing a problem while i am developing an application Using Google maps SDK.
I am creating dynamically some markers on the map, but these markers are quite big (using custom marker image and label above them).
But when i try to tap on a specific marker many times it selects the very next to it.
The accuracy of the click is not perfect and more over some times i need to click twice in order to get the click event get fired.
Making a google search i found that there are some issues with google maps sdk markers.
Is the issue being caused because of the size of the markers?
You can you marker options like this.
MarkerOptions lMarkerOpt = new MarkerOptions()
.title("Title")
.draggable(true)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE))
.position(YourLatLng)
.snippet("Title");
It will use default marker with whatever color you want.

How to add and retrieve places on google map

i am creating a app which offers a service for place to register and store general details and their location then I'd like to retrieve these places locations on the Android app ,based on the user's location, So that when a app user open the app, the registered place near that user in a 5 mile radius is listed or shows on map
Kindly provide the useful solutions or links related to such scenario.
thanks
You can use markers to add locations in google maps. https://developers.google.com/android/reference/com/google/android/gms/maps/model/Marker
Google lists everything here. They also have a sample app on Github here. I'd suggest starting a sample map activity project in Android Studio, it should help you understand the basics of implementing a Google Map in your project.
GoogleMap map = ... // get a map.
// Add a marker at San Francisco.
Marker marker = map.addMarker(new MarkerOptions()
.position(new LatLng(37.7750, 122.4183))
.title("San Francisco")
.snippet("Population: 776733"));

How to handle Google Map v2 Marker's Long click event in Android?

I'm developing an android application in which I've used Google Map v2 API.
I've placed one marker on the map, now I want to set its "OnLongClickListener".
As I can see from Eclipse there are only two listeners available for marker:
googleMap.setOnMarkerClickListener(listener);
googleMap.setOnMarkerDragListener(listener);
Could anybody show me any easy way to handle marker's LongClick event??
I've gone through two solutions here:
Setting a LongClickListener on a map Marker
How to detect long click on GoogleMap marker
as both of the solutions you posted have shown - there is no long click event on markers in the maps api. the first link you posted had a solution that might be able to suit your needs but isn't perfect by any means
i would suggest going here to the gmaps issues page and browsing through the feature requests and adding one if it does not exist

Implement google plus button in android app

Is it possible to add a google plus button added to my android app and have it linked to the one that one that is displayed at the top of the google play store , below the app name? So that when people click the button in the app, the count on the play store would go up.
According to the G+ docs, a +1 button is associated with a particular URL. So, if you can figure out what URL the +1 button in Google Play is associated to, then you should be able to construct a G+ button following the thread here (that I know you've already seen) with that URL and you should be all set. My best guess is that it's the play store URL associated with your app...http://play.google.com/store/apps/details?id=your.package
Sounds like you also want the user to end up in Google Play after they click? If so, just follow the directions here - perhaps you could subclass PlusOneButton or set some click handler on it (calling super) to allow the whole G+ functionality to work before navigating them to the Play Store.

Categories