我使用https://stackoverflow.com/a/14353076/1327384来更新我的 android 程序,但是在更新我的程序后它将被关闭,所以我想在完成更新过程后重新打开它,我该怎么做?
我用过这个类
package services;
public class PackageChangeReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context ctx, Intent intent) {
Uri data = intent.getData();
boolean replacing = intent.getBooleanExtra(Intent.EXTRA_REPLACING, false);
Intent intent1 = new Intent(ctx, service.class);
ctx.startService(intent1);
Log.d("service", "Action: " + intent.getAction());
Log.d("service", "The DATA: " + data);
}
}
和这个主要的
<receiver android:name="services.PackageChangeReceiver" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<action android:name="android.intent.action.PACKAGE_ADDED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
但我手动启动应用程序后仍然收到意图