Two phones near by

2 posts, 0 answers
  1. Gorazd
    Gorazd avatar
    1 posts
    Member since:
    Aug 2013

    Posted 15 Aug 2013 Link to this post

    Hi - I'm working on an app that has to know if two phones are close enough (50 m is max distance). My first try was with GPS but there is a problem: it is not accurate. Maybe the problem is in ion or icenium or ... i don't know, because when I use google maps on my phone my location is shown accurate, but I get 200 m mistake if I use ion. So my first question is - is the GPS "locator" different  or I don't know - i'm losing my mind ... Maybe to little available satellites?? And google maps use some kind off algorithm ...
    I use in Icenium:
    var options = { maximumAge: 0, timeout: 20000, enableHighAccuracy: true };
    navigator.geolocation.getCurrentPosition(onGpsSuccess, onGpsError, options);

    Ok the second try was to use Bluetooth. With bluetooth I would discover a device and if a device is in range I get the wanted result (I don't need to connect with them). Is this possible? And another question is - how long does bluetooth need to discover other devices?

    Thank you for your help.
  2. Deyan Varchev
    Deyan Varchev avatar
    150 posts

    Posted 19 Aug 2013 Link to this post

    Hi Gorazd,

     This is a great question. The behavior you are observing is related to what devices your app is running. The general rule is that it should run on any device no matter what sensors it supports. By default on iOS the OS decides whether to use the GPS hardware (if available) or other means (like WiFi).
     If you want to force your app to always use GPS you need to change the configuration to explicitly state that.
    There is an important implication with this however. Your application will only be available on iOS devices that have GPS sensors (devices like iPod Touches will not be able to install it).

    If you choose to do this, you can do it by editing your info.plist file (here are more details on this) and append the following xml elements right before the closing dict node.:

    So your info.plist file should end like this:


    Important note: You cannot test your configuration changes in Icenium Ion - you need to build and deploy you app with a developer provision.

    As for your second option - using Bluetooth. icenium does not expose bluetooth functionality out of the box. You will need to use a custom plugin for that - i.e. but still you may have some issues with this approach as well.

     I hope this will help you solve your problem.

    Deyan Varchev

    Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
Back to Top