<?xml version="1.0" encoding="UTF-8"?>

<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
    xmlns:android="http://schemas.android.com/apk/res/android"
    id="com.transistorsoft.cordova.background-geolocation"
    version="0.3.6">
    <name>CDVBackgroundGeoLocation</name>
    <description>Cordova Background GeoLocation Plugin</description>
    <license>MIT</license>
    <keywords>phonegap,background geolocation</keywords>

    <engines>
        <engine name="cordova" version=">=3.0.0" />
    </engines>

    <dependency id="org.apache.cordova.geolocation" />
    <dependency id="org.apache.cordova.dialogs" />

    <dependency id="com.google.playservices" url="https://github.com/MobileChromeApps/google-play-services.git" />

    <js-module src="www/BackgroundGeoLocation.js" name="BackgroundGeoLocation">
        <clobbers target="plugins.backgroundGeoLocation" />
    </js-module>

    <!-- android -->
    <platform name="android">
        <source-file src="src/android/libs/eventbus-2.4.0.jar" target-dir="libs" />
        <source-file src="src/android/BackgroundGeolocationPlugin.java" target-dir="src/com/transistorsoft/cordova/bggeo" />
        <source-file src="src/android/BackgroundGeolocationService.java" target-dir="src/com/transistorsoft/cordova/bggeo" />
        <source-file src="src/android/notification.png" target-dir="res/drawable" />

        <config-file target="AndroidManifest.xml" parent="/manifest/application">
            <service android:name="com.transistorsoft.cordova.bggeo.BackgroundGeolocationService" />
        </config-file>

        <config-file target="AndroidManifest.xml" parent="/manifest">
            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
            <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" />
            <uses-permission android:name="android.permission.INTERNET" />
            <uses-permission android:name="android.permission.WAKE_LOCK" />
            <uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
        </config-file>   
        <config-file target="res/xml/config.xml" parent="/*">
            <feature name="BackgroundGeoLocation">
                <param name="android-package" value="com.transistorsoft.cordova.bggeo.BackgroundGeolocationPlugin"/>
            </feature>
        </config-file> 
     </platform>          

     <platform name="ios">
        <!-- required background modes:  App registers for location updates -->
        
        <config-file target="*-Info.plist" parent="NSLocationAlwaysUsageDescription">
            <string>This app requires background location tracking</string>
        </config-file>

        <config-file target="*-Info.plist" parent="UIBackgroundModes">
            <array>
                <string>location</string>
            </array>
        </config-file>

        <config-file target="config.xml" parent="/*">
            <feature name="BackgroundGeoLocation">
                <param name="ios-package" value="CDVBackgroundGeoLocation"/>
            </feature>
        </config-file>
        <framework src="AudioToolbox.framework" weak="true" />
        <framework src="AVFoundation.framework" weak="true" />
        <source-file src="src/ios/CDVBackgroundGeoLocation.m" />
        <header-file src="src/ios/CDVBackgroundGeoLocation.h" />
     </platform>          

	<!-- wp8 -->
	<platform name="wp8">
		<config-file target="config.xml" parent="/*">
			<feature name="BackgroundGeoLocation">
				<param name="wp-package" value="BackgroundGeoLocation" onload="true" />
				<param name="onload" value="true" />
			</feature>
		</config-file>

		<config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Tasks/DefaultTask">
			<BackgroundExecution>
				<ExecutionType Name="LocationTracking" />
			</BackgroundExecution>
		</config-file>

		<config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
			<Capability Name="ID_CAP_LOCATION" />
		</config-file> 
		<source-file src="src/wp8/BackgroundGeoLocation.cs" />
		<source-file src="src/wp8/BackgroundGeoLocationOptions.cs" />
		<source-file src="src/wp8/DebugAudioNotifier.cs" />
		<source-file src="src/wp8/ExtensionMethods.cs" />
		<source-file src="src/wp8/IBackgroundGeoLocation.cs" /> 
	</platform>

</plugin>
