What KML fields are supported in the native Google Maps application on the iPhone? - iphone

I have been doing some research on using maps in iPhone applications and it looks like most of my needs can be met passing KML data into the built-in google maps application, but I cannot seem to set the same values (phone, home page, address) that are available when performing a built-in search in the maps application. Does anyone know if there is any way to set those values, or what fields are available?
UPDATE: With the advent of the 3.0 OS and the Map API, applications no longer need to pass control to the built-in map application, so this question is no longer relevant.

KML is not officially supported by Apple as of now. It's specified in the URL schemes documentation. Any URL in the ?q= parameter will be ignored.

There are few options available for iPhone developers planning to use Google Maps in their software. I've seen sample code and implementations of WebKit that translates gestures to Google Maps loaded inside it, but performance is dismal at best. Doing a static map without a lot of zooming or scrolling is pretty much the only performance-preserving option until a native API is available.

Take a look at Developing Virtual Earth iPhone Applications with Objective-C

Related

Show traffic like in Maps app from iphone using MKMapView

I've noticed that the maps app integrated in iOS can show the traffic, but is there a way to do that using MKMapView? or that functionality only appears in that app?.
Any help please?
The data Apple uses appears to be sourced from TomTom and others. If you can find an API that provides traffic data, you can use a MKPolyline to render the data.
As far as I know you can't show the traffic information using the MK framework.
To achieve the results you want I would offer to use the third party resources, Google Maps API for example, and use UIWebView to present a customized map. Google Maps JavaScript API v3 TrafficLayer

Can I programmatically access a smartphone's sensors through the browser and JavaScript?

Is it possible for me to programmatically access a smartphone's sensors (e.g. accelerometer, compass, etc. on an Android or iPhone device) through a browser webpage and JavaScript? I know that the W3C Devices standard can allow access to the camera.
HTML5 is likely to contain a sensor API. Until this is fully standardized, vendors provide their own APIs such as Apple does for mobile Safari.
There's no need for full blown solutions like PhoneGap or similar if it is Ok for you to restrict yourself to a specific vendor/device. If not, frameworks like PhoneGap provide you with a unified, device independent API.
You should be aware of the Performance constraints that apply to Javascript applications running inside the browser of a mobile device. Depending on your type of application and the amount of processing you intend to do on the sensor data, you are better off writing a native application
See https://developer.apple.com/library/safari/iPad/#documentation/SafariDOMAdditions/Reference/DeviceMotionEventClassRef/DeviceMotionEvent/DeviceMotionEvent.html for some reference documentation.
The answer is both "yes" and "no". Each phone manufacturer/OS combination behaves as it sees fit here - for example, the GPS on an iPhone can be accessed, but the compass not:
accessing iPhone compass with JavaScript
You can use something like PhoneGap to do this, I believe.
Check out this chapter called "Controlling the iPhone with JavaScript" from the book Building iPhone Apps with HTML, CSS, and JavaScript
This demo considers the iPhone movements on the three axis using the event.accelerationIncludingGravity object:
http://www.omiod.com/iphone/acceleration-demo.php
So far Safari on iPhone is the first to implement it, but I see Android filling this gap very soon.

How to implement google maps in my iPhone application

