HarmonyOS 清除应用缓存有相关Api或者文档吗?

1,清除应用缓存有相关Api或者文档吗?

2,有相关跳转到手机系统打开通知权限的Api及方法?

HarmonyOS
2024-12-27 16:31:04
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
Excelsior_abit

1.清理缓存目前没有api实现。可以通过获取应用沙箱目录下的缓存文件夹路径(/data/storage/el1/base/cache /data/storage/el1/base/haps/entry/cache /data/storage/el2/base/cache /data/storage/el2/base/haps/entry/cache)并删除来实现缓存清理。

2.从应用中跳转至的系统手机权限,可以参考如下demo来实现:

import common from '@ohos.app.ability.common';
@Entry
@Component
struct Index {
  build() {
    Row() {
      Column() {
        Button("跳转到设置").onClick(() => {
          let context = getContext(this) as common.UIAbilityContext;
          context.startAbility({
            bundleName: 'com.huawei.hmos.settings',
            abilityName: 'com.huawei.hmos.settings.MainAbility',
          });
        })

        Button("to蓝牙").onClick(() => {
          let context = getContext(this) as common.UIAbilityContext;
          context.startAbility({
            bundleName: 'com.huawei.hmos.settings',
            abilityName: 'com.huawei.hmos.settings.MainAbility', // com.huawei.hmos.settings.AppInfoAbility
            uri: "bluetooth_entry", //application_settings application_info_entry
          });
        })

        Button("toWLAN页面").onClick(() => {
          let context = getContext(this) as common.UIAbilityContext;
          context.startAbility({
            bundleName: 'com.huawei.hmos.settings',
            abilityName: 'com.huawei.hmos.settings.MainAbility', // com.huawei.hmos.settings.AppInfoAbility
            uri: "wifi_entry", //application_settings application_info_entry
          });
        })

        Button("to应用信息")
          .onClick(()=> {
            let context = getContext(this) as common.UIAbilityContext;
            context.startAbility({ bundleName: 'com.huawei.hmos.settings',
              abilityName: 'com.huawei.hmos.settings.MainAbility',// com.huawei.hmos.settings.AppInfoAbility
              uri: 'application_info_entry', //application_settings application_info_entry
              parameters: { pushParams: 'com.example.test' // 应用包名com.example.tosettingdemo
              } }); })
      }
      .width('100%')
    }
    .height('100%')
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
分享
微博
QQ
微信
回复
2024-12-27 18:19:42


相关问题
HarmonyOS 如何清除应用缓存
592浏览 • 1回复 待解决
HarmonyOS如何清除应用缓存
664浏览 • 0回复 待解决
HarmonyOS 清空缓存文档或者代码
844浏览 • 1回复 待解决
HarmonyOS怎么清除当前应用缓存
2568浏览 • 1回复 待解决
HarmonyOS 有没有清除通知相关API
997浏览 • 1回复 待解决
本地缓存和分布式缓存有什么不同?
3561浏览 • 1回复 待解决
如何通过命令号清除应用缓存
2985浏览 • 1回复 待解决
HarmonyOS 清除Web缓存
1411浏览 • 0回复 待解决
HarmonyOS 清除缓存功能
1314浏览 • 1回复 待解决
HarmonyOS 清除app缓存
714浏览 • 1回复 待解决
HarmonyOS 关于获取缓存清除缓存
543浏览 • 1回复 待解决
HarmonyOS web清除缓存问题
907浏览 • 1回复 待解决
flutter缓存如何清除
966浏览 • 1回复 待解决
HarmonyOS 如何清除Web缓存
642浏览 • 1回复 待解决
HarmonyOS web缓存清除localStorage
685浏览 • 1回复 待解决
HarmonyOS 清除APP缓存的问题
586浏览 • 1回复 待解决
HarmonyOS Web如何实现清除缓存
1401浏览 • 1回复 待解决
HarmonyOS 清除缓存不起作用
615浏览 • 1回复 待解决
HarmonyOS 开发清除缓存功能实现方法
758浏览 • 1回复 待解决