当前位置: 首页 > news >正文

石家庄网站建设电话/网拍外宣怎么推广

石家庄网站建设电话,网拍外宣怎么推广,回收手表网站,做厂房出租有那些推广网站适配7.0 文件共享方式1、首先再res目录下创建xml文件夹 并且在xml文件夹创建fileFrovider的path文件,文件名自定义随意取文件内容如下,属性解释:paths :路径根节点 所有的path都写在里面子节点:五项分别对应代码中为代表 context.…

适配7.0 文件共享方式

1、首先再res目录下创建xml文件夹 并且在xml文件夹创建fileFrovider的path文件,文件名自定义随意取

文件内容如下,属性解释:

paths :路径根节点 所有的path都写在里面

子节点:五项分别对应代码中为

代表 context.getFileDir()

代表 context.getCacheDir()

代表 Environment.getExternalStorageDirectory()

代表 context.getExternalFilesDir()

代表 getExternalCacheDir()

name:名字随意取,获取uri是会被转换成cotent的uri 把这里的name值作为uri的一部分,我们用不到,所以不需要太多关注,主要是path属性

path:是文件的路径 .是根路径 字符串则是代表文件夹 譬如:path=“aaa” 那么就代表的是该路径下的aaa文件夹

name="fileDir"

path="."/>

name="filePath"

path="."

/>

name="sdcard_root_externalStorageDirectory"

path="updateFile"/>

对应的java代码

public class StorageUtils {

/*

* context.getCacheDir()和context.getExternalCacheDir()

* 目录的路径不同。

* 前者的目录存在外部SD卡上的。在手机里可以直接看到

* 后者的目录存在app的内部存储上,需要root以后,用Root Explorer 文件管理器才能看到

*/

/**

*

* name="fileDir"

* path="."/>

*/

public static File getFileDir(Context context) {

File appCacheDir = context.getFilesDir();

if (appCacheDir == null) {

Log.w("StorageUtils", "Can't define system cache directory! The app should be re-installed.");

}

return appCacheDir;

}

/**

*

* name="filePath"

* path="."

* />

*/

public static File getExternalFilesDir(Context context) {

File appCacheDir = context.getExternalFilesDir(null);

if (appCacheDir == null) {

Log.w("StorageUtils", "Can't define system cache directory! The app should be re-installed.");

}

return appCacheDir;

}

/**

*

* name="cache-path"

* path="." />

* 获取应用的缓存目录

* 路径需要root以后,用Root Explorer 文件管理器才能看到

*/

public static File getCacheDirectory(Context context) {

File appCacheDir = context.getCacheDir();

if (appCacheDir == null) {

Log.w("StorageUtils", "Can't define system cache directory! The app should be re-installed.");

}

return appCacheDir;

}

/**

*

* name="external-cache-path"

* path="." />

* 获取应用的缓存目录 路径在手机里可以直接看到

* apk下载路径为:SDCard/Android/data/com.winfo.update/cache/

*/

public static File getExternalCacheDirectory(Context context) {

File appCacheDir = context.getExternalCacheDir();

if (appCacheDir == null) {

Log.w("StorageUtils", "Can't define system cache directory! The app should be re-installed.");

}

return appCacheDir;

}

/**

*

* name="external-cache-path"

* path="." />

* 在cache下新增自定义缓存路径

* apk下载路径为:SDCard/Android/data/com.winfo.update/cache/update/

*/

public static File getExternalCacheCustomDirectory(Context context) {

//在SDCard/Android/data/com.winfo.update/cache/update创建文件夹

File appCacheDir = new File(context.getExternalCacheDir(), "update");

//如果不存在就创建

if (!appCacheDir.exists()) {

if (appCacheDir.mkdirs()) {//创建成功就返回SDCard/Android/data/com.winfo.update/cache/update/

return appCacheDir;

} else {

//创建失败就返回默认的SDCard/Android/data/com.winfo.update/cache/

return context.getExternalCacheDir();

}

} else {

//存在直接返回

return appCacheDir;

}

}

/**

*

* name="sdcard_root_externalStorageDirectory"

* path="updateFile"/>

* 在cache下新增自定义缓存路径

* apk下载路径为:/storage/emulated/0/updateFile/weixin667android1320.apk

*/

public static File getExternalCustomDirectory() {

//在SDCard/Android/data/com.winfo.update/cache/update创建文件夹

File dir = new File(Environment.getExternalStorageDirectory(), "updateFile");

//如果不存在就创建

if (!dir.exists()) {

if (dir.mkdirs()) {

return dir;

} else {

//创建失败就返回默认的SDCard/Android/data/com.winfo.update/cache/

return Environment.getExternalStorageDirectory();

}

} else {

//存在直接返回

return dir;

}

}

}

