Alexander
Alexander

Reputation: 1329

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!

Upvotes: 0

Views: 767

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007276

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.

Upvotes: 1

Related Questions