{"id":606,"date":"2023-02-18T19:47:14","date_gmt":"2023-02-18T11:47:14","guid":{"rendered":"http:\/\/gjweb.top\/?p=606"},"modified":"2023-08-03T21:16:34","modified_gmt":"2023-08-03T13:16:34","slug":"24-%e8%8e%b7%e5%8f%96%e8%ae%be%e5%a4%87%e4%bf%a1%e6%81%af%e7%9b%91%e5%90%ac%e7%bd%91%e7%bb%9c%e6%89%93%e5%bc%80%e7%ac%ac%e4%b8%89%e6%96%b9app","status":"publish","type":"post","link":"https:\/\/gjweb.top\/?p=606","title":{"rendered":"24.\u83b7\u53d6\u8bbe\u5907\u4fe1\u606f&#038;\u76d1\u542c\u7f51\u7edc&#038;\u6253\u5f00\u7b2c\u4e09\u65b9APP"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\" id=\"\u83b7\u53d6\u8bbe\u5907\u4fe1\u606f-\u5e94\u7528\u4fe1\u606f-\u76d1\u542c\u7f51\u7edc-\u6253\u5f00\u7b2c\u4e09\u65b9app\">\u83b7\u53d6\u8bbe\u5907\u4fe1\u606f&amp;\u5e94\u7528\u4fe1\u606f&amp;\u76d1\u542c\u7f51\u7edc&amp;\u6253\u5f00\u7b2c\u4e09\u65b9APP<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u83b7\u53d6\u8bbe\u5907\u4fe1\u606f-device-info-plus\">\u83b7\u53d6\u8bbe\u5907\u4fe1\u606f device_info_plus<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>import 'package:device_info_plus\/device_info_plus.dart';\nfinal deviceInfoPlugin = DeviceInfoPlugin();\nfinal deviceInfo = await deviceInfoPlugin.deviceInfo;\nfinal deviceInfoMap = deviceInfo.toMap().entries \/* MAP\u683c\u5f0f\u7684\u8bbe\u5907\u4fe1\u606f*\/<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u76d1\u542c\u7f51\u7edc-connectivity-plus\">\u76d1\u542c\u7f51\u7edc connectivity_plus<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>import 'package:connectivity_plus\/connectivity_plus.dart';<br>dynamic subscription;<br>initState(){<br>    subscription = Connectivity()<br>    .onConnectivityChanged<br>    .listen((ConnectivityResult result){<br>        if(result === ConnectivityResult.wifi){\u5904\u4e8ewifi}<br>        else if(result == ConnectivityResult.mobile){\u5904\u4e8e\u624b\u673a\u7f51\u7edc}<br>        else {\u6ca1\u6709\u7f51\u7edc}<br>        <br>    })<br>}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u83b7\u53d6\u5e94\u7528\u4fe1\u606f\">\u83b7\u53d6\u5e94\u7528\u4fe1\u606f<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>import 'package:package_info_plus\/package_info_plus.dart';<br>\u200b<br>\/* \u83b7\u53d6\u5e94\u7528\u7248\u672c *\/<br>getAppInfo()async{<br> &nbsp; &nbsp;PackageInfo packageInfo = await PackageInfo.fromPlatform();<br> &nbsp; &nbsp;print(packageInfo);<br> &nbsp; &nbsp;\/*<br> &nbsp; &nbsp;* \u5e38\u7528\u914d\u7f6e<br> &nbsp; &nbsp;* appName \u5e94\u7528\u7a0b\u5e8f<br> &nbsp; &nbsp;* version \u5e94\u7528\u7248\u672c\u53f7<br> &nbsp; &nbsp;* packageName \u5e94\u7528\u7a0b\u5e8f\u7684\u552f\u4e00\u6807\u8bc6\u7b26<br> &nbsp; &nbsp;*\/<br>}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u6253\u5f00\u7b2c\u4e09\u65b9app\">\u6253\u5f00\u7b2c\u4e09\u65b9APP<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"android-\u914d\u7f6e\">Android \u914d\u7f6e<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">android\\app\\src\\main\\AndroidManifest.xml<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;queries&gt;<br>    &lt;!-- If your app checks for SMS support --&gt;<br>    &lt;intent&gt;<br>        &lt;action android:name=\"android.intent.action.VIEW\" \/&gt;<br>        &lt;data android:scheme=\"sms\" \/&gt;<br>    &lt;\/intent&gt;<br>    &lt;!-- If your app checks for call support --&gt;<br>    &lt;intent&gt;<br>        &lt;action android:name=\"android.intent.action.VIEW\" \/&gt;<br>        &lt;data android:scheme=\"tel\" \/&gt;<br>    &lt;\/intent&gt;<br>&lt;\/queries&gt;<br>&lt;uses-permission android:name=\"android.permission.QUERY_ALL_PACKAGES\"\/&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"ios\u914d\u7f6e-info-plist\">IOS\u914d\u7f6e <strong>Info<\/strong>.plist<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;key&gt;LSApplicationQueriesSchemes&lt;\/key&gt;<br>&lt;array&gt;<br> &nbsp; &nbsp;&lt;string&gt;iosamap&lt;\/string&gt;<br> &nbsp; &nbsp;&lt;string&gt;baidumap&lt;\/string&gt;<br> &nbsp; &nbsp;&lt;string&gt;sms&lt;\/string&gt;<br> &nbsp; &nbsp;&lt;string&gt;tel&lt;\/string&gt;<br> &nbsp; &nbsp;&lt;string&gt;weixin&lt;\/string&gt;<br> &nbsp; &nbsp;&lt;string&gt;alipays&lt;\/string&gt;<br>&lt;\/array&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u4f7f\u7528\">\u4f7f\u7528<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>ElevatedButton(<br>    onPressed:()async{<br> &nbsp; &nbsp; &nbsp; &nbsp;final Uri tel = Uri.parse('tel:10086');<br> &nbsp; &nbsp; &nbsp; &nbsp;if(await canLaunchUrl(tel)){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;await launchUrl(tel)<br> &nbsp; &nbsp; &nbsp;  }else{<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;throw \"\u6253\u4e0d\u5f00 $tel\"<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<br>)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u6253\u5f00\u7b2c\u4e09\u65b9APP \u53c2\u770b\u4e4b\u524d\u603b\u7ed3\u7684scheme\u8868<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u83b7\u53d6\u8bbe\u5907\u4fe1\u606f&amp;\u5e94\u7528\u4fe1\u606f&amp;\u76d1\u542c\u7f51\u7edc&amp;\u6253\u5f00\u7b2c\u4e09\u65b9APP \u83b7\u53d6\u8bbe\u5907\u4fe1\u606f device_inf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-606","post","type-post","status-publish","format-standard","hentry","category-flutter"],"_links":{"self":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/606","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=606"}],"version-history":[{"count":3,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/606\/revisions"}],"predecessor-version":[{"id":804,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/606\/revisions\/804"}],"wp:attachment":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=606"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=606"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=606"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}