We have mobile applications on iPhone and Android (and soon to be released Blackberry). The app functionality is the same – we just support several different devices. The app communicates with a back-end web service to receive data.
Now, in the web application, is there any way to easily determine what type of device is connecting to it? Here’s what I have available:
-
serial number (or unique ID) of the device (note that in android simulator it’s always
000000000000and in iphone simulator the format is totally different from actual iphone) -
in iphone app, connections are made using
NSMutableUrlRequest / NSURLConnection, in Android connections are made usingorg.apache.http.client.HttpClient -
The server web app is written in PHP.
-
I am willing to settle for a “best-guess” approximation: if I’m right 95% of the time, it’s good enough for my purpose.
I’m not sure about any of the blackberry stuff, because that app is still not ready.
Any ideas/help are greatly appreciated. Many thanks.
You could look at the user agent that is hitting the HTTP API and sniff that. That’ll work at least 95% of the time. iOS apps will have something like
CFNetwork/xxx.xx.xin them. For Android / Blackberry just try it out and see what they are. Alternatively change your app to set the user agent yourself so you will know exactly what version of your app, etc is hitting the API.