Software Archive
Read-only legacy content
17061 討論

Cordova API vs Intel XDK API

Михаил_К_
初學者
1,183 檢視

What different in Cordova API and Intel XDK API?

I want use geolocation, what do i should use: geolocation.getCurrentPosition or intel.xdk.geolocation.getCurrentPosition?

0 積分
9 回應
John_H_Intel2
員工
1,183 檢視

You should stick to the cordova api's. The intel.xdk api are older and not as maintained as the cordova api's.

Михаил_К_
初學者
1,183 檢視

Thanks for answer!

I tried to change intel.xdk.geolocation.getCurrentPosition to navigator.geolocation.getCurrentPosition and Intel XDK Emulator GeoLocation not work more:

PositionError {message: "Timeout expired", code: 3, PERMISSION_DENIED: 1, POSITION_UNAVAILABLE: 2, TIMEOUT: 3}

Can I fix this?

John_H_Intel2
員工
1,183 檢視

Did you update which plugins you are using in the project settings? You can do so under the Projects tab in the xdk. 

Михаил_К_
初學者
1,183 檢視

I open Plugins section in Projects tab. Standart Cordova Plugins - Geolocation 0.3.11 selected.Снимок экрана от 2015-06-03 10:32:50.png

John_H_Intel2
員工
1,183 檢視

See the demo that we provide on geolocation. Start a new project, Samples and Demos, HTML5 + Cordova, Geolocation.

Михаил_К_
初學者
1,183 檢視

I tried and got the same:

 

Снимок экрана от 2015-06-03 17:28:05.png

John_H_Intel2
員工
1,183 檢視

Works for me :) Are you connected to the internet? 

Does it work on device for you?

Could your firewall be blocking the XDK from connecting to the internet?

khin_sin_c_
初學者
1,183 檢視

try to run app on the actual device instead of in the emulator. i can get the location once deploy to actual device.

PaulF_IntelCorp
1,183 檢視

The Emulate tab and the geo API is kind of tricky if you set it to use an Android device. It is easier to play with if you tell the Emulate tab to use an iOS device. It has to do with the way the Emulate tab interprets the geo JS files for Android. It will work better on a real device.

回覆