Software Archive
Read-only legacy content

Intel XDK Geolocation Api not working for android version <= 4.3

Bhavya_A_
Beginner
561 Views

 

The Geolocation api plugin(core plugin of intel xdk) is not working in the android versions <=4.3.

I am not able to find latitude and longitude coordinate position of device using this plugin in android <=4.3 version .

Please help me to resolve this issue or tell me another way to find latitude and longitude position in android <=4.3 version.

0 Kudos
12 Replies
Nick_F_2
New Contributor III
561 Views

Hi We need more info, can you post a sample of your code calling the GeoLocation.

Try setting enableHighAccuracy: true if you haven't already.

0 Kudos
Ad
New Contributor III
561 Views

I'm using Android 4.1.1 and works perfect!
using this code:

if (navigator !== null) {
    if (navigator.geolocation) {
        var options = {
                enableHighAccuracy: true,
                 timeout: 15000,
                 maximumAge: 0
         };
         try {
                 navigator.geolocation.getCurrentPosition(function (position) {
                        // do something with: position.coords.latitude & position.coords.longitude
                  }, function () {
                        // position not found
                  }, options);
          } catch (e) {
              // ooops
       }
    } 
} 

 

0 Kudos
Bhavya_A_
Beginner
561 Views

Hey nick ,

Thank you for giving time for my issue , but the the solution you told me doesn't work me .

0 Kudos
Bhavya_A_
Beginner
561 Views

Hey Ad ,

Thank you for giving time for my issue , i have tried your solution but not working for me am i doing something wrong?

I am using

a) cordova 4.1.2 cli

b) using a crosswalk build with target api level 18

c) using Geolocation core plugin

It work great on emulater but not working on android 4.3 and below but working fine on android 4.4 and above

Thanks

 

 

 

0 Kudos
Nick_F_2
New Contributor III
561 Views

Hi

I have been able to replicate the issue on Android 4.2.2, No Geolocation data is returned. Android 4.4.4 is fine and returns geolocation details. 

0 Kudos
Elroy_A_Intel
Employee
561 Views

I recommend using Apache Cordova Geolocation plugin as we have deprecated various Intel XDK api such as the Geolocation plugin. For more information visit https://software.intel.com/en-us/xdk/docs/intel-xdk-api-cordova-plugin-methods-properties-events.

Also, I recommend building a Crosswalk-Android application as this will provide support for Geolocation support for all Android 4+ devices. This build target provides a Chromium web runtime that makes the latest HTML5 features to any Android 4+ devices instead of relying on the native web runtime which can vary in their HTML5 feature support.

The Geolocation plugin is based on the W3C Geolocation API Specification, and only executes on devices that don't already provide an implementation. For more information visit https://github.com/apache/cordova-plugin-geolocation.

0 Kudos
Bhavya_A_
Beginner
561 Views

Hi Elroy Ashtian, Jr.

Thank you so much for giving me your time on my issue , But sir this plugin is not getting installed in intel xdk am i doing something wrong please help me . I am getting this error:Error: Plugin Geolocation failed to install.

 

0 Kudos
Nick_F_2
New Contributor III
561 Views

Further to my last comment.

I am using the Cordova plugin and building with Crosswalk, I cannot get a GPS location on Android 4.2.2, the same code on 4.4.4 works fine.

0 Kudos
Bhavya_A_
Beginner
561 Views

hey Nick ,

But it  is not working on ma android 4.3 device am i doing something wrong .

The same solution is working for android devices 4.4 and above

Thanks

0 Kudos
Ad
New Contributor III
561 Views

Nick F. wrote:

Further to my last comment.

I am using the Cordova plugin and building with Crosswalk, I cannot get a GPS location on Android 4.2.2, the same code on 4.4.4 works fine.

I have made a small test project, using my GPS code above, with the following settings:
Plugins: cordova-plugin-geolocation 1.0.1
Build:    Android Crosswalk
             Cordova CLI: 5.1.1
             Min Android API: 14
             Target Android API: 19
             Crosswalk runtime: embedded 15

After compiling as Android Crosswalk,
and installed the ARM code on my ODYS Prime tablet (Android version 4.2.2),
I'm getting GPS coordinates!


It doesn't solve your problem, but it maybe helps you one step further....

0 Kudos
PaulF_IntelCorp
Employee
561 Views

Bhavya, try the "hello Cordova" app, it contains an extensive Geo test that should help you figure out what is working and what is not. Also, check to be sure that geo is enabled on the test device.

0 Kudos
Bhavya_A_
Beginner
561 Views

@Ad, @Paul, @ Nick ,@Elroy Ashtian Jr.

Thank you every one for helping me on this issue . @Ad your solution worked for me

Thanks ,

Bhavya Anand

0 Kudos
Reply