RadiusNetworks Android iBeacon库-绑定IBeaconService失败

RadiusNetworks Android iBeacon库-绑定IBeaconService失败,android,ibeacon-android,Android,Ibeacon Android,首先,我所做的与link()类似: 定义了我自己的MyIBeaconService,它扩展了服务并实现 IBeaconConsumer。它包含一个IBeaconManager成员,并提供相应的API,如绑定/取消绑定等。在onibeacerviceconnect()中,它设置MonitorNotifier和RangeNotifier,开始监视和测距,并在调用相应通知程序的回调时向活动广播意图 主要活动绑定到MyIBeaconService,并在onResume()中注册相应的BraodcastR

首先,我所做的与link()类似:

  • 定义了我自己的MyIBeaconService,它扩展了服务并实现 IBeaconConsumer。它包含一个IBeaconManager成员,并提供相应的API,如绑定/取消绑定等。在onibeacerviceconnect()中,它设置MonitorNotifierRangeNotifier,开始监视和测距,并在调用相应通知程序的回调时向活动广播意图
  • 主要活动绑定到MyIBeaconService,并在onResume()中注册相应的BraodcastReceiver
  • 然后,当主活动成功绑定到MyIBeaconService时,在ServiceConnection::onServiceConnected()中,我调用IBeaconManager.bindMyIBeaconService绑定到IBeaconService
  • 但是,从未调用MyIBeaconService::OnibeAccerviceConnect。根据上面链接中的答案,我在下面发布了生成的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>
    
    <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>
    
    三,。我的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">
        <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>
    
    <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>
    

    在您的应用程序/项目中,项目属性中需要一个重要的手动编辑:manifestmerge.enabled,将其设置为true并检查它谢谢您的回复。我在project.properties中有这个配置。只是忘了提一下。好吧,你有manifestMerge.enabled=true和android.library.reference.1=../AndroidIBeaconLibrary configured..right?,你能发布onIBeaconServiceConnect()吗?是的,让我尝试更新我的原始帖子来添加它们。感谢您的回复。我将断点放在OnibeAccerviceConnect()上,它没有被调用。谢谢