Search code examples
androidcordovageolocationphonegap-build

Phonegap build with android geolocation


I'm writting an android and iphone app using phonegap 3.0.

So far I have been only compiling the apps remotely using phonegap build.

Now I'm trying to add the geolocation plugin to my app, and in iphone was easy, since I only had to modify the config.xml file.

<feature name="Geolocation">
    <param name="ios-package" value="CDVLocation" />
</feature>

So far so good, the problem was that when adding geolocation to android, the documentation indicates that I have set the following configuration:

(in app/res/xml/config.xml)
<feature name="Geolocation">
    <param name="android-package" value="org.apache.cordova.GeoBroker" />
</feature>


(in app/AndroidManifest.xml)
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />

But I don't have an AndroidManifest.xml file. I could generate the complete android app using:

cordoba platform add android

But I'm not sure if this is what I should do. Is is what I should be doing? or there is a way to add geolocation without generating the entire android project?


Solution

  • I am a bit confused because you say you are using phonegap 3.0 and you also mention phonegap-build (highest is 2.9). If you are in fact using phonegap-build, the only thing you need is in your config.xml:

    <feature name="http://api.phonegap.com/1.0/geolocation"/>