@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Toast.makeText(context, "Package Received", Toast.LENGTH_SHORT).show();
Log.d("Package Installing", "Package Installing");
String action=intent.getAction();
if(action.equals(intent.ACTION_PACKAGE_INSTALL))
{
Toast.makeText(context, "Package Added", Toast.LENGTH_SHORT).show();
Log.d("Package INstalling", "Package Installed");
}
}
//我的清单文件:
<receiver android:name="com.example.anotherbroadcastreceiverexample.MyReceiver" android:enabled="true">
<intent-filter><action android:name="android.intent.action.PACKAGE_INSTALL"/></intent-filter>
</receiver>