我正在尝试开发一个 Android 插件以在 Ionic 应用程序中使用。
我使用 Ionic 已经提供的入门项目创建了应用程序ionic start myApp tabs。
我还在另一个文件夹中创建了我的插件,其中包含以下文件。
插件文件
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="location-plugin" version="0.0.1">
<name>GSLocationManager</name>
<description>Location Plugin</description>
<license>MIT</license>
<keywords>cordova,device,sensors,location</keywords>
<js-module name="LocationManager" src="www/LocationManager.js">
<clobbers target="LocationManager" />
</js-module>
<engines>
<engine name="cordova" version=">=3.6.0"></engine>
</engines>
<platform name="android">
<preference name="GOOGLE_PLAY_SERVICES_VERSION" default="11+"/>
<preference name="ANDROID_SUPPORT_LIBRARY_VERSION" default="26+"/>
<preference name="ICON" default="@mipmap/icon" />
<preference name="SMALL_ICON" default="@mipmap/icon" />
<preference name="ACCOUNT_NAME" default="@string/app_name" />
<preference name="ACCOUNT_LABEL" default="@string/app_name" />
<preference name="ACCOUNT_TYPE" default="$PACKAGE_NAME.account" />
<preference name="CONTENT_AUTHORITY" default="$PACKAGE_NAME" />
<framework src="com.google.android.gms:play-services-location:$GOOGLE_PLAY_SERVICES_VERSION" />
<framework src="com.android.support:support-v4:$ANDROID_SUPPORT_LIBRARY_VERSION" />
<framework src="com.android.support:appcompat-v7:$ANDROID_SUPPORT_LIBRARY_VERSION" /> …Run Code Online (Sandbox Code Playgroud)