相关疑难解决方法(0)

Android:在卸载时从外部存储中删除应用相关文件?

如果我正在编写的应用程序将一些文件永久存储到外部存储器(因此它们在应用程序退出[已销毁]后仍然存在)会很方便,但是在卸载时我想做一些体面的事情并拥有这些删除文件以释放存储空间.

有没有办法在卸载时删除这些文件?

如果没有(并且我持怀疑态度),那么我每次都必须创建这些文件.我试图节省启动时间,并通过永久存在来占用所需的空间.

注意:我需要使用外部存储,因此内部存储或数据库都不合适.

storage android uninstall external

9
推荐指数
2
解决办法
7175
查看次数

卸载Android应用程序时,不会从主屏幕删除应用程序启动器图标

我正在使用类似的代码片段,如下所示在主屏幕上添加应用程序快捷方式:

    Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
    shortcutIntent.setClassName(this, this.getClass().getName());
    shortcutIntent.putExtra(EXTRA_KEY, "ApiDemos Provided This Shortcut");

    // Then, set up the container intent (the response to the caller)

    Intent intent = new Intent();
    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.shortcut_name));
    Parcelable iconResource = Intent.ShortcutIconResource.fromContext(
            this,  R.drawable.app_sample_code);
    intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);

    // Now, return the result to the launcher

    setResult(RESULT_OK, intent);
Run Code Online (Sandbox Code Playgroud)

创建快捷方式没有问题,但在卸载应用程序时,快捷方式仍保留在主屏幕上.卸载其他应用程序时,他们似乎也删除了相应的主屏幕快捷方式.这是我尝试使用"创建代码快捷方式图标"实现的目标

Stackoverflow上的任何Android专家是否都知道在卸载应用程序时从主屏幕删除应用程序快捷方式需要什么?

我发现了一些相关的线程,但它们没有为我提供解决方案,但请随时赶上:

[0] https://developer.android.com/intl/de/resources/samples/ApiDemos/src/com/example/android/apis/app/LauncherShortcuts.html

[1] 在Android中以编程方式从启动器中删除应用程序

[2] 如何在卸载时自动从主屏幕删除应用程序快捷方式?

icons android uninstall

7
推荐指数
1
解决办法
3693
查看次数

标签 统计

android ×2

uninstall ×2

external ×1

icons ×1

storage ×1