- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我开发了一个应用程序(称为 Instant Buttons)并且该应用程序具有小部件功能。此小部件将 PendingIntent 用于小部件的 onClick。
我的 PendingIntent 代码是这样的:
Intent active = new Intent(context, InstantWidget.class);
active.setAction(String.valueOf(appWidgetId));
active.putExtra("blabla", blabla); //Some data
PendingIntent actionPendingIntent = PendingIntent.getBroadcast(context, 0, active, 0);
actionPendingIntent.cancel();
actionPendingIntent = PendingIntent.getBroadcast(context, 0, active, 0);
remoteViews.setOnClickPendingIntent(R.id.button, actionPendingIntent);
onReceive 获取 Intent 并使用 MediaPlayer 类做一些事情来重现声音。
我收到一些用户的报告,说小部件在一段时间后停止工作,并且我发现一些研究是因为任务 killer 。似乎当您在 TaskKiller 中终止应用程序时,PendingIntent 已从内存中删除,因此当您单击该小部件时,它不知道该做什么。
有什么解决办法吗?是我的代码有误还是什么或者它是 PendingIntent 的默认行为?有什么我可以用来避免 TaskKiller 停止我的小部件工作的东西吗??
问候。
最佳答案
Is there any solution for this?
要求您的用户不要使用任务 killer 。或者,等待 future 的某个 Android 版本来关闭任务 killer 漏洞。
Is my code wrong or something or it's the default behavior of the PendingIntent?
您的代码大概没问题。任务 killer 使用的 hack 几乎清除了所有内容,所以我对这种行为一点也不感到惊讶。
Is there something I can use to avoid the TaskKiller to stop my widgets from working?
不是真的。您的用户——至少那些不是完全白痴的用户——将有望学会更多地了解他们使用任务 killer 的影响。目前,没有针对任务 killer 应用程序的合理防御措施。
关于android - Widget + TaskKiller 中的 PendingIntent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2706303/
开启 Microsoft Technet我可以读到 taskkill 有一个 /f 参数来强制终止进程。我想知道这在内部有什么作用,以了解此类操作的影响。 taskkill(没有 /f)不会简单地向进
public class Second { private WebDriver driver; private boolean acceptNextAlert = true; privat
所以我使用 Vista 附带的 taskkill.exe,我希望它做一些特别复杂的事情.. 有多个 java.exe 实例正在运行,我希望它找到未命名的实例..所以这是我的命令: taskkill /
在我的 MSI 安装程序自定义操作处理程序(使用 C++ 完成)中,我无法获得能够打开和终止进程的 SE_DEBUG_NAME 权限,因此我不得不求助于 taskkill实用程序本身: taskkil
我有时会得到一个进程,如果我运行 taskkill/im the_process.exe/f/t,那么它不会杀死它,因为: 错误:PID 为 6492 的进程(PID 为 5788 的子进程)无法终止
这么多年过去了,您可能会认为我已经完成了某种类型的 Windows 批处理文件。但你错了。我正在更新批处理文件并遇到以下语句: TASKKILL /F /FI "WINDOWTITLE eq SIM
我正在尝试找到如何使用它的标题关闭进程。 我找到了命令: taskkill /fi "WINDOWTITLE eq the_title_of_the_windows" 效果很好。 当我尝试时: oSh
我刚刚阅读了以下命令: taskkill /f /im something.exe 我读到了 /f强制关闭任务,但是 /im 做什么?做? 最佳答案 它告诉 taskkill下一个参数somethin
我正在自动刷新图标缓存,我发现 TaskKill 之间存在有趣的差异和 Stop-Process .一般来说,我更喜欢使用本地 PowerShell,而不是从 PowerShell 启动的 DOS 命
在下面所示的批处理文件的上下文中测试 TASKKILL 的 errorlevel 的正确语法是什么? :Launch start "CloseMe" "C:\Program Files\inte
我希望能够使用 .bat 文件关闭远程计算机上的进程。 例如:taskkill/im Myapp.exe 使用 taskkill 是关闭应用程序的合适方法吗?例如,点击工具栏上的“X”? 它是否让应用
我在添加时遇到问题 -XX:OnOutOfMemoryError="taskkill /F /PID %%p" ant 中 java 命令的参数。 当我添加 或 Ant 无法解析 XML 文件。
我正在尝试在标题中有空格的控制台窗口上运行 taskkill。如何将此窗口标题传递给 taskkill。我尝试了以下方法: taskkill /fi "WINDOWTITLE eq Administr
当我从 VS 启动 VS 的实验实例进行调试并停止调试(有时直接从父 VS)时,僵尸 devenv.exe 进程仍在运行,我无法终止。它保留了我的许多 dll。 当我以管理员身份登录到这台 64 位
我正在使用以下代码来终止所有 java 进程。 taskkill /F /IM javaw.exe taskkill /F /IM java.exe exit 当我需要终止我所有的 java 进程时,
这个命令在 Linux 中的等价物是什么? taskkill /F /IM myStupidProcess.exe /T 最佳答案 kill -9 pid_of_process 或 killall -
我有 4 个 excel 文件(city.xls、rule.xls、adv.xls 和 mapping.xls),所有 excel 文件都在其中打开。如何在批处理/CMD 编程中使用 taskkill
为了运行游戏,我需要启动它的 exe 两次,然后终止其中一个 rundll32.exe 进程。我不想每次都手动执行此操作,所以我将它放在一个批处理文件中,如下所示: start Gothic2.exe
为了运行游戏,我需要启动它的 exe 两次,然后终止其中一个 rundll32.exe 进程。我不想每次都手动执行此操作,所以我将它放在一个批处理文件中,如下所示: start Gothic2.exe
我开发了一个应用程序(称为 Instant Buttons)并且该应用程序具有小部件功能。此小部件将 PendingIntent 用于小部件的 onClick。 我的 PendingIntent 代码
我是一名优秀的程序员,十分优秀!