File tree Expand file tree Collapse file tree 2 files changed +29
-4
lines changed
android/src/main/java/com/mackentoch/beaconsandroid Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,11 @@ public void bindManager() {
7878 mBeaconManager .bind (this );
7979 }
8080
81+ @ ReactMethod
82+ public void unbindManager () {
83+ mBeaconManager .unbind (this );
84+ }
85+
8186 @ ReactMethod
8287 public void addParser (String parser ) {
8388 mBeaconManager .getBeaconParsers ().add (new BeaconParser ().setBeaconLayout (parser ));
Original file line number Diff line number Diff line change @@ -92,15 +92,34 @@ async function bindManager(): Promise<any> {
9292 return new Promise ( ( resolve , reject ) => {
9393 this . bindListener = DeviceEventEmitter . addListener ( 'bindStatus' , ( { status} ) => {
9494 if ( status ) {
95- resolve ( status )
95+ resolve ( status ) ;
9696 }
9797 else {
98- reject ( status )
98+ reject ( status ) ;
9999 }
100- DeviceEventEmitter . removeListener ( 'bindStatus' , this . bindListener )
100+ DeviceEventEmitter . removeListener ( 'bindStatus' , this . bindListener ) ;
101101 } ) ;
102102 BeaconsManager . bindManager ( ) ;
103- } )
103+ } ) ;
104+ }
105+
106+ /**
107+ * unbind the service
108+ *
109+ */
110+ async function unbindManager ( ) : Promise < any > {
111+ return new Promise ( ( resolve , reject ) => {
112+ this . bindListener = DeviceEventEmitter . addListener ( 'bindStatus' , ( { status} ) => {
113+ if ( status ) {
114+ resolve ( status ) ;
115+ }
116+ else {
117+ reject ( status ) ;
118+ }
119+ DeviceEventEmitter . removeListener ( 'bindStatus' , this . bindListener ) ;
120+ } ) ;
121+ BeaconsManager . unbindManager ( ) ;
122+ } ) ;
104123}
105124
106125/**
@@ -275,6 +294,7 @@ module.exports = {
275294 detectEddystoneURL,
276295 detectEddystoneEID,
277296 bindManager,
297+ unbindManager,
278298 detectCustomBeaconLayout,
279299 setBackgroundScanPeriod,
280300 setBackgroundBetweenScanPeriod,
You can’t perform that action at this time.
0 commit comments