如何知道哪些包推出? [英] How to know which package is launching?

查看:98
本文介绍了如何知道哪些包推出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载从市场应用程序保护的应用程序。
它可以让我来保护来打开密码的任何应用程序。

I have downloaded 'Application Protection' application from market. It allows me to protect to open any application with password.

即。我保护了'ConnectionLost与应用程序保护的应用。

i.e. I have protected 'ConnectionLost' Application with Application Protection.

现在,当我打开'ConnectionLost应用。我在logcat中发现下面的日志。

Now when I open 'ConnectionLost' App. I found below log in Logcat.

1号线的启动:{意向ACT = android.intent.action.MAIN猫= [android.intent.category.LAUNCHER] FLG = 0x10200000 CMP = com.android.connectionlost / .ConnectionLost}从PID 5746

行2 - 首发:意向{FLG = 0x10000000的CMP = com.ruimaninfo.approtect / .ui.ScreenLocker}从PID 5494

它首先意味着我的应用程序启动后的一个应用保护推出它自己的活动。

It means first my application launch and after 'applicaton protection' launch it's own activity.

所以我的问题是

如何应用程序保护(Downlaode从市场上)知道哪个包启动?
和作为程序员如何,我们知道是一回事吗?

感谢你。

推荐答案

您可以找出哪些包是由活动管理器

You can find out which package is launching by Activity Manager

ActivityManager am = (ActivityManager) getSystemService(Activity.ACTIVITY_SERVICE);
String packageName = am.getRunningTasks(1).get(0).topActivity.getPackageName();
String ClassName = am.getRunningTasks(1).get(0).topActivity.getClassName();

You can make one background service which has a timer task of 100 seconds 
and put this code in timertask which prints log at every 100 seconds that which package is launching

这篇关于如何知道哪些包推出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