You why you would need that. I used it to detect if screen mirroring is on or not. If length of displays is greater than 1 then screen mirroring is on else not. It’s not hundred percent upto the mark. May be we can use the MediaRouter API too. I haven’t gone through that much but you added some listeners on route changes. Visit for more: Android | MediaRouter add listeners – FaltuTech.Com
@ReactMethod
public void getDisplayCount(Promise promise) {
try {
if (this._displayManager == null) {
this._displayManager = (DisplayManager) this.reactContext.getSystemService(Context.DISPLAY_SERVICE);
}
Display[] displays = _displayManager.getDisplays();
promise.resolve(displays.length);
} catch (Exception e) {
promise.reject("No displays found", e);
}
}
Cheers and Peace out!!!