简体   繁体   中英

Force bluetooth permission request dialog always use landscape mode

In my own app I call bluetooth function , and I want to the bluetooth permission request dialog displayed in landscape mode.

I know how to force an Android activity to always use landscape mode and I have achieved this effect. But the bluetooth permission request dialog comes from system application. So how to control its orientation?

我也想要对话框

try to write the same code in onconfigurationchanged() method. When u change the orientation activity will came into this method & not to onCreate() method. & check now it will give u current result.

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    if(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
        Log.i("orientation", "Orientation changed to: Landscape");
    else
        Log.i("orientation", "Orientation changed to: Portrait");
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM