埃迪斯通灯塔使用altbeacon库Android平台后台监控斯通、灯塔、后台、埃迪

由网友(沵不是姐的菜)分享简介:是的Eddystone的后台监控灯塔使用altbeacon库Android平台可能吗?我怎样才能实现呢?以下是code。通过它我可以检测到信标与指定的UUID时,应用程序启动,但我想实现当应用程序没有运行一样。公共类MainActivity扩展ActionBarActivity实现BeaconConsumer,Moni...

的Eddystone的后台监控灯塔使用altbeacon库Android平台可能吗?我怎样才能实现呢?

以下是code。通过它我可以检测到信标与指定的UUID时,应用程序启动,但我想实现当应用程序没有运行一样。

 公共类MainActivity扩展ActionBarActivity实现BeaconConsumer,MonitorNotifier
{

私人BeaconManager beaconManager;
@覆盖
保护无效的onCreate(包savedInstanceState){
    super.onCreate(savedInstanceState);
    的setContentView(R.layout.activity_main);
}


@覆盖
保护无效onResume(){
    super.onResume();
    beaconManager = BeaconManager.getInstanceForApplication(this.getApplicationContext());
    。beaconManager.getBeaconParsers()增加(新BeaconParser()setBeaconLayout(S:0-1 = FEAA,M:2-2 = 00,P:3-3:-41,我:4-13,I:14 -19));
    beaconManager.bind(本);
}

@覆盖
公共无效onBeaconServiceConnect(){

    标识符myBeaconNamespaceId = Identifier.parse(0xe2bfcc3cc2370789caef);
    地区地区=新区域(我的信标区域,myBeaconNamespaceId,NULL,NULL);
    beaconManager.setMonitorNotifier(本);
    尝试 {
        beaconManager.startMonitoringBeaconsInRegion(区);
    }赶上(RemoteException的E){
        e.printStackTrace();
    }
}

@覆盖
公共无效didEnterRegion(地区区域){

        Log.d(radbeacon,信标探测与命名空间ID+ region.getId1()+和实例ID:+ region.getId2());
}

@覆盖
公共无效didExitRegion(地区区域){

    Log.d(radbeacon,烽火台用空间ID区的+ region.getId1()+和实例ID:+ region.getId2());
}

@覆盖
公共无效didDetermineStateForRegion(INT I,地区区域){
      //忽略
}


}
 

解决方案

是的,这是可以检测的Eddystone信标与的 Android的灯塔库。 您以同样的方式与AltBeacon或iBeacon这样做。细节在href="http://altbeacon.github.io/android-beacon-library/samples.html" rel="nofollow">在样品的背景部分开始应用的

阅读全文

相关推荐

最新文章