从BroadcastReceiver获取新安装的应用程序:onReceive

时间:2013-02-15 00:00:55

标签: android

我是否可以通过BroadcastReceiver onReceive方法获取新安装的应用程序。

public class PackageAddedReceiver extends BroadcastReceiver {

public void onReceive(Context context, Intent intent) {

    Toast.makeText(context, "Package Installed: ", Toast.LENGTH_LONG).show();

}
}

我已将过滤器设置为:

<receiver android:name=".receiver.PackageAddedReceiver" android:label="Package added Receiver">
    <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>

那么获得新安装的Package信息的最佳方法是什么?

感谢。

0 个答案:

没有答案