Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap geolocation plugin is not adding for android

Geolocation

I am trying to get geolocation details , i have added geolocation plugin using cordova command line

$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
$ cordova plugin rm org.apache.cordova.core.geolocation 

Application created using cordova commandline

The Command-Line Interface

After adding plugin through command line android plugin is missing

in the following screenshot android is missing enter image description here

Can anybody please help me ?

like image 744
NidhinRaj Avatar asked May 19 '14 11:05

NidhinRaj


3 Answers

The native code for Android Geolocation was removed, see the deprecation bug. This was because the native implementation was buggy and the native browser geolocation works fine. Since Cordova (Phonegap)'s goal is to not exist, it was only a matter of time until this was removed. You can use Geolocation just like you normally would, it just won't use the native code and instead rely on the browser version.

If you look in the plugin xml file, you will see that there is still some lines in there about Android. This is so that cordova plugin add org.apache.cordova.geolocation will correctly copy in the needed permissions to run on Android.

like image 65
MBillau Avatar answered Nov 15 '22 09:11

MBillau


Check this link : Go to Add Plugin Features

Add Plugin Features

You can use the CLI to search for plugins from this registry.

For example, searching for geolocation produces a single result that matches terms as case-insensitive : Just search for plugin in command prompt.

cordova plugin search geolocation

By firing above command you will get search result as :

org.apache.cordova.geolocation - Cordova Geolocation Plugin

Now to install this plugin you need to fire :

cordova plugin add org.apache.cordova.geolocation

You will get result as :

Fetching plugin "org.apache.cordova.geolocation" via plugin registry
Installing "org.apache.cordova.geolocation" for android

Finally, the geolocation plugin will be installed in your application_name/plugins directory.

Path will look as : D:\PhoneGap\hello\plugins\org.apache.cordova.geolocation

like image 2
Siddharth_Vyas Avatar answered Nov 15 '22 11:11

Siddharth_Vyas


Here are the steps to make you happy.It took a whole day for me to sort out this. Better you downgrade the version of geolocation plugin. Go through below steps:

a)Remove the already downloaded geolocation plugin: phonegap plugin rm org.apache.cordova.geolocation

b)Add the downgraded geolocation plugin: phonegap plugin add [email protected]

Now you will see the android folder under the plugins folder. Cheer up!!

like image 1
Ashish Kwatra Avatar answered Nov 15 '22 11:11

Ashish Kwatra