In one of my watchKit application I need to show the route between two locations on the WKInterfaceMap. I searched for different links including Apple Developer Link. But I didn't find any way to display the route on the WKInterfaceMap.
Then, how the Uber watchKit App displays the route on the WKInterfaceMap? Is it the Map or an WKInterfaceImage/UIImage?
Below is the screenshot for the Uber App.
My guess is that they are be finding the route on the iOS app then passing it on to the watch in the form of a WKInerfaceImage
WKInterfacemap is non interactive map. If you just want to give the user driving directions, use below code where you can specify destination lat and long and open Map application on iWatch. It will launch Map application on iPhone, from there WatchOS will receive routing information.
let coordinate = CLLocationCoordinate2DMake( <ENTER DESTINATON LATITUDE>, <ENTER DESTINATON LONGITUDE>)
let mapItem = MKMapItem(placemark: MKPlacemark(coordinate: coordinate, add ressDictionary:nil))
mapItem.name = <DESTINATION NAME>
mapItem.openInMaps(launchOptions: [MKLaunchOptionsDirectionsModeKey : MKLaunchOptionsDirectionsModeDriving])
Related
I am using Here map to plot routes in my app. Now I have noticed that different routes were plotted in iOS and web app (javascript) for certain routes despite being given the same parameters. I'm giving the same starting location, destination, and intermediate waypoints.
iOS code
let routingMode = NMARoutingMode.init(
routingType: NMARoutingType.fastest,
transportMode: NMATransportMode.truck,
routingOptions: NMARoutingOption.avoidBoatFerry
)
routingMode.speedProfile = .fast
routingMode.truckType = .truck
return routingMode
JavaScript code
routeRequestParams = {
mode: 'fastest;truck;boatFerry:-1',
speedprofile: 'fast',
truckType: 'truck',
representation: 'navigation',
routeattributes : 'waypoints,summary,shape,legs',
maneuverattributes: 'direction,action',
waypoint0: 'lat1,long1', // Brandenburg Gate
waypoint1: 'lat2,long2' // Friedrichstraße Railway Station
};
Any idea why this is happening?
In general this is expected behavior because of the difference in underlying Map data used by HERE Mobile SDK and HERE Routing API (which is used by Javascript API). If the use case is something like transferring a route in a Back office application (using Javascript API) to the Mobile device, you would follow the approach described in the thread: Backend Calculated Route,Here-API to just show Guidance and route on Map
I am developing an app for Android TV is it possible to know, on which TV my app is running or what action is performed on it?
Thank you.
To review your app's supported devices:
Sign in to your Play Console.
Select an app.
On the left menu, click
Release management > Device catalog. If you haven't already, review
and accept the Terms of Service.
Select the All, Supported, or
Excluded tabs. If you want to download a list of devices as a CSV
file, near the right side of the page, click Download device list.
For more infos:
https://support.google.com/googleplay/android-developer/answer/7353455
To track action performed on your app, you can use Fabric's Answers plug in.
Here is a sample code you'll need to add in your code to track events in Answers:
public void onKeyMetric() {
// TODO: Use your own string attributes to track common values over time
// TODO: Use your own number attributes to track median value over time
Answers.getInstance().logCustom(new CustomEvent("Video Played")
.putCustomAttribute("Category", "Comedy")
.putCustomAttribute("Length", 350));
}
For more infos:
https://fabric.io/kits/android/answers
Today my app got reject i don't understand problem.
Rejected because:
10.6 - Apple and our customers place a high value on simple, refined, creative, well thought through interfaces. They take more work but are worth it. Apple sets a high bar. If your user interface is complex or less than very good, it may be rejected
With comment:
10.6 Details
Your app’s location feature is not integrated with the built-in mapping functionality, which limits users to a third party Maps application.
Next Steps
Please revise your app to give users the option to launch the native Apple Maps application.
What i need to do? I should add Apple Maps in my app and give the user a choice?
Why they do not require such other applications.
A few words about my application: It’s social network that displays the users on map
You can see main screen with Google Maps
they say:
"to give users the option to launch the native Apple Maps..."
what you can do is show an action sheet with 3 options:
google maps
waze
maps
the user will choose ...
one of the option shoukd be maps of Apple
implement the maps option as follow:
let regionDistance:CLLocationDistance = 100
let coordinates = CLLocationCoordinate2DMake(lat, lon)
let regionSpan = MKCoordinateRegionMakeWithDistance(coordinates, regionDistance, regionDistance)
let options = [
MKLaunchOptionsMapCenterKey: NSValue(mkCoordinate: regionSpan.center),
MKLaunchOptionsMapSpanKey: NSValue(mkCoordinateSpan: regionSpan.span),
MKLaunchOptionsDirectionsModeKey: motType = MKLaunchOptionsDirectionsModeDriving
] as [String : Any]
let mapItem = MKMapItem(placemark: MKPlacemark(coordinate: coordinates, addressDictionary: nil))
mapItem.name = placeName
mapItem.openInMaps(launchOptions: options)
Inside iTunes Connect, I simply questioned the rejection, asking them why this was required, and stated that I have business logic related to Google Maps. After two days the app got accepted.
I have to write a script for Google Maps V3 which will do the following:
Place a marker on a map based on a set of coordinates and possbibly change the address after the page has been loaded
Allow the user the drag the mark to replace it elsewhere
Collect the new coordinates once the marker has been moved.
The first part is basic enough and should be fine, changing the address after the page is loaded should only be a matter of calling back the same function?
I am not sure where to start on the draggable marker and collecting hew coordinates.
Would anyone know of scripts / API's or where in the doc should I start?
Have you checked the Google Maps Javascript API V3 Reference to see whether the google.maps.Marker class has :
a draggable option
an dragend event
a getPosition method
Hint: The answer might just be "yes" to all three, and you don't need much else to solve your problem.
I am trying to create a Store Locator with the Google API, very similar to the one in the Google examples here:
http://storelocator.googlecode.com/git/examples/panel.html
However I've hit a wall trying to get the Store Locator API to get the user's position through Geolocation, so when I click on Get Direction in the infowindow I get directions to the user position; instead of having to type my address in the: Where are you? Panel box.
In the documentation what I have seen is that geolocation is a boolean in the View Option that is set to True by default. But this does not solve my problem.
Does anyone have any idea on how to do this?
seems that the googlecode page you said is no longer exist. So I can't give any further insight about what you want to make.
However, by your description, Luckily I made similar site few months ago. It is on Grocery Store Near Me .
The concept of Geolocation is an HTML5 (actually W3C) Geolocation API which is now already embed in most modern browser. It is an API which you can obtain user's location (latitude, longitude, altitude, and accuracy).
you can call it with simply
navigator.geolocation.getCurrentPosition(success, error, geo_options);
Success and error is a callback function in which you can define.
In my case, the function looks like these
function success(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
// use the lat and long to call function to fetch an API through AJAX
fetchStoreData(latitude, longitude);
}
In the Store Locator schema (like mine in Grocery Store Near Me), Geolocation is used to obtains user lat and long. The lat and long, then send to server via AJAX to get data about nearby store location.
The server serve an API in which accept lat and long as parameter, then fetch the store data (either using database, or other external API like foursquare), then you can display it either on list, or on a maps.