Detect if You are Running in Simulator

8 posts, 0 answers
  1. Randy
    Randy avatar
    72 posts
    Member since:
    Jan 2009

    Posted 03 Jun 2013 Link to this post

    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
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 04 Jun 2013 Link to this post

    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.
  3. Randy
    Randy avatar
    72 posts
    Member since:
    Jan 2009

    Posted 04 Jun 2013 Link to this post

    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
  4. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 04 Jun 2013 Link to this post

    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.
  5. Tim
    Tim avatar
    6 posts
    Member since:
    Aug 2013

    Posted 26 Jan 2015 Link to this post

    Hey,

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

    Cheers
    Tim
  6. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 26 Jan 2015 Link to this post

    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.

     
  7. Tim
    Tim avatar
    6 posts
    Member since:
    Aug 2013

    Posted 27 Jan 2015 in reply to Tina Stancheva Link to this post

    Super cool,

    thank you Tina!
  8. tongclub60
    tongclub60 avatar
    1 posts
    Member since:
    Mar 2015

    Posted 11 Mar 2015 Link to this post

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