Android apk Monitor

Source: Internet
Author: User

Android apk Install, clean data, force stop, uninstall monitoring


No nonsense, on the code


<receiver android:name= "Com.test.Receiver" android:enabled= "true" >            <intent-filter >                < Action android:name= "Android.intent.action.PACKAGE_ADDED"/>                <action android:name= " Android.intent.action.PACKAGE_REMOVED "/>                <action android:name=" Android.intent.action.PACKAGE_CHANGED " />                <action android:name= "Android.intent.action.PACKAGE_DATA_CLEARED"/>                <action android:name= "Android.intent.action.PACKAGE_FIRST_LAUNCH"/>                <action android:name= "android.intent.action.PACKAGE_ Fully_removed "/>                <action android:name=" Android.intent.action.PACKAGE_REPLACED "/>                <action Android:name= "Android.intent.action.PACKAGE_RESTARTED"/>                <data android:scheme= "package" ></data >            </intent-filter>        </receiver>


The following are the broadcasts that are sent in each case


1\ Installation

Android.intent.action.PACKAGE_ADDED


2 Overlay Installation
Android.intent.action.PACKAGE_REMOVED
Android.intent.action.PACKAGE_ADDED
Android.intent.action.PACKAGE_REPLACED


3\ Cleanup Data
Android.intent.action.PACKAGE_RESTARTED
Android.intent.action.PACKAGE_DATA_CLEARED


4\ forced stop
Action:android.intent.action.PACKAGE_RESTARTED


5\ Uninstall
Android.intent.action.PACKAGE_REMOVED
Android.intent.action.PACKAGE_FULLY_REMOVED


How to get the package name on the radio

ComponentName cn = Intent.getcomponent (); Uri uu= intent.getdata (); String name = Uu.getschemespecificpart ();

Get APK (not installed) related information:


public static void Getapkpackageinfo (Context context,string apkpath) {        Packagemanager Packagemanager = Context.getpackagemanager ();        PackageInfo info = packagemanager.getpackagearchiveinfo (Apkpath, packagemanager.get_activities);        if (info! = null) {            ApplicationInfo appInfo = info.applicationinfo;            String appName = Packagemanager.getapplicationlabel (appInfo). toString ();            String packagename = appinfo.packagename;  Get the installation package name            String version=info.versionname;       Get version information            drawable icon = Packagemanager.getapplicationicon (appInfo);//Get icon Info        }    }



Android apk Monitor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.