处理自定义的URI在Delphi XE5 Android应用程序 [英] Handling Custom URI in Delphi XE5 Android App

查看:204
本文介绍了处理自定义的URI在Delphi XE5 Android应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已设法通过修改Androidmanifest.template.xml文件注册在我的XE5 Android应用自定义协议处理。我的应用程序会弹出正确每当的myapp:// myurl网址被点击

I have managed to register a custom protocol handler in my XE5 Android app by modifying the Androidmanifest.template.xml file. My application pops up properly whenever a myapp://myurl URL is clicked on.

问题是,我需要得到被点击时,应用程序才能调出应用程序的正确部分发动的URL。谁能帮我找出如何得到这个?

The problem is, I need to get the URL that was clicked on when the app is launched in order to bring up the correct part of the app. Can anyone help me figure out how to get this?

推荐答案

根据这个例子,尝试是这样的:

uses
  ...,
  Androidapi.JNI.GraphicsContentViewText,
  Androidapi.JNI.Net,
  FMX.Helpers.Android;

procedure TMainForm.FormCreate(Sender: TObject);
var
  intent: JIntent;
  uri: Jnet_Uri;
  uriStr: String;
begin
  intent := SharedActivity.getIntent;
  if intent <> nil then
  begin
    if TJIntent.JavaClass.ACTION_VIEW.equals(intent.getAction) then
    begin
      uri := intent.getData;
      uriStr := JStringToString(uri.toString);
      // use uriStr as needed...
    end;
  end;
end;

这篇关于处理自定义的URI在Delphi XE5 Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