Is there any way for a web application to access the location data of an iPhone without the installation of an additional iPhone client app?
If not, the next best thing would be if any can recommend an existing native app, preferably free to the end user and as lightweight as possible, that does expose this information to Mobile Safari.
Yes, in iPhone OS 3.0.
You can do that using the HTML5 Geolocation API.
I don't think this is possible. MobileSafari does not expose this information.
There is not. At the very least you will have to implement your own UIWebView based application, read the location from CLLocationManager and inject it into the WebView.
A good starting point is the iPhone-google-maps-component. it...
... uses a UIWebView in the background to load the HTML/Javascript version of Google Maps, and offers a set of Objective-C methods that mimic a subset of the original Javascript methods for controlling the map. It currently supports setting the center location, and zooming & panning using the touch interface
For jailbroken phones Locatable is exactly what you describe, it is available on cydia and very simple to integrate server-side.
PhoneGap takes an interesting approach, providing a native wrapper that allows Javascript access to hardware features. It's not exactly the answer to my question, but it is interesting in its own right, and it may end up getting the job done.
You can see a simple example of using the GeoLocation API in a web app to get your current location in the following URL: http://mrvautin.com/2010/01/06/iphone-web-application-get-current-location/
Related
Since I read Google's message that NPAPI will no longer be supported by the end of 2014, I've been looking for an alternative. The issue is that we currently use a custom made Kinect Browserplugin which we use to control the browser with JS and control Unity Web Player games with your body.
Without NPAPI support it simply won't work anymore and our work will be lost. Google gives NaCl as an alternative but this doesn't support interaction with hardware.
The main question I have is: How to use the Kinect in a webbased platform and crossbrowser?
Currently we have the "normal" Kinect and the Kinect One from the closed beta working in the browser and Unity Web Player.
Please share your thoughts on a solution.
I apologize in advance for just spewing out links without actually supplying much information, but as far as I know there are no known good alternatives.
If I was in your position, I would have a look at the chrome.usb API or possibly, depending on your use case, node-kinect.
Here's a good general resource/discussion of NPAPI alternatives: Browser Plugins in a post NPAPI world
Probably your best approach at this point is to continue using NPAPI except in Chrome, and in Chrome use native messaging. Of course, Chrome has made it as difficult as they can to install the host that you'll be connecting to, so it'll be a pain and you'll have to install the extension and the host seperately, but there you go.
I am going to develop a general application for mobile which will be used for video chatting.Therefore I need to access mobile camera and mic. Is there any functionality in javascript or jQuery by which I will be able to do that.
Note: as it is a general function, so it should be able to access the camera of any mobile device.
You can use PhoneGap functionality which uses JavaScript, it's platform independent. You can use the method navigator.device.capture.captureVideo of PhoneGap.
There is WebRTC.
But today, even if it aims at being the standard, it doesn't work on all browsers.
I don't think you'll find a standard (non flash or plugin based) and ready library enabling you to use the camera.
For a solution that actually just "works" and allows you to utilize the device's hardware properly, you'll need to code for native apps specific to the platform you're targeting. (ex. -> iOS, Android, etc.)
I'm thinking of getting into Android app development and I hear HTML5 apps are becoming more popular now. Can HTML5 + javascript be used to access media inputs on the phone, or is this only available to Java apps?
Thanks
Frameworks like Phonegap make this possible by providing a wrapper around the api of each device it supports, which can be called from your html5 application built using it. Check their site here or their api documentation for the camera api here.
In pure HTML5/JS, you can't.
But, you can use fameworks like Phonegap that provides JS libraries allowing you to access to the device capabilities such as GPS, camera, etc.
I'm starting to try and do some web based game programming for my iPhone, and other web enabled phones that my friends have, and was having a hard time finding information on accessing the accelerometer using Javascript in the browser.
With the latest release, I know I've got access to location information now but I was hoping that I could make use of the accelerometer for some of the games I plan on making.
Alternately, is this also possible with the Android phones?
In the latest iOS update (4.2) the accelorometer is now accessible from Javascript.
See: http://www.mobilexweb.com/blog/safari-ios-accelerometer-websockets-html5
iOS 4.2 provides Accelerometer & Gyroscope support through the DeviceOrientation API.
DeviceMotionEvent class
reference
DeviceOrientationEvent class
reference
Here a working javascript snippet.
If your are using iOS 4.2 or more, then you can do it: http://www.albertosarullo.com/blog/javascript-accelerometer-demo-source
jharlap is correct, however I'd be curious to know if this would work on the Palm Pre. Native development on the Pre is done using html and JavaScript, however there are special JavaScript APIs to access the phone's features that I believe only work for locally stored apps. I wonder if these are available through the browser. I doubt it, but it would be interesting.
Checkout PhoneGap project. It provides API to access the accelerometer and the GPS location from javascript.
"Regular" javascript cannot access the accelerometer info, it can access the geolocation using the W3C geolocation API supported by iPhone OS 3.0.
Yet, a project (e.g. PhoneGap) can be used to build a bridge between javascript and Objective-C capabilities to expose that functionality. This works if you want to deploy the app as a standalone application, that simply has one WebKit which loads the html content from the server.
I haven't played with their framework, but they provide templates for the iPhone and Android projects and you can work on developing your javascript game which would work almost-out-of-the-box on iPhone and Android. I cannot comment on the performance and the user experience though.
I've got a request from a customer to automatically detect the type of mobile device (not the browser, the type. ex: Moto Q, Blackjack II, etc.) and automatically select the device from a drop down with a list of supported devices.
So far I've found that the HTTP Headers (submitted by mobile IE) contain information such as
Resolution
UA-CPU (i've seen ARM from WM 2003 and x86 from WM5)
User Agent (which basically just says Windows CE)
The only thing I can think of right now is possibly using a combination of the resolution/cpu and making a "best guess"
Any thoughts?
You may want to have a look at WURFL, here: http://wurfl.sourceforge.net/.
From the site:
So... What is WURFL?
The WURFL is an XML configuration file which contains information about capabilities and features of many mobile devices.
The main scope of the file is to collect as much information as we can about all the existing mobile devices that access WAP pages so that developers will be able to build better applications and better services for the users.
What exactly does the customer mean by "supported". Surely it means that the phone in question supports the web application and it's inner functionality - wouldn't it be better then to forget device detection and simply focus on detecting those capabilities required for the app to function properly? For example, if my mobile website requires Ajax to work then instead of listing all the devices which are said to "support Ajax" I could do some simple object detection to find out for myself.
Device detection, just like browser detection is unreliable. Yes, it's possible but I wouldn't recomend it... on a project I've done we used the User Agent string to detect various devices. The indexOf javaScript method came in handy! :)
Another fast and easy solution is Apache Mobile Filter: http://www.apachemobilefilter.org