onBeaconServiceConnect not called

后端 未结 3 1881
滥情空心
滥情空心 2021-01-16 06:04

As before, I work with Android Beacon Library,

It already worked and I can found out beacon via BLE - Bluetooth low energy,

But now, after updated to latest

3条回答
  •  孤城傲影
    2021-01-16 06:27

    If you are implementing the BeaconConsumer interface in a Fragment (and not an Activity, Service or Application instance), you need to chain all of the methods. Like this:

    @Override
    public Context getApplicationContext() {
        return getActivity().getApplicationContext();
    }
    
    @Override
    public void unbindService(ServiceConnection serviceConnection) {
        getActivity().unbindService(serviceConnection);
    }
    
    @Override
    public boolean bindService(Intent intent, ServiceConnection serviceConnection, int i) {
        return getActivity().bindService(intent, serviceConnection, i);
    }
    

提交回复
热议问题