I\'m trying to write a Cordova plugin which interacts with the Radius Networks iBeacon library for Android. Now, I\'m aware the library is designed for use with an Activity/
Your empty bindService
and unbindService
methods are causing you problems. If your class were an Activity, Service or Application, these would all be implemented for you. If you want to make a custom class you have to provide an implementation.
Without an implementation for the bindService
method, the iBeaconManager.bind(this);
line ends up accomplishing nothing, because it in turn has to call one of these methods. (Add log lines to those empty methods and you will see.) As a result, the IBeaconService
never starts up and onIBeaconServiceConnect
never gets called.
Enough boring explanation -- it's time for a solution! The easiest thing to do is to chain these methods. Try something like:
@Override
public boolean bindService(Intent intent, ServiceConnection conn, int mode) {
return context.bindService(intent, conn, mode);
}
@Override
public void unbindService(ServiceConnection conn) {
context.unbindService(conn);
}