Commit c57ae948 authored by Chris Scott's avatar Chris Scott

STandardize plugin arch based upon existing cordova plugins

parent 8fa3d817
...@@ -8,16 +8,22 @@ ...@@ -8,16 +8,22 @@
<license>MIT</license> <license>MIT</license>
<keywords>phonegap,background geolocation</keywords> <keywords>phonegap,background geolocation</keywords>
<engines>
<engine name="cordova" version=">=3.0.0" />
</engines>
<!-- android --> <!-- android -->
<platform name="android"> <platform name="android">
<config-file target="res/xml/config.xml" parent="/*"> <config-file target="res/xml/config.xml" parent="/*">
<feature name="BackgroundGeoLocation"> <feature name="BackgroundGeoLocation">
<param name="android-package" value="org.transistorsoft.cordova.background-geolocation"/> <param name="android-package" value="org.transistorsoft.cordova.backgroundgeolocation"/>
</feature> </feature>
</config-file> </config-file>
<source-file src="src/android/CDVBackgroundGeoLocation.java" target-dir="src/org/transistorsoft/background-geolocation" /> <source-file src="src/android/CDVBackgroundGeoLocation.java" target-dir="src/org/transistorsoft/background-geolocation" />
<asset src="www/android/BackgroundGeoLocation.js" target="plugins/BackgroundGeoLocation.js" /> <js-module src="www/android/BackgroundGeoLocation.js" name="BackgroundGeoLocation">
<clobbers target="cordova.plugins.backgroundGeoLocation" />
</js-module>
</platform> </platform>
...@@ -30,7 +36,11 @@ ...@@ -30,7 +36,11 @@
<source-file src="src/ios/CDVBackgroundGeoLocation.m" target-dir="src/org/transistorsoft/background-geolocation" /> <source-file src="src/ios/CDVBackgroundGeoLocation.m" target-dir="src/org/transistorsoft/background-geolocation" />
<source-file src="src/ios/CDVBackgroundGeoLocation.h" target-dir="src/org/transistorsoft/background-geolocation" /> <source-file src="src/ios/CDVBackgroundGeoLocation.h" target-dir="src/org/transistorsoft/background-geolocation" />
<asset src="www/ios/BackgroundGeoLocation.js" target="plugins/BackgroundGeoLocation.js" />
<js-module src="www/ios/BackgroundGeoLocation.js" name="BackgroundGeoLocation">
<clobbers target="cordova.plugins.backgroundGeoLocation" />
</js-module>
</platform> </platform>
</plugin> </plugin>
\ No newline at end of file
/** /***
* Custom Cordova Background GeoLocation plugin. Uses iOS native API * Custom Cordova Background GeoLocation plugin. Uses iOS native API
* @author <chris@transistorsoft.com> * @author <chris@transistorsoft.com>
* Largely based upon http://www.mindsizzlers.com/2011/07/ios-background-location/ * Largely based upon http://www.mindsizzlers.com/2011/07/ios-background-location/
*/ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
cordova.define("org.transistorsoft.cordova.background-geolocation", function(require, exports, module) {
var exec = require('cordova/exec');
;(function(){ /**
var BackgroundGeoLocation = function() {} * Provides access to the vibration mechanism on the device.
*/
BackgroundGeoLocation.prototype = { module.exports = {
/** /**
* Configure the native API with our authentication-token and url to POST locations to * Configure the native API with our authentication-token and url to POST locations to
* TODO Native plugin assumes the json-structure as required by our rails server * TODO Native plugin assumes the json-structure as required by our rails server
...@@ -44,12 +65,5 @@ ...@@ -44,12 +65,5 @@
fail = (typeof(fail) === 'function') ? fail : function() {}; fail = (typeof(fail) === 'function') ? fail : function() {};
return Cordova.exec(success, fail, "BackgroundGeoLocation", "stop", [options]); return Cordova.exec(success, fail, "BackgroundGeoLocation", "stop", [options]);
} }
};
// remove Cordova.addConstructor since it was not supported on PhoneGap 2.0
if (!window.plugins) window.plugins = {};
if (!window.plugins.BackgroundGeoLocation) {
window.plugins.BackgroundGeoLocation = new BackgroundGeoLocation();
} }
})(); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment