Open Jolanrensen opened 6 years ago
I'd tried with UsageAccess permission but it gives list of app based on time range but the realtime like getRecentTasks()
.
I wanted to mimic exact behavior like zuk which allows to navigate through running apps only instead of historical apps.
Though with usage access method, it can be done by querying the app id with running processes list but it may hit the performance.
I'm little wandering how're you gonna use this in pixel?
UsageAcces can however provide you with the app that's currently opened lastly. In theory you could create a list with these apps by checking all the time and periodically check if the apps in the list are no longer running (not sure if that last part is possible). Or perhaps root could be used to get the running apps using the ps command (I'm trying to figure out how to do that).
Though with usage access method, it can be done by querying the app id with running processes list but it may hit the performance.
Is this possible? I thought the running processes list wasn't accessible. You can however just send an intent to open the app just like the launcher would do (but you won't have the nice sliding animation).
I'm little wondering how're you gonna use this in pixel?
The same as with the zuk, by sliding over the fingerprint sensor. Since Oreo there's the fingerprint gesture api so this just works. I was also thinking about sliding over the navigation bar to achieve it, that might be easier perform for the user.
Wow I got it working using an old pal, the xposed framework! This module https://forum.xda-developers.com/xposed/modules/xposed-unrestrictedgettasks-t3183650 enables the getRecentTasks command!
I see. But people reported it's working fine on oreo without any additional modules like xposed. Have you tried installing the app as system app?
Yes I did, I think Lenovo didn't remove the getRecentTasks command like Google did with AOSP. Using the module the command becomes available again!
I don't think it's related Lenovo since there are many custom ROM based on AOSP and LOS people use this app on. Though I'll test on my OP5T
(as on xda) I'm looking to see if I can use your app on all android phones and not just the zuk. I'm trying on my pixel 2xl on android 8.1 but the recent app list appears to be empty. After inspection of your code I think this is due to your use of "ActivityManager.getRecentTasks()" which is deprecated since lollipop and since oreo only gives the current app id (I think). There are however other ways to get the running apps using "usage access".