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

Two phones near by

1 Answer 33 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.
Gorazd
Top achievements
Rank 1
Gorazd asked on 15 Aug 2013, 07:03 PM
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.

1 Answer, 1 is accepted

Sort by
0
Deyan Varchev
Telerik team
answered on 19 Aug 2013, 05:57 PM
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.:

<key>UIRequiredDeviceCapabilities</key>
<array>
  <string>gps</string>
</array>
So your info.plist file should end like this:

        <key>UIRequiredDeviceCapabilities</key>
        <array>
            <string>gps</string>
        </array>
    </dict>
</plist>

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. https://github.com/don/BluetoothSerial but still you may have some issues with this approach as well.

 I hope this will help you solve your problem.

Regards,
Deyan Varchev
Telerik

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.
Tags
General Discussion
Asked by
Gorazd
Top achievements
Rank 1
Answers by
Deyan Varchev
Telerik team
Share this question
or