We are working on a project with MobileFirst Platform 7.1, we are using mobilefirst-cli with cordova to create a project : mfp cordova create
.
After we add android platform with : mfp cordova platform add android
Then we add this plugin : https://github.com/mauron85/cordova-plugin-background-geolocation
With this command : mfp cordova plugin add cordova-plugin-mauron85-background-geolocation
We have this message :
Adding "cordova-plugin-mauron85-background-geolocation"
Plugin "cordova-plugin-mauron85-background-geolocation" added successfully
But when I build my project, my plugins is not added in \platforms\android\assets\www\plugins
We used this plugin in a P.O.C. without mobilefirst and it worked.
If someone know this issue? Thank you in advance.
The plugin you are trying to add uses framework tags which are available in Cordova-Android 4.x and above. The version of Cordova-Android in MobileFirst Platform Foundation 7.1 is 3.6.4, so will not be able to parse that tag.
To get this plugin working, you'll need to install the iFix IF20160224-2343 or later. This iFix has changes that will allow you to import your project into Android Studio.
After installing this iFix, you'll want to clone the plugin and modify its plugin.xml. Remove all of the framework tags and the meta-data tag about google_play_services_version. Next, add this plugin to your project using:
mfp cordova plugin add <path_to_plugin>
The plugin should be added fine at this point.
Now to add Google Play Services and support v4 back into your app, you will need to import your project into Android Studio. Do so by importing the build.gradle file in your project's platform/android folder. Add the Google Play Services and support v4 dependencies to build.gradle file. Example of Google Play Services dependency
The version originally in your plugin.xml was a '+' meaning pull the latest (which currently is 8.4.0). 8.4.0 is incompatible with your compileSDKVersion 19, so we would suggest using an older version of Google Play Services, otherwise you would have to use a later SDK version. Keep in mind that SDK 19 is the fully supported version for this Cordova version, so we recommend changing the version of Google Play Services over changing the SDK version.
Run the app from Android Studio. This will build with Gradle instead of Ant, which the CLI uses, and pull down all of the dependencies correctly.