how to check if another app is minimized or open in android? -


i have seen many solutions check if our own app minimized,running or background.but there way check if app package running or minimized based on can run code.like app-locker.here need turn off network apps according user selection on installed apps in device, when selected apps on foreground, network should disabled when selected apps closed or minimized.then enable network. compliant google play if make such app? because somewhere read don't allow apps interfere other apps.so confused.

tl;dr: google doesn't want this, , shouldn't try.

the old hack relied on activitymanager#getrecenttasks() find out app in foreground disabled starting in android 5.0.

app lockers work on lollipop using new hack involving activitymanager#getrunningappprocesses(). how works described in this answer. this hack reportedly broken on android m.

there's new usagestats api might able glean bit of info, requires permission can granted system activity. it's documented system activity may not present on devices. samsung , lg among manufacturers have reportedly removed activity lollipop devices, system apps ever able use usagestats.

the bottom line google has shown commitment preventing you're trying do. if find temporary solution, can bet stop working in future android version. eventually, google close loopholes , app permanently broken. it's waste of time write new app depends on capability.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -