Android 如何获取上次安装的应用程序的名称
我已经编写了一个广播接收器来检测像这样的应用程序安装事件Android 如何获取上次安装的应用程序的名称,android,android-intent,broadcastreceiver,Android,Android Intent,Broadcastreceiver,我已经编写了一个广播接收器来检测像这样的应用程序安装事件 <receiver android:name="ApplicationBroadcastService" > <intent-filter> <action android:name="android.intent.action.PACKAGE_INSTALL" /> <action android:name="android.i
<receiver android:name="ApplicationBroadcastService" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_INSTALL" />
<action android:name="android.intent.action.PACKAGE_ADDED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
现在,我想知道上次安装的应用程序的名称,我该怎么做,谢谢。Intent中的
Uri
(通过getData()
获取)将包含已安装应用程序的包名。然后,您可以使用PackageManager
获取给定软件包名称的应用程序的更多详细信息