Created Broadcastreceiver Which Displays Application Name And Version Number On Install/ Uninstall Of Any Application?
Created BroadcastReceiver which displays application name and version number on install/ uninstall of any application. But i am getting package name through intent.getData(). But
Solution 1:
I followed this example where BroadcastReceiver is introduced as follows;
<receiverandroid:name="PackageChangeReceiver"><intent-filter><actionandroid:name="android.intent.action.PACKAGE_ADDED"/><actionandroid:name="android.intent.action.PACKAGE_REPLACED"/><actionandroid:name="android.intent.action.PACKAGE_REMOVED"/><dataandroid:scheme="package"/></intent-filter></receiver>
Now once PackageChangeReceiver.onReceive(..) is called, Intent.getData() Uri contains something around; package:my.test.package
which is returned by Uri.toString(). For searching this ApplicationInfo using PackageManager you should extract package name only which can be retrieved by Uri.getSchemeSpecificPart()
which should give you my.test.package
only.
Also, based on quick testing, it seems very likely that after package removal there's no ApplicationInfo available anymore.
Post a Comment for "Created Broadcastreceiver Which Displays Application Name And Version Number On Install/ Uninstall Of Any Application?"