知識(shí)
不管是網(wǎng)站,軟件還是小程序,都要直接或間接能為您產(chǎn)生價(jià)值,我們?cè)谧非笃湟曈X(jué)表現(xiàn)的同時(shí),更側(cè)重于功能的便捷,營(yíng)銷的便利,運(yùn)營(yíng)的高效,讓網(wǎng)站成為營(yíng)銷工具,讓軟件能切實(shí)提升企業(yè)內(nèi)部管理水平和效率。優(yōu)秀的程序?yàn)楹笃谏?jí)提供便捷的支持!
安卓APP的http訪問(wèn)權(quán)限
發(fā)表時(shí)間:2020-10-19
發(fā)布人:葵宇科技
瀏覽次數(shù):37
安卓下,默認(rèn)只允許 https 的訪問(wèn),不允許 http 的訪問(wèn)。
用 Delphi 寫(xiě)一個(gè)安卓 APP,用 TIdHTTP 去訪問(wèn)一個(gè) WEB 服務(wù)器,不行。網(wǎng)上查了一下,發(fā)現(xiàn)需要這樣做:
在 APP 的工程目錄下,有一個(gè) XML 文件,“AndroidManifest.template.xml”,用文本 編輯器打開(kāi)它:
在 <application android:persistent="%persistent%" 底下,增加一行:
android:usesCleartextTraffic="true">
增加完后,全文如下:
<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="%package%"
android:versionCode="%versionCode%"
android:versionName="%versionName%"
android:installLocation="%installLocation%">
<uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="%targetSdkVersion%" />
<%uses-permission%>
<uses-feature android:glEsVersion="0x00020000" android:required="True"/>
<application android:persistent="%persistent%"
android:restoreAnyVersion="%restoreAnyVersion%"
android:label="%label%"
android:debuggable="%debuggable%"
android:largeHeap="%largeHeap%"
android:icon="%icon%"
android:theme="%theme%"
android:hardwareAccelerated="%hardwareAccelerated%"
android:resizeableActivity="false"
android:usesCleartextTraffic="true">
<%provider%>
<%application-meta-data%>
<%services%>
<!-- Our activity is a subclass of the built-in NativeActivity framework class.
This will take care of integrating with our NDK code. -->
<activity android:name="com.embarcadero.firemonkey.FMXNativeActivity"
android:label="%activityLabel%"
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
android:launchMode="singleTask">
<!-- Tell NativeActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="%libNameValue%" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<%activity%>
<%receivers%>
</application>
</manifest>
<!-- END_INCLUDE(manifest) -->
加上那一行以后,IdHTTP 可以使用 http 協(xié)議訪問(wèn)一個(gè)網(wǎng)站了。
相關(guān)案例查看更多
相關(guān)閱讀
- 云南小程序制作
- 網(wǎng)絡(luò)營(yíng)銷
- 云南網(wǎng)站建設(shè)
- 汽車報(bào)廢系統(tǒng)
- 報(bào)廢車
- 軟件定制公司
- 云南小程序代建
- 網(wǎng)站建設(shè)制作
- 云南建站公司
- 商標(biāo)
- 云南軟件定制公司
- 網(wǎng)站建設(shè)需要多少錢
- 云南網(wǎng)站建設(shè)列表網(wǎng)
- 云南網(wǎng)站建設(shè)高手
- 買小程序被騙
- 云南小程序定制
- 小程序開(kāi)發(fā)排名前十名
- 云南小程序開(kāi)發(fā)公司推薦
- 汽車拆解管理系統(tǒng)
- 云南網(wǎng)頁(yè)制作
- 云南省住房建設(shè)廳網(wǎng)站
- web學(xué)習(xí)路線
- 昆明小程序代建
- 小程序
- asp網(wǎng)站
- 云南網(wǎng)站建設(shè)首選
- 小程序的開(kāi)發(fā)公司
- web開(kāi)發(fā)
- 云南省建設(shè)廳網(wǎng)站官網(wǎng)
- 網(wǎng)站建設(shè)公司哪家好