Page 1 of 1
How to tell the difference between iPad and iPad2?
Posted: Thu Oct 27, 2011 8:21 am
by hoburne
Hi,
Sorry for the silly question but I couldnt find the answer anywhere.
How would my app know if its being used on an iPad or iPad2 - more specifically if the device has a camera?
I would have thought there would be something similar to an environment variable like you would expect in PHP (for example)?
I simply need to check if a camera exists and disable some functions if necessary.
Thank-you!
Re: How to tell the difference between iPad and iPad2?
Posted: Thu Oct 27, 2011 5:42 pm
by SteveHanlan
From LiveCode 5.0 iOS release notes
Querying camera capabilities
To find out the capabilities of the current devices camera(s), use the following function: iphoneCameraFeatures( [ camera ] )
The camera parameter is a string containing either "rear" or "front". In this case, the capabilities of that camera are returned. These take the form of a comma-delimited list of one or more of the following:
• photo – the camera is capable of taking photos
• video – the camera is capable of recording videos
• flash – the camera has a flash that can be turned on or off
If the returned string is empty it means the device does not have that type of camera.
If no camera parameter is specified (or is empty), then a comma-delimited list of one or more of the following is returned:
• front photo – the front camera can take photos
• front video – the front camera can record video
• front flash – the front camera has a flash
• rear photo – the rear camera can take photos
• rear video – the rear camera can record video
• rear flash – the rear camera has a flash
If the returned string is empty it means the device has no cameras.
Cheers
Steve
Re: How to tell the difference between iPad and iPad2?
Posted: Fri Oct 28, 2011 8:19 am
by hoburne
Thanks Steve.