{"id":305889,"date":"2024-05-20T19:57:04","date_gmt":"2024-05-20T11:57:04","guid":{"rendered":""},"modified":"2024-05-20T19:57:18","modified_gmt":"2024-05-20T11:57:18","slug":"android-%e7%b3%bb%e7%bb%9f%e7%bc%96%e7%a8%8b%e4%b8%ad%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0-router-%e8%b7%af%e7%94%b1%e6%a1%86%e6%9e%b6","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/305889.html","title":{"rendered":"android \u7cfb\u7edf\u7f16\u7a0b\u4e2d\u5982\u4f55\u5b9e\u73b0 Router \u8def\u7531\u6846\u67b6"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/26222152\/a4d31c85-7510-4e25-82d4-7f5803fef9d5.webp\" alt=\"android \u7cfb\u7edf\u7f16\u7a0b\u4e2d\u5982\u4f55\u5b9e\u73b0 Router \u8def\u7531\u6846\u67b6\" \/><\/p>\n<p><p><strong>Android\u7cfb\u7edf\u7f16\u7a0b\u4e2d\u5b9e\u73b0Router\u8def\u7531\u6846\u67b6\u7684\u65b9\u6cd5\u4e3b\u8981\u5305\u62ec\u4ee5\u4e0b\u51e0\u70b9\uff1a\u4f7f\u7528\u6ce8\u89e3\u5904\u7406\u5668\u81ea\u52a8\u751f\u6210\u8def\u7531\u8868\u3001\u6784\u5efa\u7edf\u4e00\u7684\u8def\u7531\u8df3\u8f6c\u63a5\u53e3\u3001\u652f\u6301\u62e6\u622a\u5668\u5904\u7406\u8df3\u8f6c\u903b\u8f91\u3001\u5141\u8bb8\u81ea\u5b9a\u4e49\u8def\u7531\u7b56\u7565<\/strong>\u3002\u8be6\u7ec6\u5730\u8bf4\uff0c\u8def\u7531\u8868\u7684\u81ea\u52a8\u751f\u6210\u53ef\u4ee5\u663e\u8457\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\uff0c\u907f\u514d\u624b\u52a8\u914d\u7f6e\u6240\u5e26\u6765\u7684\u9519\u8bef\u3002\u6ce8\u89e3\u5904\u7406\u5668\u5728\u7f16\u8bd1\u65f6\u626b\u63cf\u7279\u5b9a\u7684\u6ce8\u89e3\uff0c\u751f\u6210\u8def\u7531\u8868\uff0c\u8fd9\u6837\u4e00\u6765\uff0c\u5f53\u5e94\u7528\u542f\u52a8\u65f6\uff0c\u8def\u7531\u6846\u67b6\u5c31\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u8fd9\u4e2a\u9884\u5148\u751f\u6210\u7684\u8def\u7531\u8868\u6765\u8fdb\u884c\u9875\u9762\u5bfc\u822a\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u7406\u89e3\u8def\u7531\u6846\u67b6\u7684\u6982\u5ff5<\/h3>\n<\/p>\n<p><p><strong>\u8def\u7531\uff08Router\uff09\u6846\u67b6<\/strong> \u5728Android\u4e2d\u901a\u5e38\u88ab\u7528\u4e8e\u9875\u9762\u4e4b\u95f4\u7684\u8df3\u8f6c\u7ba1\u7406\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u79cd\u89e3\u8026\u9875\u9762\u95f4\u8df3\u8f6c\u7684\u65b9\u5f0f\u3002\u5728\u6ca1\u6709\u8def\u7531\u6846\u67b6\u4e4b\u524d\uff0c\u9875\u9762\u8df3\u8f6c\u901a\u5e38\u9700\u8981\u663e\u793a\u5730\u58f0\u660eIntent\uff0c\u5e76\u6307\u5b9a\u76ee\u6807Activity\u3002\u8fd9\u6837\u505a\u7684\u7f3a\u70b9\u5728\u4e8e\uff0c\u8df3\u8f6c\u903b\u8f91\u4e0e\u9875\u9762\u7d27\u5bc6\u8026\u5408\uff0c\u4e0d\u5229\u4e8e\u6a21\u5757\u5316\u5f00\u53d1\u548c\u7ef4\u62a4\u3002<\/p>\n<\/p>\n<p><h4>\u6784\u5efa\u8def\u7531\u6846\u67b6\u7684\u610f\u4e49<\/h4>\n<\/p>\n<p><p>\u8def\u7531\u6846\u67b6\u7684\u5f15\u5165\uff0c\u901a\u8fc7\u4e00\u5957\u7edf\u4e00\u7684API\u6765\u7ba1\u7406\u9875\u9762\u8df3\u8f6c\uff0c\u53ef\u4ee5\u4f7f\u5f97\u9875\u9762\u4e4b\u95f4\u7684\u8df3\u8f6c\u66f4\u52a0\u7075\u6d3b\uff0c\u4ee3\u7801\u903b\u8f91\u66f4\u52a0\u6e05\u6670\u3002\u6b64\u5916\uff0c\u8def\u7531\u6846\u67b6\u8fd8\u53ef\u4ee5\u63d0\u4f9b\u5982URL\u8df3\u8f6c\u3001\u53c2\u6570\u4f20\u9012\u3001\u62e6\u622a\u5668\u5904\u7406\u7b49\u9ad8\u7ea7\u529f\u80fd\uff0c\u4e3a\u5e94\u7528\u5f00\u53d1\u5e26\u6765\u6781\u5927\u4fbf\u5229\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u8bbe\u7f6e\u6ce8\u89e3\u5904\u7406\u5668<\/h3>\n<\/p>\n<p><h4>\u4f7f\u7528\u6ce8\u89e3\u5b9a\u4e49\u8def\u7531\u8def\u5f84<\/h4>\n<\/p>\n<p><p>\u5728\u5b9e\u73b0Router\u8def\u7531\u6846\u67b6\u65f6\uff0c\u9996\u5148\u9700\u8981\u5b9a\u4e49\u4e00\u5957\u6ce8\u89e3\u7cfb\u7edf\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a<code>@Route<\/code>\u6ce8\u89e3\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u6807\u8bb0Activity\u9700\u8981\u7684\u8def\u7531\u8def\u5f84\u3002\u6ce8\u89e3\u5904\u7406\u5668\u5728\u7f16\u8bd1\u671f\u95f4\u626b\u63cf\u8fd9\u4e9b\u6ce8\u89e3\uff0c<strong>\u81ea\u52a8\u751f\u6210\u8def\u7531\u8868<\/strong>\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-java\">@Target(ElementType.TYPE)<\/p>\n<p>@Retention(RetentionPolicy.CLASS)<\/p>\n<p>public @interface Route {<\/p>\n<p>    String path();<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u5b9e\u73b0\u6ce8\u89e3\u5904\u7406\u5668<\/h4>\n<\/p>\n<p><p>\u6ce8\u89e3\u5904\u7406\u5668\u8d1f\u8d23\u5728\u7f16\u8bd1\u65f6\u671f\u626b\u63cf<code>@Route<\/code>\u6ce8\u89e3\uff0c\u5e76\u751f\u6210\u76f8\u5e94\u7684\u8def\u7531\u8868\u4ee3\u7801\u3002\u8fd9\u90e8\u5206\u4ee3\u7801\u4f5c\u4e3aJavaPoet\u5e93\u7684\u4e00\u90e8\u5206\u81ea\u52a8\u751f\u6210\uff0c\u5e76\u4e14\u4f1a\u88ab\u5305\u542b\u5728APK\u4e2d\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u6784\u5efa\u8def\u7531\u8df3\u8f6c\u63a5\u53e3<\/h3>\n<\/p>\n<p><p><strong>\u4e3a\u4e86\u5bf9\u5916\u63d0\u4f9b\u7edf\u4e00\u7684\u8df3\u8f6c\u63a5\u53e3<\/strong>\uff0c\u8def\u7531\u6846\u67b6\u5e94\u8be5\u5b9e\u73b0\u4e00\u4e2aRouter\u7c7b\u3002\u8fd9\u4e2a\u7c7b\u5305\u542b\u4e86\u542f\u52a8Activity\u7684\u65b9\u6cd5\uff0c\u5b83\u901a\u8fc7\u8def\u7531\u8868\u4e2d\u7684\u6620\u5c04\u4fe1\u606f\uff0c\u6765\u89e3\u6790\u76ee\u6807Activity\uff0c\u5e76\u6784\u9020\u5bf9\u5e94\u7684Intent\u8fdb\u884c\u9875\u9762\u8df3\u8f6c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-java\">public class Router {<\/p>\n<p>    public static void navigateTo(Context context, String path) {<\/p>\n<p>        Class&lt;?&gt; destination = getDestination(path);<\/p>\n<p>        Intent intent = new Intent(context, destination);<\/p>\n<p>        context.startActivity(intent);<\/p>\n<p>    }<\/p>\n<p>    private static Class&lt;?&gt; getDestination(String path) {<\/p>\n<p>        \/\/ \u67e5\u8be2\u8def\u7531\u8868\uff0c\u627e\u5230\u5bf9\u5e94\u7684Activity\uff0c\u7701\u7565\u5b9e\u73b0\u8be6\u60c5...<\/p>\n<p>    }<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u5b9e\u73b0\u62e6\u622a\u5668\u673a\u5236<\/h3>\n<\/p>\n<p><p>\u4e00\u822c\u800c\u8a00\uff0c\u4e00\u4e2a\u5b8c\u5584\u7684\u8def\u7531\u6846\u67b6\u9700\u8981\u652f\u6301\u62e6\u622a\u5668\u673a\u5236\u3002\u62e6\u622a\u5668\u53ef\u4ee5\u5728\u8def\u7531\u8df3\u8f6c\u6267\u884c\u524d\u8fdb\u884c\u4e00\u7cfb\u5217\u7684\u68c0\u67e5\u6216\u8005\u5904\u7406\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5b9e\u73b0\u4e00\u4e2a\u767b\u5f55\u62e6\u622a\u5668\u6765\u68c0\u67e5\u7528\u6237\u662f\u5426\u767b\u5f55\uff0c\u5982\u679c\u672a\u767b\u5f55\uff0c\u5219\u8df3\u8f6c\u5230\u767b\u5f55\u9875\u9762\u3002<\/p>\n<\/p>\n<p><h4>\u5b9a\u4e49\u62e6\u622a\u5668\u63a5\u53e3<\/h4>\n<\/p>\n<p><pre><code class=\"language-java\">public interface Interceptor {<\/p>\n<p>    void intercept(Ch<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n chain);<\/p>\n<p>    interface Chain {<\/p>\n<p>        \/\/...<\/p>\n<p>    }<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u4f7f\u7528\u62e6\u622a\u5668\u6539\u53d8\u8df3\u8f6c\u903b\u8f91<\/h4>\n<\/p>\n<p><p>\u5728\u8def\u7531\u8df3\u8f6c\u6d41\u7a0b\u4e2d\uff0c\u53ef\u4ee5\u6839\u636e\u6ce8\u518c\u7684\u62e6\u622a\u5668\u6765\u52a8\u6001\u7684\u8c03\u6574\u8df3\u8f6c\u903b\u8f91\u3002\u8fd9\u901a\u5e38\u662f\u5728<code>navigateTo<\/code>\u65b9\u6cd5\u4e2d\u5b9e\u73b0\u7684\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u652f\u6301\u8def\u7531\u53c2\u6570\u4f20\u9012<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u4f7f\u5f97\u8def\u7531\u6846\u67b6\u66f4\u52a0\u5f3a\u5927\uff0c\u5b83\u8fd8\u5e94\u8be5\u652f\u6301\u8def\u7531\u53c2\u6570\u7684\u4f20\u9012\u3002\u8fd9\u6837\u505a\u53ef\u4ee5\u8ba9<strong>\u88ab\u542f\u52a8\u7684\u9875\u9762\u83b7\u5f97\u5fc5\u8981\u7684\u6570\u636e<\/strong>\u3002\u5728\u5b9a\u4e49<code>@Route<\/code>\u6ce8\u89e3\u65f6\uff0c\u53ef\u4ee5\u589e\u52a0\u53c2\u6570\u76f8\u5173\u7684\u5c5e\u6027\uff0c\u6ce8\u89e3\u5904\u7406\u5668\u540c\u6837\u4f1a\u5904\u7406\u8fd9\u90e8\u5206\u903b\u8f91\u3002<\/p>\n<\/p>\n<p><h4>\u53c2\u6570\u6ce8\u89e3<\/h4>\n<\/p>\n<p><pre><code class=\"language-java\">@Target(ElementType.FIELD)<\/p>\n<p>@Retention(RetentionPolicy.CLASS)<\/p>\n<p>public @interface RouteParam {<\/p>\n<p>    String value();<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u5728\u8df3\u8f6c\u65f6\u4f20\u9012\u53c2\u6570<\/h4>\n<\/p>\n<p><pre><code class=\"language-java\">public class Router {<\/p>\n<p>    public static void navigateTo(Context context, String path, Bundle params) {<\/p>\n<p>        \/\/...<\/p>\n<p>    }<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516d\u3001\u81ea\u5b9a\u4e49\u8def\u7531\u7b56\u7565<\/h3>\n<\/p>\n<p><p>\u9ad8\u7ea7\u8def\u7531\u6846\u67b6\u901a\u5e38\u5141\u8bb8\u5f00\u53d1\u8005\u81ea\u5b9a\u4e49\u8def\u7531\u7b56\u7565\uff0c\u8fd9\u53ef\u80fd\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u8def\u7531\u7684\u5339\u914d\u89c4\u5219\u3001\u8def\u7531\u7684\u4f18\u5148\u7ea7\u8bbe\u5b9a\u4ee5\u53ca\u591a\u6a21\u5757\u95f4\u8def\u7531\u7684\u7ba1\u7406\u7b49\u3002<\/p>\n<\/p>\n<p><h4>\u5b9e\u73b0\u8def\u7531\u7b56\u7565\u63a5\u53e3<\/h4>\n<\/p>\n<p><p>\u81ea\u5b9a\u4e49\u7684\u8def\u7531\u7b56\u7565\u9700\u8981\u5b9e\u73b0\u7279\u5b9a\u7684\u63a5\u53e3\uff0c\u901a\u8fc7\u8fd9\u4e2a\u63a5\u53e3\u53ef\u4ee5\u5f71\u54cd\u6700\u7ec8\u7684\u8def\u7531\u9009\u62e9\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-java\">public interface RouteStrategy {<\/p>\n<p>    \/\/...<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u5e94\u7528\u81ea\u5b9a\u4e49\u7b56\u7565<\/h4>\n<\/p>\n<p><p>\u5728<code>Router<\/code>\u7c7b\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u9879\u8bbe\u7f6e\u4e0d\u540c\u7684\u8def\u7531\u7b56\u7565\uff0c\u6839\u636e\u5177\u4f53\u60c5\u51b5\u9009\u62e9\u4e0d\u540c\u7684\u8def\u7531\u7b56\u7565\u8fdb\u884c\u9875\u9762\u8df3\u8f6c\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u603b\u7ed3\u4e0e\u5b9e\u73b0<\/h3>\n<\/p>\n<p><p>\u6784\u5efa\u4e00\u4e2aRouter\u8def\u7531\u6846\u67b6\u6d89\u53ca\u5230\u6ce8\u89e3\u5904\u7406\u3001\u751f\u6210\u8def\u7531\u8868\u3001\u8df3\u8f6c\u63a5\u53e3\u5c01\u88c5\u3001\u53c2\u6570\u4f20\u9012\u3001\u62e6\u622a\u5668\u903b\u8f91\u548c\u7b56\u7565\u5b9a\u5236\u7b49\u591a\u4e2a\u65b9\u9762\u3002\u6bcf\u4e2a\u73af\u8282\u90fd\u8981\u7cbe\u5fc3\u8bbe\u8ba1\uff0c\u4ee5\u786e\u4fdd\u6846\u67b6\u7684\u529f\u80fd\u6027\u548c\u7075\u6d3b\u6027\u3002\u6700\u7ec8\uff0c\u8fd9\u4e2a\u6846\u67b6\u80fd\u4e3aAndroid\u5e94\u7528\u5e26\u6765\u6781\u5927\u7684\u67b6\u6784\u4e0a\u7684\u5e2e\u52a9\uff0c\u4e3a\u5404\u4e2a\u6a21\u5757\u95f4\u7684\u901a\u4fe1\u63d0\u4f9b\u4fbf\u5229\uff0c\u901a\u8fc7\u6709\u6548\u5730\u8def\u7531\u7ba1\u7406\uff0c\u52a0\u901f\u5f00\u53d1\u6d41\u7a0b\u5e76\u51cf\u5c11\u9519\u8bef\u3002<\/p>\n<\/p>\n<p><p>\u5728\u5b9e\u73b0\u8fc7\u7a0b\u4e2d\uff0c\u5e94\u5f53\u5145\u5206\u8003\u8651\u8bbe\u8ba1\u6a21\u5f0f\u548c\u6700\u4f73\u5b9e\u8df5\u7684\u8fd0\u7528\uff0c\u4f8b\u5982\u5de5\u5382\u6a21\u5f0f\u3001\u5355\u4f8b\u6a21\u5f0f\u3001\u5efa\u9020\u8005\u6a21\u5f0f\u7b49\uff0c\u4ee5\u5b9e\u73b0\u4e00\u4e2a\u7ed3\u6784\u5408\u7406\u3001\u6613\u4e8e\u6269\u5c55\u548c\u7ef4\u62a4\u7684\u8def\u7531\u6846\u67b6\u3002\u901a\u8fc7\u6301\u7eed\u7684\u8fed\u4ee3\u548c\u6539\u8fdb\uff0c\u8def\u7531\u6846\u67b6\u53ef\u4ee5\u4e3aAndroid\u5e94\u7528\u7684\u957f\u8fdc\u53d1\u5c55\u63d0\u4f9b\u575a\u5b9e\u7684\u57fa\u7840\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u4ec0\u4e48\u662fAndroid\u7cfb\u7edf\u7f16\u7a0b\u4e2d\u7684Router\u8def\u7531\u6846\u67b6\uff1f<\/strong><\/p>\n<p>\u5728Android\u7cfb\u7edf\u7f16\u7a0b\u4e2d\uff0cRouter\u8def\u7531\u6846\u67b6\u662f\u4e00\u79cd\u7528\u4e8e\u7ba1\u7406\u9875\u9762\u8df3\u8f6c\u548c\u6a21\u5757\u95f4\u901a\u4fe1\u7684\u5de5\u5177\u3002\u5b83\u5c06\u5404\u4e2a\u9875\u9762\u6216\u6a21\u5757\u4e4b\u95f4\u7684\u5173\u7cfb\u4ee5\u8def\u7531\u7684\u5f62\u5f0f\u8fdb\u884c\u7ba1\u7406\uff0c\u5b9e\u73b0\u4e86\u89e3\u8026\u548c\u6a21\u5757\u5316\u7684\u76ee\u6807\u3002\u901a\u8fc7\u4f7f\u7528Router\u8def\u7531\u6846\u67b6\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u7b80\u5316\u9875\u9762\u8df3\u8f6c\u7684\u6d41\u7a0b\uff0c\u5e76\u4e14\u80fd\u591f\u8f7b\u677e\u5730\u4f20\u9012\u53c2\u6570\u548c\u83b7\u53d6\u8fd4\u56de\u7ed3\u679c\u3002<\/p>\n<p><strong>2. \u5982\u4f55\u5728Android\u7cfb\u7edf\u7f16\u7a0b\u4e2d\u5b9e\u73b0Router\u8def\u7531\u6846\u67b6\uff1f<\/strong><\/p>\n<p>\u8981\u5b9e\u73b0Router\u8def\u7531\u6846\u67b6\uff0c\u53ef\u4ee5\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u6216\u81ea\u5b9a\u4e49\u5b9e\u73b0\u3002\u5bf9\u4e8e\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u7684\u65b9\u5f0f\uff0c\u5e38\u7528\u7684\u6709ARouter\u3001RouterX\u7b49\u3002\u8fd9\u4e9b\u5e93\u63d0\u4f9b\u4e86\u8def\u7531\u8868\u914d\u7f6e\u3001\u9875\u9762\u8df3\u8f6c\u3001\u53c2\u6570\u4f20\u9012\u7b49\u529f\u80fd\u7684\u5c01\u88c5\uff0c\u5f00\u53d1\u8005\u53ea\u9700\u8981\u6309\u7167\u89c4\u5b9a\u7684\u65b9\u5f0f\u914d\u7f6e\u8def\u7531\u8868\uff0c\u5373\u53ef\u5b9e\u73b0\u8def\u7531\u7684\u529f\u80fd\u3002<\/p>\n<p>\u5982\u679c\u9700\u8981\u81ea\u5b9a\u4e49\u5b9e\u73b0Router\u8def\u7531\u6846\u67b6\uff0c\u53ef\u4ee5\u53c2\u8003\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<ul>\n<li>\u5b9a\u4e49\u8def\u7531\u8868\uff1a\u5c06\u6240\u6709\u9700\u8981\u8df3\u8f6c\u7684\u9875\u9762\u6216\u6a21\u5757\u5728\u8def\u7531\u8868\u4e2d\u6ce8\u518c\uff0c\u5e76\u6307\u5b9a\u5bf9\u5e94\u7684\u8def\u5f84\u548c\u76ee\u6807\u9875\u9762\/\u6a21\u5757\u7684\u7c7b\u540d\u3002<\/li>\n<li>\u8c03\u7528\u8def\u7531\uff1a\u901a\u8fc7\u8def\u7531\u6846\u67b6\u63d0\u4f9b\u7684API\uff0c\u6839\u636e\u8def\u5f84\u6216\u5176\u4ed6\u6807\u8bc6\u7b26\u8fdb\u884c\u9875\u9762\u8df3\u8f6c\uff0c\u540c\u65f6\u53ef\u4ee5\u4f20\u9012\u53c2\u6570\u3002<\/li>\n<li>\u9875\u9762\u4f20\u53c2\uff1a\u53ef\u4ee5\u5728\u76ee\u6807\u9875\u9762\u4e2d\u63a5\u6536\u4f20\u9012\u7684\u53c2\u6570\uff0c\u5e76\u8fdb\u884c\u76f8\u5e94\u7684\u5904\u7406\u3002<\/li>\n<li>\u8fd4\u56de\u7ed3\u679c\uff1a\u5728\u9700\u8981\u8fd4\u56de\u7ed3\u679c\u7684\u9875\u9762\u4e2d\uff0c\u5728\u9875\u9762\u5173\u95ed\u524d\u8bbe\u7f6e\u8fd4\u56de\u503c\uff0c\u7136\u540e\u5728\u8c03\u7528\u9875\u9762\u4e2d\u83b7\u53d6\u8fd4\u56de\u7ed3\u679c\u3002<\/li>\n<\/ul>\n<p><strong>3. \u5728Android\u7cfb\u7edf\u7f16\u7a0b\u4e2d\u4f7f\u7528Router\u8def\u7531\u6846\u67b6\u6709\u4ec0\u4e48\u597d\u5904\uff1f<\/strong><\/p>\n<p>\u4f7f\u7528Router\u8def\u7531\u6846\u67b6\u53ef\u4ee5\u5e26\u6765\u4e00\u7cfb\u5217\u597d\u5904\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u89e3\u8026\uff1a\u901a\u8fc7\u4f7f\u7528\u8def\u7531\u6846\u67b6\uff0c\u5404\u4e2a\u9875\u9762\u6216\u6a21\u5757\u4e4b\u95f4\u7684\u5173\u7cfb\u4e0d\u518d\u7d27\u5bc6\u8026\u5408\uff0c\u51cf\u5c11\u4e86\u4ee3\u7801\u4f9d\u8d56\uff0c\u65b9\u4fbf\u7ef4\u62a4\u548c\u6269\u5c55\u3002<\/li>\n<li>\u6a21\u5757\u5316\uff1a\u5c06\u5404\u4e2a\u9875\u9762\u548c\u6a21\u5757\u4ee5\u72ec\u7acb\u7684\u65b9\u5f0f\u8fdb\u884c\u7ec4\u7ec7\uff0c\u53ef\u4ee5\u66f4\u597d\u5730\u5b9e\u73b0\u6a21\u5757\u5316\u5f00\u53d1\uff0c\u63d0\u9ad8\u4ee3\u7801\u53ef\u91cd\u7528\u6027\u3002<\/li>\n<li>\u7b80\u5316\u8df3\u8f6c\u6d41\u7a0b\uff1a\u901a\u8fc7\u8def\u7531\u6846\u67b6\u63d0\u4f9b\u7684API\uff0c\u7b80\u5316\u4e86\u9875\u9762\u8df3\u8f6c\u7684\u6d41\u7a0b\uff0c\u51cf\u5c11\u4e86\u7e41\u7410\u7684\u8df3\u8f6c\u4ee3\u7801\u3002<\/li>\n<li>\u53c2\u6570\u4f20\u9012\u548c\u8fd4\u56de\u7ed3\u679c\uff1a\u8def\u7531\u6846\u67b6\u652f\u6301\u53c2\u6570\u7684\u4f20\u9012\u548c\u8fd4\u56de\u7ed3\u679c\u7684\u83b7\u53d6\uff0c\u65b9\u4fbf\u9875\u9762\u95f4\u7684\u6570\u636e\u4ea4\u4e92\u3002<\/li>\n<li>\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\uff1a\u4f7f\u7528\u8def\u7531\u6846\u67b6\u53ef\u4ee5\u51cf\u5c11\u91cd\u590d\u4ee3\u7801\u7684\u7f16\u5199\uff0c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\uff0c\u540c\u65f6\u964d\u4f4e\u4e86\u5f00\u53d1\u96be\u5ea6\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"Android\u7cfb\u7edf\u7f16\u7a0b\u4e2d\u5b9e\u73b0Router\u8def\u7531\u6846\u67b6\u7684\u65b9\u6cd5\u4e3b\u8981\u5305\u62ec\u4ee5\u4e0b\u51e0\u70b9\uff1a\u4f7f\u7528\u6ce8\u89e3\u5904\u7406\u5668\u81ea\u52a8\u751f\u6210\u8def\u7531\u8868\u3001\u6784\u5efa\u7edf\u4e00 [&hellip;]","protected":false},"author":3,"featured_media":305911,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/305889"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=305889"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/305889\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/305911"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=305889"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=305889"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=305889"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}