Tel and SMS Links Not Working in TWebbrowser Within Delphi XE5 Android App -
i've been struggling days, , appreciate can give. tel: , sms: links work fine in web browser on android. not work @ within twebbrowser.
i found code opening links natively, works fine, cannot figure out how fire function within twebbrowser. there few windows-only solutions around involving type libraries, nothing seems work on android.
is there way call native function web page in twebbrowser in delphi xe5 firemonkey mobile app? alternatively, there way tel , sms links working within twebbrowser?
in case wondering this, stated in question, twebbrowser on xe5 on android doesn't open of useful links find in webview app - namely sms, tel, or mailto links.
i solved rewriting shouldoverrideurlloading function in fmx.webbrowser.android. in order use modified unit, copy fmx.webbrowser.android.pas project directory, add project. change following original function:
function tandroidwebbrowserservice.twebbrowserlistener.shouldoverrideurlloading( p1: jwebview; p2: jstring): boolean; begin result := false; end;
to
function tandroidwebbrowserservice.twebbrowserlistener.shouldoverrideurlloading( p1: jwebview; p2: jstring): boolean; var ourl,lurl:string; intent:jintent; begin ourl:=jstringtostring(p2); lurl:=lowercase(ourl); if ((pos('sms:',lurl)>0) or (pos('tel:',lurl)>0) or (pos('mailto:',lurl)>0)) begin intent := tjintent.javaclass.init(tjintent.javaclass.action_view, tjnet_uri.javaclass.parse(stringtojstring(ourl))); try sharedactivity.startactivity(intent); p1.stoploading; exit(true); except on e: exception begin exit(false); end; end; exit(true); end; result := false; end;
that's it. default location fmx.webbrowser.android c:\program files (x86)\embarcadero\rad studio\12.0\source\fmx
Comments
Post a Comment