首先,我所做的与链接(Android iBeacon Library - How to bind IBeaconManager to service in remote process)类似:
但是,从未调用MyIBeaconService :: onIBeaconServiceConnect。根据上面链接中的答案,我在下面发布了生成的AndroidManifest.xml文件:
1. MyIBeaconService的AndroidManifest.xml
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<application android:allowBackup="true">
<service android:name="com.xxx.ibeaconlib.MyIBeaconService">
</service>
<service android:enabled="true" android:exported="true" android:isolatedProcess="false" android:label="iBeacon" android:name="com.radiusnetworks.ibeacon.service.IBeaconService">
</service>
<service android:enabled="true" android:name="com.radiusnetworks.ibeacon.IBeaconIntentProcessor">
</service>
</application>
2。 MyIBeaconService的project.properties
target=android-19
android.library=true
manifestmerger.enabled=true
android.library.reference.1=../../../Downloads/AndroidIBeaconLibrary
3。我的Android应用程序的AndroidManifest.xml
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme">
<activity android:label="@string/app_name" android:name="com.radiusnetworks.ibeaconreference.MonitoringActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:label="@string/app_name" android:name="com.radiusnetworks.ibeaconreference.RangingActivity">
<intent-filter>
</intent-filter>
</activity>
<activity android:label="@string/app_name" android:name="com.radiusnetworks.ibeaconreference.BackgroundActivity">
<intent-filter>
</intent-filter>
</activity>
<service android:name="com.xxx.ibeaconlib.MyIBeaconService">
</service>
<service android:enabled="true" android:exported="true" android:isolatedProcess="false" android:label="iBeacon" android:name="com.radiusnetworks.ibeacon.service.IBeaconService">
</service>
<service android:enabled="true" android:name="com.radiusnetworks.ibeacon.IBeaconIntentProcessor">
</service>
</application>
4。 Android应用程序的project.properties
target=android-19
manifestmerger.enabled=true //please confirm this line is added and remove the comment then
android.library.reference.1=../../Documents/workspace/iBeaconLib