Delphi 单击Android上的Web浏览器链接以启动Delphi应用程序

2022-12-01 16:25:53 作者:admin

本文整理自网络,侵删。

 单击Android上的Web浏览器链接时,以下是启动Delphi应用程序的方法。
创建一个Delphi应用程序启动应用程序时,将获取链接的URL并将其显示在浏览器组件上。
procedure TForm1.FormCreate(Sender: TObject);var  Intent: JIntent;  Uri: JString;begin  Intent := SharedActivity.getIntent;  if TJIntent.JavaClass.ACTION_VIEW.equals(Intent.getAction) then  begin    Uri := Intent.getDataString;    FWebBrowser.URL := JStringToString(Uri);  end;end;编辑AndroidManifest.template.xml在AndroidManifest.xml中设置意图过滤器。
项目文件所在的文件夹中有一个名为“ AndroidManifest.template.xml”的文件。使用文本编辑器打开此“ AndroidManifest.template.xml”。
添加以下代码:
        <intent-filter>            <action android:name="android.intent.action.VIEW" />            <category android:name="android.intent.category.DEFAULT" />            <category android:name="android.intent.category.BROWSABLE" />            <data android:scheme="http" android:host="www.xxx.com" android:path="/" />        </intent-filter>在数据标签中设置了启动应用程序的链接。单击链接“ https://www.xxx.com/”时,可以在Delphi应用程序中打开该链接。

相关阅读 >>

Delphi 使用indy idftp 通过android 上传文件

Delphi sysutils.isdelimiter - 判断字符串的某个位置是不是指定的字符串

Delphi filestream

Delphi 将 4 个 byte 合成 1 个 integer 的五种方法 - 回复 "三足乌" 的问题

Delphi 提取字符中的数字

Delphi中始终用webbrowser打开网页

Delphi开发获取文件md5值

Delphi 封装frame到dll文件

Delphi中tinifile类 操作ini文件

Delphi 随机函数单元urandomutils

更多相关阅读请进入《Delphi》频道 >>



在线咨询 拨打电话