示例:安装APK

/**

* 获取安装文件意图

* @param context context

* @param apkFile 安装文件

* @return 安装意图

*/

private static Intent getApkInStallIntent(Context context, File apkFile) {

Intent intent = new Intent(Intent.ACTION_VIEW);

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {

Uri uri = FileProvider.getUriForFile(context, "com.winfo.update.provider", apkFile);

intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

intent.setDataAndType(uri, "application/vnd.android.package-archive");

} else {

Uri uri = getApkUri(apkFile);

intent.setDataAndType(uri, "application/vnd.android.package-archive");

}

return intent;

}

manifest注册

android:name="android.support.v4.content.FileProvider"

android:authorities="com.winfo.update.provider" 自定义名称会作为uri的一部分

android:exported="false"

android:grantUriPermissions="true">

android:name="android.support.FILE_PROVIDER_PATHS"

android:resource="@xml/update_apk_paths" /> xml文件夹下的paths文件

http://www.lbrq.cn/news/945469.html

相关文章:

  • 做淘宝客网站的流程/怎么自己做网站
  • 网站怎么做才可以做评价/seoyoon
  • 备案时填写 网站内容/网络推广软文范文
  • 建站行业严重产能过剩/微博推广平台
  • 网站做可信认证多少钱/网站排名软件
  • 顺义做网站的公司/产品市场营销策划方案
  • 有什么网站专门做美食的吗/seo收费还是免费
  • 左权网站建设/seo教程优化
  • 做微信商城网站/郑州seo方案
  • 网站公司怎么做运营/三叶草gy5987
  • 学怎么做建筑标书哪个网站/自动外链工具
  • 给企业做网站挣钱吗/seo网站优化推广费用
  • 济南市城乡建设委员会网站电话/seo搜索优化待遇
  • 日照市建设局网站/网络推广员岗位职责
  • wordpress分类目录添加报错_标签不能添加/东莞seo整站优化
  • 怎么用wordpress做网站/百度网首页登录入口
  • 磁力链/四川百度推广和seo优化
  • 常州个人网站建设/刚刚北京传来重大消息
  • 哪有做网站的/百度热搜关键词
  • 宜兴网站开发/郑州粒米seo顾问
  • 山东做网站建设的好公司排名/微信公众号推广软文案例
  • 石家庄建站模板厂家/谷歌google下载
  • 网站建设需要在网络上如何实现/台州网站优化公司
  • 河南省住房和城乡建设厅网站/宁波优化网站哪家好
  • 云主机 怎么做网站/制作网页的网站
  • 苏州网络销售公司/长沙靠谱的关键词优化
  • 杭州高端定制网站/seo优化多少钱
  • 创意生日礼物定制/seo自动工具
  • 永康网站建设/广西seo经理
  • 自己做网站做那种类型/厦门站长优化工具
  • python 检测蜂窝网络,实现掉网自动拨号
  • 【C++】定义常量
  • C语言指针初步(4)-用void指针模拟qsort函数方法
  • 汽车免拆诊断案例 | 2010款奔驰E200 CGI车EPS OFF灯异常点亮
  • Linux下使用VSCode配置GCC环境与调试指南
  • 优选算法:移动零