{"id":304,"date":"2022-02-23T15:18:04","date_gmt":"2022-02-23T07:18:04","guid":{"rendered":"https:\/\/blog.iichen.cn\/?p=304"},"modified":"2025-01-23T10:54:38","modified_gmt":"2025-01-23T02:54:38","slug":"android-%e9%80%82%e9%85%8d%e6%96%87%e4%bb%b6%e5%ad%98%e5%82%a8","status":"publish","type":"post","link":"https:\/\/iichen.cn\/?p=304","title":{"rendered":"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8"},"content":{"rendered":"<h3>\u4e00\u3001\u8fc1\u79fb<\/h3>\n<pre><code class=\"language-java line-numbers\">\/\/ \u7b80\u8ff0\u6b65\u9aa4\n\/\/ \u5bf9sdcard\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u4ee5\u53ca\u6587\u4ef6\u5939 \u6279\u91cf\u79fb\u52a8\u5230 \u5f53\u524d\u5e94\u7528\u7684\u79c1\u6709\u76ee\u5f55\u4e0b\uff0c\u5982\uff1afiles\u4ee5\u53cacache\u76ee\u5f55\n<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/s2.loli.net\/2022\/02\/23\/6UIDnTKaEWqk5Bt.png'><img class=\"lazyload lazyload-style-11\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/s2.loli.net\/2022\/02\/23\/6UIDnTKaEWqk5Bt.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"android_file_oper.png\" \/><\/div><\/p>\n<h3>\u4e8c\u3001\u9002\u914d\u64cd\u4f5c<\/h3>\n<blockquote>\n<ol>\n<li>AndroidQ\u53ca\u4ee5\u4e0a\u4f7f\u7528 MediaStore\u64cd\u4f5c\u5a92\u4f53\u7b49\u6587\u4ef6\uff0c\u5e76\u4e14\u5e94\u7528\u81ea\u5df1\u6587\u4ef6\u5f52\u7c7b\u4fdd\u5b58\u5728 \u6c99\u76d2\u76ee\u5f55\u5185<br \/>\n  \u5176\u4e2d\u6ce8\u610f Data\u5b57\u6bb5\u7684\u53d8\u5316\u4ee5\u53ca\u64cd\u4f5c\u4fee\u6539\u5176\u4ed6\u5e94\u7528\u7684\u6743\u9650\u7533\u8bf7\u4ee5\u53ca\u6355\u83b7SecurityException\u5f02\u5e38\u8fdb\u884c\u7528\u6237\u6388\u6743\u5904\u7406<\/li>\n<li>AndroidQ\u4e00\u4e0b\u5c31\u6b63\u5e38\u6587\u4ef6\u64cd\u4f5c<\/li>\n<\/ol>\n<\/blockquote>\n<pre><code class=\"language-java line-numbers\">val appFilePath = getExternalFilesDir(null)?.path?:\"\"\nval appImagePath = getExternalFilesDir(Environment.DIRECTORY_DCIM)?.path?:\"\"\nval appCustomPath = getExternalFilesDir(\"Demo\")?.path?:\"\"\nval appCachePath = getExternalCacheDir()?.path?:\"\"\n\n\/\/ \u5982\u679c\u5e94\u7528\u5378\u8f7d\u540e\u53c8\u91cd\u65b0\u5b89\u88c5\uff0c\u5220\u9664\u5378\u8f7d\u4e4b\u524d\u4fdd\u5b58\u7684\u6587\u4ef6\u5c31\u65e0\u6cd5\u76f4\u63a5\u5220\u9664\uff0c\u6216\u8005\u5220\u9664\u5176\u4ed6\u5e94\u7528\u521b\u5efa\u7684\u5a92\u4f53\u6587\u4ef6\u4e5f\u4e0d\u80fd\u76f4\u63a5\u5220\u9664\uff0c\n\/\/ \u6b64\u65f6\u9700\u8981\u7533\u8bf7READ_EXTERNAL_STORAGE\u6743\u9650\uff0c\u5220\u9664\u9700\u8981\u6355\u83b7SecurityException\u5f02\u5e38\n\n\/\/ App\u5378\u8f7d\u540e\uff0c\u5bf9\u5e94\u7684\u6c99\u76d2\u76ee\u5f55\u4e5f\u4f1a\u88ab\u5220\u9664\uff0c\u5982\u679cAPP\u60f3\u8981\u5728\u5378\u8f7d\u65f6\u4fdd\u7559\u6c99\u76d2\u76ee\u5f55\u4e0b\u7684\u6570\u636e\uff0c\u8981\u5728AndroidManifest.xml\u4e2d\u58f0\u660e\n\/\/ android:hasFragileUserData=\"true\"\uff0c\u8fd9\u6837\u5728 APP\u5378\u8f7d\u65f6\u5c31\u4f1a\u6709\u5f39\u51fa\u6846\u63d0\u793a\u7528\u6237\u662f\u5426\u4fdd\u7559\u5e94\u7528\u6570\u636e\n<\/code><\/pre>\n<h3>\u4e09\u3001MediaStore\u64cd\u4f5c<\/h3>\n<blockquote>\n<ol>\n<li>\u901a\u8fc7contentResolve\u7b49\u83b7\u53d6uri,\u5728\u6839\u636euri\u83b7\u53d6\u6587\u4ef6\u63cf\u8ff0\u7b26\uff0c\u6700\u540e\u4f7f\u7528FileOutputStream(pfd.fileDescriptor)\u7b49\u6d41\u5c06\u6570\u636e\u6d41\u8fdb\u884c\u5b58\u53d6\u7b49\u64cd\u4f5c<\/li>\n<li>os = resolver.openOutputStream(insertUri)<\/li>\n<\/ol>\n<\/blockquote>\n<h4>3.1 ContentValues<\/h4>\n<pre><code class=\"language-java line-numbers\">\/**\n * ```\n * values.put(MediaStore.Images.Media.IS_PENDING, isPending)\n * Android Q , MediaStore\u4e2d\u6dfb\u52a0 MediaStore.Images.Media.IS_PENDING flag\uff0c\u7528\u6765\u8868\u793a\u6587\u4ef6\u7684 isPending \u72b6\u6001\uff0c0\u662f\u53ef\u89c1\uff0c\u5176\u4ed6\u4e0d\u53ef\u89c1\n * ```\n * @param displayName \u6587\u4ef6\u540d\n * @param description \u63cf\u8ff0\n * @param mimeType \u5a92\u4f53\u7c7b\u578b\n * @param title \u6807\u9898\n * @param relativePath \u76f8\u5bf9\u8def\u5f84 eg: ${Environment.DIRECTORY_PICTURES}\/xxx\n * @param isPending \u9ed8\u8ba40 , 0\u662f\u53ef\u89c1\uff0c\u5176\u4ed6\u4e0d\u53ef\u89c1\n *\/\n\/\/ val RELATIVE_PATH = \"${Environment.DIRECTORY_PICTURES}${File.separator}img\"\n\/* val values = createContentValues(\n            \"BitmapImage.png\",\n            \"This is an image\",\n            \"image\/png\",\n            \"Image.png\",\n            RELATIVE_PATH,\n            1\n        )\n*\/\nfun createContentValues(\n    displayName: String? = null, description: String? = null, mimeType: String? = null, title: String? = null,\n    relativePath: String? = null, isPending: Int? = 1,\n): ContentValues {\n    return ContentValues().apply {\n        put(MediaStore.Images.Media.DISPLAY_NAME, displayName)\n        put(MediaStore.Images.Media.DESCRIPTION, description)\n        put(MediaStore.Images.Media.MIME_TYPE, mimeType)\n        put(MediaStore.Images.Media.TITLE, title)\n        if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.Q) {\n            put(MediaStore.Images.Media.RELATIVE_PATH, relativePath)\n            put(MediaStore.Images.Media.IS_PENDING, isPending)\n        }\n    }\n}\n<\/code><\/pre>\n<h4>3.2 \u8bbf\u95ee\u5176\u4ed6\u5e94\u7528\u521b\u5efa\u6587\u4ef6\u6743\u9650\u68c0\u67e5<\/h4>\n<pre><code class=\"language-java line-numbers\">when (FileOperator.getContext()\n    .checkUriPermission(uri, android.os.Process.myPid(), android.os.Process.myUid(), Intent.FLAG_GRANT_READ_URI_PERMISSION)) {\n    PackageManager.PERMISSION_GRANTED -&gt; {\n    }\n    PackageManager.PERMISSION_DENIED -&gt; {\n        FileOperator.getContext().grantUriPermission(FileOperator.getApplication().packageName, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION)\n    }\n}   \n<\/code><\/pre>\n<h4>3.3 \u5b8c\u6574\u4f8b\u5b50<\/h4>\n<pre><code class=\"language-java line-numbers\">val imageList = mutableListOf&lt;MediaStoreImage&gt;()\nval external = MediaStore.Images.Media.EXTERNAL_CONTENT_URI\n\nval cursor: Cursor?\ntry {\n    cursor = createMediaCursor(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projectionArgs, sortOrder, querySelectionStatement)\n    FileLogger.i(\"Found ${cursor?.count} images\")\n\n    cursor?.use {\n        \/\/ Cache column indices.\n        val idColumn = it.getColumnIndexOrThrow(MediaStore.Images.Media._ID)\n        val nameColumn = it.getColumnIndexOrThrow(MediaStore.Images.Media.DISPLAY_NAME)\n        val sizeColumn = it.getColumnIndexOrThrow(MediaStore.Images.Media.SIZE)\n        val descColumn = it.getColumnIndexOrThrow(MediaStore.Images.Media.DESCRIPTION)\n        val titleColumn = it.getColumnIndexOrThrow(MediaStore.Images.Media.TITLE)\n        val mimeColumn = it.getColumnIndexOrThrow(MediaStore.Images.Media.MIME_TYPE)\n        val dateModifiedColumn = it.getColumnIndexOrThrow(MediaStore.Images.Media.DATE_ADDED)\n\n        while (it.moveToNext()) { \/\/moveToFirst  moveToNext\n            val id = it.getLong(idColumn)\n            val name = it.getString(nameColumn)\n            val size = it.getInt(sizeColumn)\n            val desc = it.getString(descColumn)\n            val titleRs = it.getString(titleColumn)\n            val mimeTypeRs = it.getString(mimeColumn)\n            val dateModified = Date(TimeUnit.SECONDS.toMillis(it.getLong(dateModifiedColumn)))\n\n            val contentUri: Uri = ContentUris.withAppendedId(external, id)\n            imageList += MediaStoreImage(\n                id, contentUri, name, size.toLong(),\n                desc, titleRs, mimeTypeRs, dateModified\n            )\n        }\n        if (imageList.isNullOrEmpty()) {\n            FileLogger.e(\"\u67e5\u8be2\u5931\u8d25!\")\n        }\n        imageList.let { l -&gt;\n            l.forEach { img -&gt;\n                FileLogger.d(\"\u67e5\u8be2\u6210\u529f\uff0cUri\u8def\u5f84  ${img.uri}\")\n            }\n        }\n    }\n    return imageList\n} catch (e: Exception) {\n    FileLogger.e(\"\u67e5\u8be2\u5931\u8d25! ${e.message}\")\n}\n\n\nfun createMediaCursor(\n    uri: Uri, projectionArgs: Array&lt;String&gt;? = arrayOf(MediaStore.Video.Media._ID),\n    sortOrder: String? = null, querySelectionStatement: FileGlobal.QuerySelectionStatement? = null,\n): Cursor? {\n    \/\/ Need the READ_EXTERNAL_STORAGE permission if accessing video files that your app didn't create.\n    when (FileOperator.getContext()\n        .checkUriPermission(uri, android.os.Process.myPid(), android.os.Process.myUid(), Intent.FLAG_GRANT_READ_URI_PERMISSION)) {\n        PackageManager.PERMISSION_GRANTED -&gt; {\n        }\n        PackageManager.PERMISSION_DENIED -&gt; {\n            FileOperator.getContext().grantUriPermission(FileOperator.getApplication().packageName, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION)\n        }\n    }\n\n    return FileOperator.getContext().contentResolver.query(\n        uri, projectionArgs,\n        querySelectionStatement?.selection.toString(),\n        querySelectionStatement?.selectionArgs?.toTypedArray(),\n        sortOrder\n    )\n}\n<\/code><\/pre>\n<h3>\u56db\u3001SAF\u64cd\u4f5c<\/h3>\n<blockquote><p>\n  \u66f4\u591a\u67e5\u770b\u6e90\u7801\n<\/p><\/blockquote>\n<h4>4.1 \u9009\u62e9\u6587\u4ef6<\/h4>\n<pre><code class=\"language-java line-numbers\">fun selectFile(activity: Activity, mimeType: String, requestCode: Int) {\n    val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {\n        addCategory(Intent.CATEGORY_OPENABLE)\n        type = mimeType\n    }\n    activity.startActivityForResult(intent, requestCode)\n}\n\n\nselectFile(activity, \"image\/*\", requestCode)\n<\/code><\/pre>\n<h3>\u4e94\u3001Uri<\/h3>\n<h4>5.1 \u6587\u4ef6\u63cf\u8ff0\u7b26<\/h4>\n<pre><code class=\"language-java line-numbers\">\u901a\u8fc7\u6587\u4ef6\u63cf\u8ff0\u7b26\u65b9\u4f4duri\n var pfd: ParcelFileDescriptor? = null\n    try {\n        pfd = contentResolver.openFileDescriptor(queryUri!!, \"r\")\n        if (pfd != null) {\n            val bitmap = BitmapFactory.decodeFileDescriptor(pfd.fileDescriptor)\n            imageIv.setImageBitmap(bitmap)\n        }\n    } catch (e: IOException) {\n        e.printStackTrace()\n    } finally {\n        pfd?.close()\n    }\n\n\u5728Android Q\u4ee5\u4e0b\u53ea\u4f7f\u7528DATA\u5b57\u6bb5\uff0cAndroid Q\u53ca\u4ee5\u4e0a\u4e0d\u4f7f\u7528DATA\u5b57\u6bb5\uff0c\u6539\u4e3a\u4f7f\u7528RELATEIVE_PATH\u5b57\u6bb5\n<\/code><\/pre>\n<h4>5.2 \u68c0\u67e5uri\u6709\u6548\u6027<\/h4>\n<pre><code class=\"language-java line-numbers\">fun checkUri(uri: Uri?): Boolean {\n    if (uri == null) return false\n    val resolver = FileOperator.getContext().contentResolver\n\n    \/\/1. Check Uri\n    var cursor: Cursor? = null\n    val isUriExist: Boolean = try {\n        cursor = resolver.query(uri, null, null, null, null)\n        \/\/cursor null: content Uri was invalid or some other error occurred\n        \/\/cursor.moveToFirst() false: Uri was ok but no entry found.\n        (cursor != null &amp;&amp; cursor.moveToFirst())\n    } catch (t: Throwable) {\n        FileLogger.e(\"1.Check Uri Error: ${t.message}\")\n        false\n    } finally {\n        try {\n            cursor?.close()\n        } catch (t: Throwable) {\n        }\n    }\n\n    \/\/2. Check File Exist\n    \/\/\u5982\u679c\u7cfb\u7edf db \u5b58\u6709 Uri \u76f8\u5173\u8bb0\u5f55, \u4f46\u662f\u6587\u4ef6\u5931\u6548\u6216\u8005\u635f\u574f (If the system db has Uri related records, but the file is invalid or damaged)\n    var ins: InputStream? = null\n    val isFileExist: Boolean = try {\n        ins = resolver.openInputStream(uri)\n        \/\/ file exists\n        true\n    } catch (t: Throwable) {\n        \/\/ File was not found eg: open failed: ENOENT (No such file or directory)\n        FileLogger.e(\"2. Check File Exist Error: ${t.message}\")\n        false\n    } finally {\n        try {\n            ins?.close()\n        } catch (t: Throwable) {\n        }\n    }\n    return isUriExist &amp;&amp; isFileExist\n}\n<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/s2.loli.net\/2022\/02\/23\/wX1EeBHNJlC4zLn.png'><img class=\"lazyload lazyload-style-11\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/s2.loli.net\/2022\/02\/23\/wX1EeBHNJlC4zLn.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"android_mediastore.png\" \/><\/div><\/p>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/github.com\/javakam\/FileOperator\" title=\"FileOperator\">\u6e90\u7801\u5730\u5740\uff1aFileOperator<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u8fc1\u79fb \/\/ \u7b80\u8ff0\u6b65\u9aa4 \/\/ \u5bf9sdcard\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u4ee5\u53ca\u6587\u4ef6\u5939 \u6279\u91cf\u79fb\u52a8\u5230 \u5f53\u524d\u5e94\u7528\u7684\u79c1\u6709\u76ee\u5f55\u4e0b\uff0c\u5982\uff1af [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,8],"tags":[],"class_list":["post-304","post","type-post","status-publish","format-standard","hentry","category-android","category-8"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8 - IIchen<\/title>\n<meta name=\"description\" content=\"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/iichen.cn\/?p=304\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8 - IIchen\" \/>\n<meta property=\"og:description\" content=\"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8\" \/>\n<meta property=\"og:url\" content=\"https:\/\/iichen.cn\/?p=304\" \/>\n<meta property=\"og:site_name\" content=\"IIchen\" \/>\n<meta property=\"article:published_time\" content=\"2022-02-23T07:18:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-23T02:54:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/s2.loli.net\/2022\/02\/23\/6UIDnTKaEWqk5Bt.png\" \/>\n<meta name=\"author\" content=\"iichen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"iichen\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/iichen.cn\/?p=304#article\",\"isPartOf\":{\"@id\":\"https:\/\/iichen.cn\/?p=304\"},\"author\":{\"name\":\"iichen\",\"@id\":\"https:\/\/iichen.cn\/#\/schema\/person\/4a47edf85ab49841df9e8f6aee40b77c\"},\"headline\":\"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8\",\"datePublished\":\"2022-02-23T07:18:04+00:00\",\"dateModified\":\"2025-01-23T02:54:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/iichen.cn\/?p=304\"},\"wordCount\":22,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/iichen.cn\/#\/schema\/person\/4a47edf85ab49841df9e8f6aee40b77c\"},\"image\":{\"@id\":\"https:\/\/iichen.cn\/?p=304#primaryimage\"},\"thumbnailUrl\":\"https:\/\/s2.loli.net\/2022\/02\/23\/6UIDnTKaEWqk5Bt.png\",\"articleSection\":[\"Android\",\"\u7b14\u8bb0\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/iichen.cn\/?p=304#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/iichen.cn\/?p=304\",\"url\":\"https:\/\/iichen.cn\/?p=304\",\"name\":\"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8 - IIchen\",\"isPartOf\":{\"@id\":\"https:\/\/iichen.cn\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/iichen.cn\/?p=304#primaryimage\"},\"image\":{\"@id\":\"https:\/\/iichen.cn\/?p=304#primaryimage\"},\"thumbnailUrl\":\"https:\/\/s2.loli.net\/2022\/02\/23\/6UIDnTKaEWqk5Bt.png\",\"datePublished\":\"2022-02-23T07:18:04+00:00\",\"dateModified\":\"2025-01-23T02:54:38+00:00\",\"description\":\"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8\",\"breadcrumb\":{\"@id\":\"https:\/\/iichen.cn\/?p=304#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/iichen.cn\/?p=304\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/iichen.cn\/?p=304#primaryimage\",\"url\":\"https:\/\/s2.loli.net\/2022\/02\/23\/6UIDnTKaEWqk5Bt.png\",\"contentUrl\":\"https:\/\/s2.loli.net\/2022\/02\/23\/6UIDnTKaEWqk5Bt.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/iichen.cn\/?p=304#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/iichen.cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/iichen.cn\/#website\",\"url\":\"https:\/\/iichen.cn\/\",\"name\":\"IIchen\",\"description\":\"Just do it!\",\"publisher\":{\"@id\":\"https:\/\/iichen.cn\/#\/schema\/person\/4a47edf85ab49841df9e8f6aee40b77c\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/iichen.cn\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/iichen.cn\/#\/schema\/person\/4a47edf85ab49841df9e8f6aee40b77c\",\"name\":\"iichen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/iichen.cn\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/iichen.cn\/wp-content\/uploads\/2025\/01\/avatar.jpg\",\"contentUrl\":\"https:\/\/iichen.cn\/wp-content\/uploads\/2025\/01\/avatar.jpg\",\"width\":940,\"height\":940,\"caption\":\"iichen\"},\"logo\":{\"@id\":\"https:\/\/iichen.cn\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/www.iichen.cn\"],\"url\":\"https:\/\/iichen.cn\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8 - IIchen","description":"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/iichen.cn\/?p=304","og_locale":"zh_CN","og_type":"article","og_title":"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8 - IIchen","og_description":"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8","og_url":"https:\/\/iichen.cn\/?p=304","og_site_name":"IIchen","article_published_time":"2022-02-23T07:18:04+00:00","article_modified_time":"2025-01-23T02:54:38+00:00","og_image":[{"url":"https:\/\/s2.loli.net\/2022\/02\/23\/6UIDnTKaEWqk5Bt.png","type":"","width":"","height":""}],"author":"iichen","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"iichen","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/iichen.cn\/?p=304#article","isPartOf":{"@id":"https:\/\/iichen.cn\/?p=304"},"author":{"name":"iichen","@id":"https:\/\/iichen.cn\/#\/schema\/person\/4a47edf85ab49841df9e8f6aee40b77c"},"headline":"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8","datePublished":"2022-02-23T07:18:04+00:00","dateModified":"2025-01-23T02:54:38+00:00","mainEntityOfPage":{"@id":"https:\/\/iichen.cn\/?p=304"},"wordCount":22,"commentCount":0,"publisher":{"@id":"https:\/\/iichen.cn\/#\/schema\/person\/4a47edf85ab49841df9e8f6aee40b77c"},"image":{"@id":"https:\/\/iichen.cn\/?p=304#primaryimage"},"thumbnailUrl":"https:\/\/s2.loli.net\/2022\/02\/23\/6UIDnTKaEWqk5Bt.png","articleSection":["Android","\u7b14\u8bb0"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/iichen.cn\/?p=304#respond"]}]},{"@type":"WebPage","@id":"https:\/\/iichen.cn\/?p=304","url":"https:\/\/iichen.cn\/?p=304","name":"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8 - IIchen","isPartOf":{"@id":"https:\/\/iichen.cn\/#website"},"primaryImageOfPage":{"@id":"https:\/\/iichen.cn\/?p=304#primaryimage"},"image":{"@id":"https:\/\/iichen.cn\/?p=304#primaryimage"},"thumbnailUrl":"https:\/\/s2.loli.net\/2022\/02\/23\/6UIDnTKaEWqk5Bt.png","datePublished":"2022-02-23T07:18:04+00:00","dateModified":"2025-01-23T02:54:38+00:00","description":"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8","breadcrumb":{"@id":"https:\/\/iichen.cn\/?p=304#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/iichen.cn\/?p=304"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/iichen.cn\/?p=304#primaryimage","url":"https:\/\/s2.loli.net\/2022\/02\/23\/6UIDnTKaEWqk5Bt.png","contentUrl":"https:\/\/s2.loli.net\/2022\/02\/23\/6UIDnTKaEWqk5Bt.png"},{"@type":"BreadcrumbList","@id":"https:\/\/iichen.cn\/?p=304#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/iichen.cn\/"},{"@type":"ListItem","position":2,"name":"Android-\u9002\u914d\u6587\u4ef6\u5b58\u50a8"}]},{"@type":"WebSite","@id":"https:\/\/iichen.cn\/#website","url":"https:\/\/iichen.cn\/","name":"IIchen","description":"Just do it!","publisher":{"@id":"https:\/\/iichen.cn\/#\/schema\/person\/4a47edf85ab49841df9e8f6aee40b77c"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/iichen.cn\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/iichen.cn\/#\/schema\/person\/4a47edf85ab49841df9e8f6aee40b77c","name":"iichen","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/iichen.cn\/#\/schema\/person\/image\/","url":"https:\/\/iichen.cn\/wp-content\/uploads\/2025\/01\/avatar.jpg","contentUrl":"https:\/\/iichen.cn\/wp-content\/uploads\/2025\/01\/avatar.jpg","width":940,"height":940,"caption":"iichen"},"logo":{"@id":"https:\/\/iichen.cn\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.iichen.cn"],"url":"https:\/\/iichen.cn\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/iichen.cn\/index.php?rest_route=\/wp\/v2\/posts\/304","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iichen.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iichen.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iichen.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iichen.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=304"}],"version-history":[{"count":1,"href":"https:\/\/iichen.cn\/index.php?rest_route=\/wp\/v2\/posts\/304\/revisions"}],"predecessor-version":[{"id":738,"href":"https:\/\/iichen.cn\/index.php?rest_route=\/wp\/v2\/posts\/304\/revisions\/738"}],"wp:attachment":[{"href":"https:\/\/iichen.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iichen.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iichen.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}