Detect if Android Emulator or Android Deviceq

You must Login before you can answer or comment on any questions.

In my code, I have a section where I would like to do an if/else, based on whether its an android device or the emulator.

For iPhone and iPad, I can do

if(Titanium.Platform.osname=='iphone' //or ipad)
{
//do stuff
}
I can do an =='android' to detect that as well, but can I detect whether its the android EMULATOR?

1 Answer

Accepted Answer

Sure, do this:

if(Ti.Platform.model == 'google_sdk') {
    alert('This app must be installed on a device to function properly.');
}

— answered 9 months ago by Tim Poulsen
answer permalink
1 Comment
  • Thanks, I thought I saw that before, but I couldnt find it using the QA search functionality.

    — commented 9 months ago by Josh Lewis

Your Answer

Think you can help? Login to answer this question!