简体   繁体   中英

Launcher activity intent flags

I want to set some intent flags on the launcher activity of my app depending on user defined settings. For example, if user chooses not to turn off backlight, I should set FLAG_KEEP_SCREEN_ON for launcher activity. Is there any way to get current intent and change it's flags before main activity is started?

I have been using PowerManager and WakeLock, but this way is kind of deprecated now so I want to update the app.

Thanks!

Is there any way to get current intent and change it's flags before main activity is started?

No, sorry.

That being said, just call setKeepScreenOn() on some View in your activity, and you will accomplish the same thing.

I have been using PowerManager and WakeLock, but this way is kind of deprecated now

PowerManager and WakeLock are not deprecated, but they require an extra permission and are a bit risky -- the user will be unhappy if you fail to release() the WakeLock due to a crash or something.

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