I am totally confused with google maps and maps of iPhone...
i have read that iPhone uses google maps.....and also spent some time on it....
But it never display the items like location pictures, balloons etc.
EDIT
THIS is photo for of browser
and following is same place for iPhone maps
second one did not show the annotation added by people.....
(this is what i was asking for ballons or other pictures which people adds to location on oogle maps)
I want to display all those in my application....
what should i do...
if you suggests implement Google maps API, then please suggest a working link...or provide some sample code if possible.....if anybody has done it...then please mail me at yogeshkumau#gmail.com
waiting for answer......
Points of Interests(location, pictures and baloons) that you are talking about can be shown in your maps, if you acquire the license for Google maps premier api. In that case you'd have to use dynamic maps by using google's web services. However if you want to implement it using MapKit framework on iOS devices, you'd have to draw your custom POIs using core graphics.
Apple has a special agreement with Google to use their maps on their platform. The internet is packed with examples of usage of MKMapView along with annotations (pins, there're no baloons on iPhone).

accessing google maps via UIWebView - illegal?

New to iPhone development. Working on first app. I'm accessing google maps via UIWebView to forward geocode an address using "http://maps.google.com/maps?q=my address". It works, although it has this quirk of requiring you to hit "Back" button and then the "Detail" button (provided by the navigation bar) to get back to the screen from whence you started. If anyone knows why it does this, I'd love to hear. My real question, however, is this a legal use of google maps? Since I intend this app for commercial use, am I violating Google's rules + regs? If it is illegal, what's my alternative? Thanks.
Using Google Maps in a UIWebView is permitted by Google's Terms of Service.
In iOS 6 Apple switched the maps backend from Google to its own, and even though it is technically possible to use Google's map tiles in MKMapView, that is not permitted by Google's ToS.
Here's the clarification directly from #GoogleMapsAPI on Oct 3 '12:
Q: There are some iOS apps using GMaps tiles, so I want to know they are legal or not legal with licence violation.
A: Direct tile access is not permitted. Using JavaScript API in a web view is permitted.
I'm not an iPhone developer and the last thing i know is objective-c, but have you considered using the Google Maps API?
http://code.google.com/apis/maps/faq.html#mapsformobile
It says
The Google Maps JavaScript API v3 has been developed to cater to mobile devices, and is suitable for browser applications targetted at both the desktop and devices that include a web browser with a full JavaScript implementation, such as the Apple iPhone.
For browser based applications targetted at devices not suitable for using the JavaScript API, the Static Maps API delivers map images in GIF, JPG, and PNG formats, including markers and polylines. Note that it is not permitted to use the Static Maps API outside of browser based applications.
I'd surely try it, at least the Static Maps API cos it's extremely easy to use, and the overall agreement allows commercial use.
You might be better off using the Bing API, it's designed to be used client and server side. So you should be able to make a web service request without using UIWebView.
Rich

Force MapKit use cached map tiles only/disable network programmatically

We have stumbled upon such a problem.
We are developing an application for travelling. To make sure the user doesn't spend much money on roaming charges in our app we decided to implement a settings option for user to view cached maps only. So we let the user decide whether he wants to load the maps from internet or he wants to save money and view cached maps (stored in Library/Caches/MapTiles/MapTiles.sqlitedb).
We can't find a way to implement this. Is there any way to disable network programmatically in this case? Or force MapKit use cached tiles only? We thought about changing APN programmatically for this option to force MapKit go offline. Is it possible to change APN programmatically?
Thank you!
iPhone SDK apps do not have access to the network adapter settings, and I know of nothing in the MapKit API that gives you control over its Internet usage. Your best option in this case is probably to present an alert suggesting that the user enable Airplane Mode or turn off data roaming.
use openstreetmap
think the commercial side of it Cloud-made allows offline maps
http://developers.cloudmade.com/projects/show/iphone-sdk
Libraries that help iPhone developers use OSM maps
route-me is an open-source library used in a number of iPhone applications to display OSM maps.
The CloudMade iPhone Maps Library is an open-source library that provides high-level access to CloudMade's OSM-based map tiles with different sizes and different styles.
John McKerrell has ported the routing algorithm from gosmore to run on the iPhone and has successfully generated basic routes. More complicated routes crash the iPhone at the moment
There are some ways. One is to use your own tile overlay and implement the caching algorithm either in URLForTilePath: or in loadTileAtPath:result:
It works very well with open domain and some private ones. Does not cache the standard Apple Maps.
Another way that will be able to cache everything is subclass NSURLProtocol. There are some tutorials and probably you may detect when is a map image and act accordingly
the google map app does the cache feature ... MapKit seem no , I think Apple will add this feature in next version SDK ...