android-recents

Android use a different icon for recent apps

耗尽温柔 提交于 2019-12-01 05:49:19
I have a working app but I want to add an alternate version of the app's icon that would be associated with the recent apps window. Instead of the icon that appears on the homescreen, the recent apps window would use the other one. The way this can be done is using the new setTaskDescription(...) method in the Activity class. It can be used to set the title of the task and the icon of the task to display in the recent apps screen. This uses the ActivityManager.TaskDescription class to set these values. See an example below. Note that all this code belongs in the activity whose task description

How to force app to create thumbnail (snapshot) for recent apps list?

╄→гoц情女王★ 提交于 2019-11-29 10:23:22
Tester of my app has reported: "The thumbnail of the app in the Recent apps list is not tuned at all. At me it appears either like a homescreen wallpapers (tolikdru: probably, just transparent rect), or like green background of the app screen, but never as a real snapshot of the app." So the behaviour is something like described here . My device is with Android 2.0 so I cannot check and debug the issue (thumbnails in Recent apps are since Android 3.0+). So further research was in a "blind mode". I decided to manually force creation of app thumbnail using onCreateThumbnail() as proposed here .

Hide screen in 'Recent Apps List', but allow screenshots

谁都会走 提交于 2019-11-29 03:02:49
问题 I mainly want to blank the screen in the recent apps list due to sensitive data being shown. For this, the solution is to use: getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); but this also disallows screenshots, which is a problem. Is there a way to show a blank screen (or a predefined image) in the recent apps list, while still allowing screenshots? 回答1: I think what you need is: android:excludeFromRecents="true" put that in your android manifest inside your <activity>(activity

How to force app to create thumbnail (snapshot) for recent apps list?

丶灬走出姿态 提交于 2019-11-28 03:43:50
问题 Tester of my app has reported: "The thumbnail of the app in the Recent apps list is not tuned at all. At me it appears either like a homescreen wallpapers (tolikdru: probably, just transparent rect), or like green background of the app screen, but never as a real snapshot of the app." So the behaviour is something like described here. My device is with Android 2.0 so I cannot check and debug the issue (thumbnails in Recent apps are since Android 3.0+). So further research was in a "blind mode

How to detect app removed from the recent list?

醉酒当歌 提交于 2019-11-27 05:16:47
I'm working on a music app, and I want stop the service when user removes the application from the recent list and not when the first activity is destroyed(because when user clicks back back until app minimizes, in that case first activity is also getting destroyed). Please help. I want stop the service when user removes the application from the recent list. Yes, you can either do that using stopWithTask flag as true for Service in Manifest file. Example: <service android:enabled="true" android:name=".MyService" android:exported="false" android:stopWithTask="true" /> OR If you need event of

How to check if “android.permission.PACKAGE_USAGE_STATS” permission is given?

对着背影说爱祢 提交于 2019-11-26 20:23:58
Background I'm trying to get app-launched statistics, and on Lollipop it's possible by using the UsageStatsManager class, as such (original post here ): manifest: <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" tools:ignore="ProtectedPermissions"/> opening the activity that will let the user confirm giving you this permission: startActivity(new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS)); getting the stats, aggregated : private static final String USAGE_STATS_SERVICE ="usagestats"; // Context.USAGE_STATS_SERVICE); ... final UsageStatsManager usageStatsManager=

How to detect app removed from the recent list?

大憨熊 提交于 2019-11-26 11:29:52
问题 I\'m working on a music app, and I want stop the service when user removes the application from the recent list and not when the first activity is destroyed(because when user clicks back back until app minimizes, in that case first activity is also getting destroyed). Please help. 回答1: I want stop the service when user removes the application from the recent list. Yes, you can either do that using stopWithTask flag as true for Service in Manifest file. Example: <service android:enabled="true"

How to use UsageStatsManager?

微笑、不失礼 提交于 2019-11-26 11:10:36
Background Google has deprecated the function " getRecentTasks " of "ActivityManager" class. Now all it does is to get the list of apps that the current app has opened. I've even written a post about it here on StackOverflow , but I noticed it's impossible. The problem I've made a post about it ( here , and another, similar one created by someone else, here ) and requested to re-consider it, and Google decided to make a new class, that seem to provide a similar functionality (more like statistics, but might also be useful), but I can't find out how to use it. The class is called "