This is a migrated thread and some comments may be shown as answers.

Detect if You are Running in Simulator

7 Answers 240 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Randy
Top achievements
Rank 1
Randy asked on 03 Jun 2013, 04:48 PM
First off this is my first mobile app and I am 90% there after 3 weeks. Still have some rough patches to finish off, but I wouldn't have been anywhere near done without Icenium. And that is using Geolocation, file downloading  webservices and some minor custom  changes for iOS vs Android. Thanks

Is there a way to tell if you are running in the Simulator or not?

My app does some things with file system and has an exit button, both of these throw an error if selected in the simulator. I would like them to fail silently or perhaps with an alert, but not crash.

Also is it possible to tell if you are installed from the store or from ION or directly on Android? I don't know if what Android does is part of ION or if that is iOS only.

Thanks
Randy

7 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 04 Jun 2013, 11:32 AM
Hello Randy,

Thank you for the kind words about Icenium, we always strive to deliver tools that ease developers, so your feedback gives us the a feeling of accomplishment.

About your inquiry, you can get the device's Universally Unique Identifier (UUID) of our simulator for both Android and iOS which are hardcoded and make a check whether they match. If the UUID differs, then clearly you're running on real device.

ION is iOS specific, as the Apple platform does not allow you to install and run apps that are not signed. ION is only a test utility (a container for your app), and is not included when you build your app for deployment. For more information, review the following help articles:

Regards,
Steve
Telerik

Don't miss the Icenium May Release Keynote - sign up now!
Share feedback and vote for features on our Feedback Portal.
0
Randy
Top achievements
Rank 1
answered on 04 Jun 2013, 01:46 PM
Thanks for the response. I figured there was something simple.

Is there any tips & tricks blog or post that would have that type of information?

Thanks
Randy
0
Steve
Telerik team
answered on 04 Jun 2013, 01:51 PM
Hello Randy,

You can subscribe to our Icenium team blog, where we expand the knowledge already available in our documentation and also share various tips & tricks. The simulator vs. device topic has not been covered yet.

Regards,
Steve
Telerik

Don't miss the Icenium May Release Keynote - sign up now!
Share feedback and vote for features on our Feedback Portal.
0
Tim
Top achievements
Rank 1
answered on 26 Jan 2015, 02:55 PM
Hey,

is there somewhere a list with the all UUIDs of the simulator devices?

Cheers
Tim
0
Tina Stancheva
Telerik team
answered on 26 Jan 2015, 03:02 PM
Hello Tim,

If you are looking for a way to tell if you are running the app within the device simulator, then you no longer need to match the device UUIDs. Instead you can check the value of the window.navigator.simulator object. If it is false, then you are running the app outside the device simulator:
if (window.navigator.simulator === true){
//running in the simulator
}
else{
//running on a device
}
Let me know if this helps and if you have more questions.

Regards,
Tina Stancheva
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Tim
Top achievements
Rank 1
answered on 27 Jan 2015, 10:34 AM
Super cool,

thank you Tina!
0
tongclub60
Top achievements
Rank 1
answered on 12 Mar 2015, 04:19 AM
is there somewhere a list with the all UUIDs of the simulator devices?
Tags
General Discussion
Asked by
Randy
Top achievements
Rank 1
Answers by
Steve
Telerik team
Randy
Top achievements
Rank 1
Tim
Top achievements
Rank 1
Tina Stancheva
Telerik team
tongclub60
Top achievements
Rank 1
Share this question
or