我看过这篇文章 。然后我尝试制作一个示例来在安装应用程序时捕获事件
这是我的代码`
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AppInstalled appInstalled = new AppInstalled();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
intentFilter.addDataScheme("package");
registerReceiver(appInstalled, intentFilter);
}
private class AppInstalled extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(SplashActivity.this, "Application Installed", Toast.LENGTH_SHORT).show();
}
}`
但它从不显示消息。请给我一些建议