Android Square Register API: ILLEGAL_LOCATION_ID - android

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.

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 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.

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

How to get the nearest city from google place api (android) based on a given latitude and longitude

I am getting a latitude and longitude from GPS and want to search the nearest city from my current location.
Currently I'm sending a request to Google Places with types like "neighborhood|locality", but this does not return any nearest city. Even if I only specify "neighborhood" or "locality" by themselves, I still get no results. However if I use a type like "bar" then it returns a list of bars.
I'm using the types listed here:
https://developers.google.com/places/documentation/supported_types
Can anybody tell me what Place Type I should use to get the nearest city or places, or how I can otherwise get the nearest city?
Are you getting back a results array with nothing in it, or simply getting nothing back? The docs say you'll get a results array "even if the service returns no results". Is it possible that the city you're searching contains bars but does not contain anything classified as a "neighborhood" or a "locality"?
This question says
you can restrict the results that will come back in the Autocomplete
to addresses by setting types to 'geocode' ... you can restrict the
results that come back in the Autocomplete to cities by setting types
to 'cities'
If you're just trying to get the city name, rather than searching for something inside the city, perhaps you want to use one of those options?

Why is the `sll` query parameter for a Maps URL being (sort of) ignored?

According to various references, Google Maps has a query param called sll which does the following:
Latitude,longitude of the point from which the business search
should be performed. You could use this to perform an off-centre
busness search. Google use it so "link to this page" can record a map
that has had the centre moved after performing a business search. When
requesting a route
map.getBounds().getSouthWest().toUrlValue() returns the
same value maps.google.com uses.
So, for instance, if (43.464258, -80.52041) happens to be in Waterloo, Ontario, and (42.24370, -82.98320) happens to be in Windsor, Ontario (many hundreds of kilometers away), then my interpretation of the above documentation would be that the following query:
https://maps.google.ca/maps?saddr=43.464258,-80.52041&daddr=mcdonalds&sll=42.24370,-82.98320
will do a search for "Mcdonalds" from Waterloo, to some McDonald's in Windsor.
Unfortunately, that's not what happens (click for yourself to see!). It ends up doing a search from the saddr point, to the nearest McDonald's to that point. The value of sll doesn't factor into it at all.
But here's where it gets weird! If I omit the sll parameter entirely, then Maps does something completely unexpected: it picks some random McDonald's in Toronto (a city that is many kilometers away from either Waterloo or Windsor). I need to add some sll parameter (for any value) to make Maps return a result in Waterloo (even though what I'm asking for is a result in Windsor).
Am I misinterpreting all the various sources of documentation about this parameter? Is this a bug on Maps' end? And, most importantly, is there any working way to do what I'm trying to do, even if it doesn't involve the sll parameter at all?
I can get it to work with a simple query :
from:43.464258,-80.52041 to:mcdonalds near 42.24370,-82.98320
Which gives the expected result. It won't work without near which is a keyword.
You can also search from:43.464258,-80.52041 to:mcdonalds, Windsor if you have the city name.
About the sll (and sspn) parameters, it doesn't work for directions AFAIK. It only works with searches for a single location.

Categories

Resources