Abrir um link de uma página na internet no firemonkey

Nesse fórum você poderá efetuar seus pedidos de implementações, aulas, e todo tipo de sugestões referentes aos nossos cursos.

Moderador: hermeson

laerte almeida
Mensagens: 9
Registrado em: 01/Jun/2017, 15:21

Abrir um link de uma página na internet no firemonkey

Mensagempor laerte almeida » 21/Jun/2017, 21:07

Alguem conhece como abrir um link de uma pagina em um app na plataforma android. Todos que encontrei na net não funcionam no rad studio 10 seatles e o componente nativo do Delphi não abre paginas css3 e html5.

Se alguém poder ajudar agradeço
emailx45
Mensagens: 171
Registrado em: 05/Ago/2016, 14:55

Re: Abrir um link de uma página na internet no firemonkey

Mensagempor emailx45 » 22/Jun/2017, 09:56

tente estas dicas aqui no StackOverFlow que usa API Android em JSON Nativo alem de outro metodos convencionais



https://stackoverflow.com/questions/264 ... ios-delphi



Stack Overflow
sign up log in
Questions Jobs Tags Users Badges Ask
Read this post in our app!
up vote
0
down vote
favorite
Open URL in XE6 firemonkey IOS-DELPHI
android ios firemonkey
Good Morning,

I'm trying to do a cross-platform application for both android and IOS to open a URL that will pass as parameter in the default browser in android I have achieved using the following code:

{ Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_VIEW,
TJnet_Uri.JavaClass.parse(StringToJString
('http://www.***.com'));
SharedActivity.startActivity(Intent); }
But in IOS do not know how to open a URL in the default browser, I searched thousands of pages that use methods but none have helped me, if you could help me I would greatly appreciate it!
share improve this question
asked
Oct 21 '14 at 10:43

Lluis Bernabeu
38●1●9
3 Answers
order by
up vote
2
down vote
accepted
I think you should do it that way. Works perfect for me:

http://delphi.org/2013/10/sending-a-url ... elphi-xe5/
share improve this answer
answered
Oct 21 '14 at 10:46

Enny
474●3●6
up vote
1
down vote
uses Androidapi.Helpers;

procedure TForm1.SpeedButton1Click(Sender: TObject);
var Intent: JIntent;
begin
Intent := TJIntent.Create;
Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
Intent.setData(StrToJURI('http://www.website.com.br/index.php'));
SharedActivity.startActivity(Intent);
end;
share improve this answer
answered
Sep 25 '15 at 14:55

Arley Rincon
11●1
up vote
0
down vote
Here is the happy path for what I did (excluding error handling, etc.)

uses
//...
IdURI,
{$IFDEF ANDROID}
Androidapi.Helpers, FMX.Helpers.Android, Androidapi.JNI.GraphicsContentViewText,
Androidapi.JNI.App, Androidapi.JNI.Net, Androidapi.JNI.JavaTypes
{$ENDIF ANDROID}

{$IFDEF MSWINDOWS}
Winapi.ShellAPI, Winapi.Windows
{$ENDIF MSWINDOWS}

{$IFDEF IOS}
Macapi.Helpers, iOSapi.Foundation, FMX.Helpers.iOS
{$ENDIF IOS}
;
and

//...
procedure TForm1.launchBrowser();
var
myURL: string;
{$IFDEF ANDROID}
Intent: JIntent;
{$ENDIF ANDROID}

{$IFDEF IOS}
NSU: NSUrl;
{$ENDIF IOS}
begin
myURL := 'http://www.example.com';
{$IFDEF MSWINDOWS}
ShellExecute(0, 'OPEN', PChar(myURL), '', '', SW_SHOWNORMAL);
{$ENDIF MSWINDOWS}

{$IFDEF IOS}
NSU := StrToNSUrl(TIdURI.URLEncode(myURL));
if SharedApplication.canOpenURL(NSU) then
begin
SharedApplication.openUrl(NSU);
end;
{$ENDIF IOS}

{$IFDEF ANDROID}
Intent := TJIntent.Create;
Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
Intent.setData(StrToJURI(myURL));
TAndroidHelper.Activity.startActivity(Intent);
{$ENDIF ANDROID}
end;

Note: "SharedActivity" has been deprecated (at least in 10/Seatle). The replacement seems to be "TAndroidHelper.Activity"

share improve this answer
answered
Nov 10 '15 at 23:11

BIBD
9,494●20●63●107

SharedActivity still works for me in Delphi 10 Seattle – Remi Dec 8 '15 at 12:27
1
@Remi - you're right, it does work - but I get the following warning "[DCC Warning] FILENAME.pas(line#): W1000 Symbol 'SharedActivity' is deprecated: 'Use TAndroidHelper.Activity'" when you build in Delphi 10 Seattle. And since I like having my compiles warning less, I chose to fix it now rather than wait for it to be expunged by Embarcadero later :^) – BIBD Dec 8 '15 at 18:00
add a comment
Your Answer

Body
Add picture


Log in

OR
Name

Email


By posting your answer, you agree to the privacy policy and terms of service.

Post Your Answer
meta chat tour help blog privacy policy legal contact us full site
Download the Stack Exchange Android app
2017 Stack Exchange, Inc
Desde 1993 (Clipper) / Desde 1998 (Delphi) / Firebird é meu DB / Windows é meu ambiente / Intel é minha plataforma de fazer código :lol:

Voltar para “Pedidos e Sugestões”

Quem está online

Usuários navegando neste fórum: Nenhum usuário registrado e 1 visitante