Detect if device is a Phone or not

Is there a way to detect if the device is a phone? i.e., I have a function that simply makes a phone call, and I want to make it disabled if the device is a tablet or iPod. Any ideas?

Is there a function with the system.getInfo that can detect it? [import]uid: 134946 topic_id: 28042 reply_id: 328042[/import]

Hey - yes - I believe “model” should work fine.

See here; http://developer.anscamobile.com/reference/index/systemgetinfo

Peach :slight_smile: [import]uid: 52491 topic_id: 28042 reply_id: 113482[/import]

Peach Pellen is EVERYWHERE!

Ok, if I use model, I could specify something like, (not actual code)

if ==iPad then
NoCall()

if==iPhone then
Call()

if==GalaxyTab then
NoCall()

if==Droid then
Call()

If I did this, i’d have to list off every device and that’s not really practical. Is there anything that just returns “tablet” and “phone”. Or any code specifically that tests to see if the device can make phone calls?

Thanks. [import]uid: 134946 topic_id: 28042 reply_id: 113485[/import]

My code is simple to make the phone call.

system.openURL(“tel:555-555-5555”)

In the simulator/terminal i get this expected error:
WARNING: url( tel:555-555-5555 ) is not supported by the simulator

Is there any way in the app to determine if that error comes up, to simply pull up a pop-up notification on the actual device? [import]uid: 134946 topic_id: 28042 reply_id: 113490[/import]

Try this?

http://docs.coronalabs.com/api/library/network/setStatusListener.html
[import]uid: 6084 topic_id: 28042 reply_id: 113492[/import]

I was going to suggest setStatusListener, but it’s possible for 3G/4G enabled tablets to return true for cellular communications, yet they are not a phone.

[import]uid: 19626 topic_id: 28042 reply_id: 113512[/import]

That’s a good point Rob. I forgot that I’ve seen some tablets actually make phone calls. So, i’ll just leave it be I think, and if it doesn’t make a phone call, hopefully the tablet users are smart enough to know that they simply can’t make a phone call on it!

And anyone reading the forum, to make a call on and android device, make sure to enable permissions in build.settings file

[code]
settings =
{
androidPermissions =
{
“android.permission.CALL_PHONE”

}, [import]uid: 134946 topic_id: 28042 reply_id: 113516[/import]

I can’t speak for the Android market, but the iPad has no phone app, and when you sign up for the 3G/4G data plan, you do not get a phone number. I know you can use things like Skype and such to make calls from it, but that’s not the same as it being a phone.

[import]uid: 19626 topic_id: 28042 reply_id: 113535[/import]

Hey, sorry, for some reason I assumed this was iOS only which was absurd.

Your final solution looks good!

Peach :slight_smile:

PS - It’s true, I’m everywhere, all the time :wink: [import]uid: 52491 topic_id: 28042 reply_id: 113611[/import]

Old thread but this is how I check if a device is a phone or not without setting any UIRequiredDeviceCapabilities to limit the app from installs.

local device = system.getInfo("model") local architectureInfo = system.getInfo("architectureInfo")   if device == "iPhone" and (string.sub(architectureInfo, 1,6)) == "iPhone" then print("THIS IS A PHONE!!!") end

Old thread but this is how I check if a device is a phone or not without setting any UIRequiredDeviceCapabilities to limit the app from installs.

local device = system.getInfo("model") local architectureInfo = system.getInfo("architectureInfo")   if device == "iPhone" and (string.sub(architectureInfo, 1,6)) == "iPhone" then print("THIS IS A PHONE!!!") end