之前曾經分享過,手機版的Line可以透過 line://msg/
當然Delphi XE5也可以透過程式呼叫程式才對,在Jim McKeeth 的「Sending a URL to Another App on Android and iOS with Delphi XE5」文章有教您如何呼叫
iOS特殊語法
Android特殊語法
作者在文中有提到使用TidURL.URLEncode 。
unit OpenViewUrl;interface// URLEncode is performed on the URL// so you need to format it protocol://pathfunction OpenURL(const URL: string; const DisplayError: Boolean = False): Boolean;implementationuses IdURI, SysUtils, Classes, FMX.Dialogs,{$IFDEF ANDROID} FMX.Helpers.Android, Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.Net, Androidapi.JNI.JavaTypes;{$ELSE}{$IFDEF IOS} iOSapi.Foundation, FMX.Helpers.iOS;{$ENDIF IOS}{$ENDIF ANDROID}function OpenURL(const URL: string; const DisplayError: Boolean = False): Boolean;{$IFDEF ANDROID}var Intent: JIntent;begin// There may be an issue with the geo: prefix and URLEncode.// will need to research Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_VIEW, TJnet_Uri.JavaClass.parse(StringToJString(TIdURI.URLEncode(URL)))); try SharedActivity.startActivity(Intent); exit(true); except on e: Exception do begin if DisplayError then ShowMessage('Error: ' + e.Message); exit(false); end; end;end;{$ELSE}{$IFDEF IOS}var NSU: NSUrl;begin // iOS doesn't like spaces, so URL encode is important. NSU := StrToNSUrl(TIdURI.URLEncode(URL)); if SharedApplication.canOpenURL(NSU) then exit(SharedApplication.openUrl(NSU)) else begin if DisplayError then ShowMessage('Error: Opening "' + URL + '" not supported.'); exit(false); end;end;{$ELSE}begin raise Exception.Create('Not supported!');end;{$ENDIF IOS}{$ENDIF ANDROID}end.
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.059139013290405 seconds