Alert user using google places api - android

i currently have an android application that will find a users current location and shows places of interest within a specified radius on a map through Google places API. I am now looking for a way now to alert the user of these places when they come within the distance? e.g show a notification like "Point of interest is close by"

You can check Google's Geofencing API, I think it will be the best solution for you and also best solution battery-wise.

you just need to check for distance using lat/long of user and your fav. place .. and put a condition check that if distance is around this then do that that .. else do that .
Now just create a method that will return your coordinate data ..
For Ex:--
public String getFinalCoordinates(){
// Perform action for lat and long .. and save it like string ..
your_lat_cum_long_data = your_data;
return your_lat_cum_long_data;
}
On later terms you can convert that String to double format like ..
double lat = Double.parseDouble(string) // It's some thing like that ..
// might be here I have done some syntax error .. Please check same.
Else you are good to go ..
EDIT
you might be looking ahead to show notification when a ATM is nearby your location.
Now for this you need to put check like .. nearby ATM's, nearby restra, etc.
Now for each of defined above .. you need to put check like ..
if(places --> is equal to --> nearby ATM's)
{
//callNotificationMethod
}
else
{
// Keep pooling for places api ..
}
Try this and let me know.

Related

How to show marker on that lat/long when appending lat/long in Here We Go Url and How can i get Phone number from place api

I used Reverse Geocoding in my code using TRACK_POSITION where i need to pass
bearing .
ResultListener<Location> listener = new ReverseGeocodeListener();
ReverseGeocodeRequest2 request = new ReverseGeocodeRequest2(geoCoord, null, RETRIEVE_ADDRESSES, bearing);
if (request.execute(listener) != ErrorCode.NONE)
{
// Handle request error ...
}
It takes float value and i am confused what should be the value of bearing. i hardcoded some vale which still gives me response and i am getting street name as result/ response of ReverseGeocoding with lat/long/alt, now here comes the problem i want to get the link of Here We Go website of the particular lat/long.
Case 1: (What i was trying to do)
So i Stored a string value of Here We Go url and i wanted to append lat/long to the url i was successful to do so but the link i am getting is showing me just the area not the marker on the lat/long. how can i achieve the marker on that lat/long.
Case 2: Is there anything we can do programatically to enter lat/long inside the search textbox of Here We Go(this thing shows marker on the position) and get the url of that search and store it in the string ?
I am also using Place Api for getting nearby place depending on categories, but i am not getting phone number value in response with other values.As i search for it on the developer website it says we need special access but i have Here Premium SDK so can you guys help with this i tried contacting Here but no response.
Any help would be Appreciated. Thanks in Advance.
We hope both case 1 & 2 of your question drills down to how to append the search term (in your case lat,long) to the here we go map to get a marker on the map. If this is right, then all you need is to call the here url with the search lat,long like this: wego.here.com/search/51.52395,-0.15818

Android Square Register API: ILLEGAL_LOCATION_ID

I am integrating Square into my Android app.
I am struggling with where to find the locationId to pass to the enforceBusinessLocation() method. I've set up a location in my Square dashboard but it isn't obvious where to get the locationId from.
I've tried using the location nickname (I tried both mixed case and uppercase - so, in my case, "mwe" and "MWE"), but that didn't work. It results in:
ILLEGAL_LOCATION_ID: The LOCATION_ID parameter does not match the ID
of the business location currently logged in to Square Register.
I have selected that same location when logging into the Square Register app on the device.
I understand the locationId is optional, but I would like to include it.
So where to find the locationId as required for enforceBusinessLocation()?
You can get your locations with the /v1/me/locations or /v2/locations endpoints.
https://docs.connect.squareup.com/api/connect/v2/#endpoint-listlocations
https://docs.connect.squareup.com/api/connect/v1/#get-locations
There is a much easier way to get it. Just log in and click on Accounts & Settings, click on Locations (here's a shortcut), click the location and then you can see URL of the page change. The location ID is the last part of the URL.

Android issue with Skobbler SDK for offline geocoding

I implemented Skobbler SDK in my app to navigate offline maps. I have an issue while trying to get coordinates from an address when user is offline. Even if I have installed the package relative to the city in which I am trying to navigate, when I start multi-step search it returns empty results without the possibility to understand what I am doing wrong because there is no way to manage eventual error messages. Here is my code as reported in Skobbler docs:
private void searchAtCurrentLevel(long parentId, SKSearchManager.SKListLevel level) {
// get a search manager object
SKSearchManager mgr = new SKSearchManager(this);
// get a multi-step search object
SKMultiStepSearchSettings searchSettings = new SKMultiStepSearchSettings();
// set the offline package in which to search
searchSettings.setOfflinePackageCode(code);
// set list level of the search
searchSettings.setListLevel(level);
// set maximum number of results to be received
searchSettings.setMaxSearchResultsNumber(20);
// set the id of the parent in which to search
searchSettings.setParentIndex(parentId);
// set a filter for the results
searchSettings.setSearchTerm("");
// initiate the search
mgr.multistepSearch(searchSettings);
}
where "code" is relative to the code of the city that I am into (for example GBCITY04 for London) and parentId is -1 like shown in Skobbler's Android "How To". I also tried to enter all different listLevel values but nothing changed.
In my app, I avoided to download "Maps.json" file because I have to manage only 2 cities, Milan and London, so i download only Milan and London's maps having relative city codes (ITCITY01 and GBCITY04). Can this be the cause of my problems?
Thanks in advance for the support.

Android: Google Place API delivers ZERO RESULTS

I'm going nuts on this one. I used Places Autocomplete before and that worked like a charm. e.g: https://maps.googleapis.com/maps/api/place/autocomplete/json?sensor=false&location=53.6020,53.6020&input=mcdonalds&key=
Now I'm trying to use the search in a range of 1000m of the users location, but I keep getting ZERO RESULTS. Can someone see, what I can't?
https://maps.googleapis.com/maps/api/place/search/json?location=53.6020,53.6020&radius=1000&keyword=mcdonalds&sensor=false&key=
Thanx in advice!
You have to specify a type of search in your URL (i.e. /nearbysearch/, /textsearch/, etc)
try this:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=53.6020,53.6020&radius=1000&keyword=mcdonalds&sensor=false&key=
Also, don't forget to append your API key to the URL :)
Lastly, for debugging purposes, try to use a different latitude,longitude coordinate and see if that works (i.e. use the lat/lng for New York City).

How to get all cities info over a route between two geo points

I have an question that while using Google Direction Api we can get the list of data like city's name, its Lat & Lng etc but the data provided by Api is limited to some extend. It's not able to provide all cities coming with-in that particular route.
E.g. If we try to go for Chandigarh to Delhi, then the route has a fixed result but when we try to reverse that same search i.e. Delhi to Chandigarh, some of the cities coming in previous result get vanished in api's new result, moreover, we just have a limited amount of locations/cities in result while we need the route completely detailed.
Do any of you guys faced this issue before? Is there any other way to match such requirement?
Hope I am understandable.
Thanks.
Use the below url:
https://maps.googleapis.com/maps/api/directions/json?origin="latvalue","longvalue"&destination="destnLat","destnLong"
&sensor=false&avoid=highways&mode=driving&alternatives=true
you have to set the alternatives value to true so it will result different routes available between the source and destination

Categories

Resources