简体   繁体   中英

Android: How to get the installed App information using Broadcast receiver

I am new to android. I am using a Broadcast receiver which listens when a app is installed or removed.. When a app is installed or removed my Broadcast Receivers's onReceive(context,intent) will be called.. Now i need to get the info about the application installed or removed (Mainly the package name)..

Plz help

You can try this receiver and permission. (But this seem only work in /system/app)^^"

<receiver
    android:name="com.your.receiver"
    android:enabled="true"
    android:exported="true" >
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_ADDED" />
                <action android:name="android.intent.action.PACKAGE_REMOVED" />
                    <data android:scheme="package"/> 
                </intent-filter>
 </receiver>
 <uses-permission android:name="android.permission.BROADCAST_PACKAGE_REMOVED" />

All the information you want is in the Intent extras.

Look at How to find the package name which has been uninstalled when using Intent.ACTION_PACKAGE_REMOVED

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM