hex*_*ron 11 android package broadcastreceiver android-intent
当我的Android应用程序被删除时,我还想删除应用程序在SD卡上创建的文件,因为这些文件可能消耗许多兆字节,并且仅用于我的应用程序.
似乎接收PACKAGE REMOVED意图将是这样做的地方.但是,我的广播接收器从未被调用 - 它似乎在发送PACKAGE REMOVED意图之前被删除了
代码是:
public class UninstallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String action= intent.getAction();
Log.i("U", "ACTION " + action);
etc.
}
}
并且,在清单中:
<application android:debuggable="true"
android:icon="@drawable/icon"
android:label="@string/app_name">
<receiver android:name ="com.boom.UninstallReceiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
<data android:scheme="package" />
</intent-filter>
</receiver>
| 归档时间: |
|
| 查看次数: |
15413 次 |
| 最近记录: |