RadiusNetworks Android iBeacon Library - 无法绑定IBeaconService

时间:2014-06-12 06:54:09

标签: android ibeacon-android

首先,我所做的与链接(Android iBeacon Library - How to bind IBeaconManager to service in remote process)类似:

  1. 定义了我自己的 MyIBe​​aconService ,它扩展了服务并实现了 的 IBeaconConsumer 即可。它包含一个 IBeaconManager 成员,并提供相应的API,例如bind / unbind等。在 onIBeaconServiceConnect()中,它设置 MonitorNotifier RangeNotifier ,开始监视和测距,并在调用相应的通知程序回调时向活动广播意图
  2. 主要活动绑定到 MyIBe​​aconService ,并在 onResume()中注册相应的 BraodcastReceiver
  3. 然后当主要活动成功绑定到 MyIBe​​aconService 时,在ServiceConnection :: onServiceConnected()中,我调用 IBeaconManager.bind 绑定 MyIBe​​aconService IBeaconService
  4. 但是,从未调用MyIBe​​aconService :: onIBeaconServiceConnect。根据上面链接中的答案,我在下面发布了生成的AndroidManifest.xml文件:
     1. MyIBe​​aconService的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。 MyIBe​​aconService的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  
    

0 个答案:

没有答案