How to tell the difference between iPad and iPad2?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
hoburne
Posts: 40
Joined: Tue Oct 04, 2011 11:13 am

How to tell the difference between iPad and iPad2?

Post by hoburne » Thu Oct 27, 2011 8:21 am

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!

SteveHanlan
Posts: 80
Joined: Fri Jul 09, 2010 6:28 pm

Re: How to tell the difference between iPad and iPad2?

Post by SteveHanlan » Thu Oct 27, 2011 5:42 pm

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

hoburne
Posts: 40
Joined: Tue Oct 04, 2011 11:13 am

Re: How to tell the difference between iPad and iPad2?

Post by hoburne » Fri Oct 28, 2011 8:19 am

Thanks Steve.

Post Reply