Thursday, October 1, 2015

[Lazarus] Android and network

[Lazarus] Android and network

Kjow
177 posts
Hi all,

I'm trying Android development on Lazarus and it seems to works almost well (of course apps run very slowly) and I'm trying to get something trough web.

Both lnet and synapse can compile for arm-android, but no one can connect to the web.

On AndroidManifest.xml I have the line:
    <uses-permission android:name="android.permission.INTERNET" />

The same project compiles and runs well (also lnet or synapse connection) on x86_64-win64

This is the simple code that I run:

procedure TForm1.Button2Click(Sender: TObject);
var
  HTTP: THTTPSend;
begin
  HTTP := THTTPSend.Create;
  try
    HTTP.HTTPMethod('GET', Edit1.Text);
    Memo1.Lines.Assign(HTTP.Headers);
    Memo2.Lines.LoadFromStream(HTTP.Document);
  finally
    HTTP.Free;
  end;
end;

There are "tricks" to use these components or it is just not possible at now?

Thank you,
Kjow

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Michael Schnell
1463 posts
On 05/22/2013 03:31 PM, Kjow wrote:
>
> Both lnet and synapse can compile for arm-android, but no one can
> connect to the web.
Do you suppose you can access Linux TCP/IP sockets from an app ?

I gather that this is not possible in normal user mode.

I suppose you need to go through the Android Runtime library to access
the Web, thus the traditional version of both lnet and synapse will not
help.

-Michael

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Felipe Monteiro de Carvalho
752 posts
Maybe call the necessary Java API via JNI? That's my solution to
almost everything in Android =D Once you get used, JNI calling is not
that hard. The only thing that cannot be done easily natively via JNI
is when implementing interfaces is a requirement to utilize the API,
but it would be strange if networking APIs in Java require that...
I've never utilized Java networking APIs, so can't be sure...

The NDK libraries, which would be the pure native solution without
JNI, are very few, there is a list of them here:
http://wiki.freepascal.org/Custom_Drawn_Interface/Android#NDK_Libraries_available_in_Android_2.2_.28API_level_8.29

I don't have any code about this however, since my app per-se does not
utilize the internet currently.

--
Felipe Monteiro de Carvalho

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Paul Breneman
57 posts
In reply to this post by Kjow
Kjow wrote:

> Hi all,
>
> I'm trying Android development on Lazarus and it seems to works almost well
> (of course apps run very slowly) and I'm trying to get something trough web.
>
> Both lnet and synapse can compile for arm-android, but no one can connect
> to the web.
>
> On AndroidManifest.xml I have the line:
>     <uses-permission android:name="android.permission.INTERNET" />
>
> The same project compiles and runs well (also lnet or synapse connection)
> on x86_64-win64
>
> This is the simple code that I run:
>
> procedure TForm1.Button2Click(Sender: TObject);
> var
>   HTTP: THTTPSend;
> begin
>   HTTP := THTTPSend.Create;
>   try
>     HTTP.HTTPMethod('GET', Edit1.Text);
>     Memo1.Lines.Assign(HTTP.Headers);
>     Memo2.Lines.LoadFromStream(HTTP.Document);
>   finally
>     HTTP.Free;
>   end;
> end;
>
> There are "tricks" to use these components or it is just not possible at
> now?
>
> Thank you,
> Kjow

When you get it to work I'd be glad to publish source code here:
   http://www.ctrlterm.com/

The Synapse code there now works for arm-linux.

--
Regards,
Paul Breneman
www.TurboControl.com - Hardware and software development services
- Educational programming project for environment monitoring
- Information on using FreePascal for embedded systems

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Benito van der Zander
45 posts
In reply to this post by Kjow
Hi,
last week I ported my Internet Tools (http://benibela.de/sources_en.html#internettools) to Android
e.g.:

uses simpleinternet;
Memo2.Lines.text := retrieve(edit1.text);

or if you need the headers:

uses androidinternetaccess;
var internet: TAndroidInternetAccess;
begin
    internet:=TAndroidInternetAccess.create;
    Memo2.Lines.text := internet.get(edit1.text);
    Memo1.Lines.Assign(internet.GetLastHTTPHeaders);
    internet.free;
end;



Benito

On 05/22/2013 03:31 PM, Kjow wrote:
Hi all,

I'm trying Android development on Lazarus and it seems to works almost well (of course apps run very slowly) and I'm trying to get something trough web.

Both lnet and synapse can compile for arm-android, but no one can connect to the web.

On AndroidManifest.xml I have the line:
    <uses-permission android:name="android.permission.INTERNET" />

The same project compiles and runs well (also lnet or synapse connection) on x86_64-win64

This is the simple code that I run:

procedure TForm1.Button2Click(Sender: TObject);
var
  HTTP: THTTPSend;
begin
  HTTP := THTTPSend.Create;
  try
    HTTP.HTTPMethod('GET', Edit1.Text);
    Memo1.Lines.Assign(HTTP.Headers);
    Memo2.Lines.LoadFromStream(HTTP.Document);
  finally
    HTTP.Free;
  end;
end;

There are "tricks" to use these components or it is just not possible at now?

Thank you,
Kjow


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Kjow
177 posts
In reply to this post by Michael Schnell
Ok, maybe I will try.
Kjow


2013/5/22 Michael Schnell <[hidden email]>
On 05/22/2013 03:31 PM, Kjow wrote:

Both lnet and synapse can compile for arm-android, but no one can connect to the web.
Do you suppose you can access Linux TCP/IP sockets from an app ?

I gather that this is not possible in normal user mode.

I suppose you need to go through the Android Runtime library to access the Web, thus the traditional version of both lnet and synapse will not help.

-Michael

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Kjow
177 posts
In reply to this post by Felipe Monteiro de Carvalho
I don't know if I'm able to do this now, maybe a day I'll try.

Kjow


2013/5/22 Felipe Monteiro de Carvalho <[hidden email]>
Maybe call the necessary Java API via JNI? That's my solution to
almost everything in Android =D Once you get used, JNI calling is not
that hard. The only thing that cannot be done easily natively via JNI
is when implementing interfaces is a requirement to utilize the API,
but it would be strange if networking APIs in Java require that...
I've never utilized Java networking APIs, so can't be sure...

The NDK libraries, which would be the pure native solution without
JNI, are very few, there is a list of them here:
http://wiki.freepascal.org/Custom_Drawn_Interface/Android#NDK_Libraries_available_in_Android_2.2_.28API_level_8.29

I don't have any code about this however, since my app per-se does not
utilize the internet currently.

--
Felipe Monteiro de Carvalho

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Kjow
177 posts
In reply to this post by Benito van der Zander
2013/5/22 Benito van der Zander <[hidden email]>
Hi,
last week I ported my Internet Tools (http://benibela.de/sources_en.html#internettools) to Android
e.g.:

uses simpleinternet;
Memo2.Lines.text := retrieve(edit1.text);

or if you need the headers:

uses androidinternetaccess;
var internet: TAndroidInternetAccess;
begin
    internet:=TAndroidInternetAccess.create;
    Memo2.Lines.text := internet.get(edit1.text);
    Memo1.Lines.Assign(internet.GetLastHTTPHeaders);
    internet.free;
end;
Thank you, but I can't get it working... neither x64-win64 nor Android.
I can't find an installation guide, so I don't understand what is needed and how to set it.

Can you help me?

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Benito van der Zander
45 posts
You do not really need to install anything.
Just add the paths with the units to the search paths.

But if you want to install it, you can open the internettools.lpk and click Use/Install

On 05/23/2013 10:51 AM, Kjow wrote:
2013/5/22 Benito van der Zander <[hidden email]>
Hi,
last week I ported my Internet Tools (http://benibela.de/sources_en.html#internettools) to Android
e.g.:

uses simpleinternet;
Memo2.Lines.text := retrieve(edit1.text);

or if you need the headers:

uses androidinternetaccess;
var internet: TAndroidInternetAccess;
begin
    internet:=TAndroidInternetAccess.create;
    Memo2.Lines.text := internet.get(edit1.text);
    Memo1.Lines.Assign(internet.GetLastHTTPHeaders);
    internet.free;
end;
Thank you, but I can't get it working... neither x64-win64 nor Android.
I can't find an installation guide, so I don't understand what is needed and how to set it.

Can you help me?


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Kjow
177 posts
I'm sorry for delay, I have few free time.
I can't compile for arm-android:

Hint: Start of reading config file C:\Develop\fpc\2.7.x\bin\i386-win32\fpc.cfg
Hint: End of reading config file C:\Develop\fpc\2.7.x\bin\i386-win32\fpc.cfg
Free Pascal Compiler version 2.7.1 [2013/05/21] for arm
Copyright (c) 1993-2013 by Florian Klaempfl and others
Target OS: Android for ARMEL
Compiling internettools.pas
Compiling .\internet\simpleinternet.pas
Compiling .\internet\androidinternetaccess.pas
internet\androidinternetaccess.pas(35,8) Fatal: Can't find unit LCLProc used by androidinternetaccess
I have both lcl and lclbase in package requirements.
Thanks,
Kjow



2013/5/23 Benito van der Zander <[hidden email]>
You do not really need to install anything.
Just add the paths with the units to the search paths.

But if you want to install it, you can open the internettools.lpk and click Use/Install


On 05/23/2013 10:51 AM, Kjow wrote:
2013/5/22 Benito van der Zander <[hidden email]>
Hi,
last week I ported my Internet Tools (http://benibela.de/sources_en.html#internettools) to Android
e.g.:

uses simpleinternet;
Memo2.Lines.text := retrieve(edit1.text);

or if you need the headers:

uses androidinternetaccess;
var internet: TAndroidInternetAccess;
begin
    internet:=TAndroidInternetAccess.create;
    Memo2.Lines.text := internet.get(edit1.text);
    Memo1.Lines.Assign(internet.GetLastHTTPHeaders);
    internet.free;
end;
Thank you, but I can't get it working... neither x64-win64 nor Android.
I can't find an installation guide, so I don't understand what is needed and how to set it.

Can you help me?

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Benito van der Zander
45 posts
Did you include the internettools package as requirement in your project?

Because then, it does not compile for Android, because I did not want to add a requirement on LCL
for the package, when it  works without LCL everywhere except Android.
And sadly you cannot set different package requirements, for Android and non-Android.

You can click on "Add / New Requirement" and add LCL in the package inspector then it will probably work this way.

Or, I use it in my project, by not including the internettools package as requirement, and having all paths in fpc.cfg.
Then it works also fine. The packages are really pointless


Benito

On 05/24/2013 03:03 PM, Kjow wrote:
I'm sorry for delay, I have few free time.
I can't compile for arm-android:

Hint: Start of reading config file C:\Develop\fpc\2.7.x\bin\i386-win32\fpc.cfg
Hint: End of reading config file C:\Develop\fpc\2.7.x\bin\i386-win32\fpc.cfg
Free Pascal Compiler version 2.7.1 [2013/05/21] for arm
Copyright (c) 1993-2013 by Florian Klaempfl and others
Target OS: Android for ARMEL
Compiling internettools.pas
Compiling .\internet\simpleinternet.pas
Compiling .\internet\androidinternetaccess.pas
internet\androidinternetaccess.pas(35,8) Fatal: Can't find unit LCLProc used by androidinternetaccess
I have both lcl and lclbase in package requirements.
Thanks,
Kjow



2013/5/23 Benito van der Zander <[hidden email]>
You do not really need to install anything.
Just add the paths with the units to the search paths.

But if you want to install it, you can open the internettools.lpk and click Use/Install


On 05/23/2013 10:51 AM, Kjow wrote:
2013/5/22 Benito van der Zander <[hidden email]>
Hi,
last week I ported my Internet Tools (http://benibela.de/sources_en.html#internettools) to Android
e.g.:

uses simpleinternet;
Memo2.Lines.text := retrieve(edit1.text);

or if you need the headers:

uses androidinternetaccess;
var internet: TAndroidInternetAccess;
begin
    internet:=TAndroidInternetAccess.create;
    Memo2.Lines.text := internet.get(edit1.text);
    Memo1.Lines.Assign(internet.GetLastHTTPHeaders);
    internet.free;
end;
Thank you, but I can't get it working... neither x64-win64 nor Android.
I can't find an installation guide, so I don't understand what is needed and how to set it.

Can you help me?

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Kjow
177 posts
Now it works, I misunderstood the requirements... I meant "LCL" in project requirements, not package!

Anyway, something is broken on (my?) lazarus/fpc... when I compile for Android it builds, but app crashes at start
(Well, on Galaxy Note it crashes at start, on Nexus 10 the app goes on loop flashing all time until I kill it)
So I can't test on real device.
Thank you!
Kjow




2013/5/24 Benito van der Zander <[hidden email]>
Did you include the internettools package as requirement in your project?

Because then, it does not compile for Android, because I did not want to add a requirement on LCL
for the package, when it  works without LCL everywhere except Android.
And sadly you cannot set different package requirements, for Android and non-Android.

You can click on "Add / New Requirement" and add LCL in the package inspector then it will probably work this way.

Or, I use it in my project, by not including the internettools package as requirement, and having all paths in fpc.cfg.
Then it works also fine. The packages are really pointless


Benito


On 05/24/2013 03:03 PM, Kjow wrote:
I'm sorry for delay, I have few free time.
I can't compile for arm-android:

Hint: Start of reading config file C:\Develop\fpc\2.7.x\bin\i386-win32\fpc.cfg
Hint: End of reading config file C:\Develop\fpc\2.7.x\bin\i386-win32\fpc.cfg
Free Pascal Compiler version 2.7.1 [2013/05/21] for arm
Copyright (c) 1993-2013 by Florian Klaempfl and others
Target OS: Android for ARMEL
Compiling internettools.pas
Compiling .\internet\simpleinternet.pas
Compiling .\internet\androidinternetaccess.pas
internet\androidinternetaccess.pas(35,8) Fatal: Can't find unit LCLProc used by androidinternetaccess
I have both lcl and lclbase in package requirements.
Thanks,
Kjow



2013/5/23 Benito van der Zander <[hidden email]>
You do not really need to install anything.
Just add the paths with the units to the search paths.

But if you want to install it, you can open the internettools.lpk and click Use/Install


On 05/23/2013 10:51 AM, Kjow wrote:
2013/5/22 Benito van der Zander <[hidden email]>
Hi,
last week I ported my Internet Tools (http://benibela.de/sources_en.html#internettools) to Android
e.g.:

uses simpleinternet;
Memo2.Lines.text := retrieve(edit1.text);

or if you need the headers:

uses androidinternetaccess;
var internet: TAndroidInternetAccess;
begin
    internet:=TAndroidInternetAccess.create;
    Memo2.Lines.text := internet.get(edit1.text);
    Memo1.Lines.Assign(internet.GetLastHTTPHeaders);
    internet.free;
end;
Thank you, but I can't get it working... neither x64-win64 nor Android.
I can't find an installation guide, so I don't understand what is needed and how to set it.

Can you help me?

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Benito van der Zander
45 posts

Anyway, something is broken on (my?) lazarus/fpc... when I compile for Android it builds, but app crashes at start
(Well, on Galaxy Note it crashes at start, on Nexus 10 the app goes on loop flashing all time until I kill it)

Always or just with the internettools?

Did you check the logcat?


On 05/24/2013 11:53 PM, Kjow wrote:
Now it works, I misunderstood the requirements... I meant "LCL" in project requirements, not package!

Anyway, something is broken on (my?) lazarus/fpc... when I compile for Android it builds, but app crashes at start
(Well, on Galaxy Note it crashes at start, on Nexus 10 the app goes on loop flashing all time until I kill it)
So I can't test on real device.
Thank you!
Kjow




2013/5/24 Benito van der Zander <[hidden email]>
Did you include the internettools package as requirement in your project?

Because then, it does not compile for Android, because I did not want to add a requirement on LCL
for the package, when it  works without LCL everywhere except Android.
And sadly you cannot set different package requirements, for Android and non-Android.

You can click on "Add / New Requirement" and add LCL in the package inspector then it will probably work this way.

Or, I use it in my project, by not including the internettools package as requirement, and having all paths in fpc.cfg.
Then it works also fine. The packages are really pointless


Benito


On 05/24/2013 03:03 PM, Kjow wrote:
I'm sorry for delay, I have few free time.
I can't compile for arm-android:

Hint: Start of reading config file C:\Develop\fpc\2.7.x\bin\i386-win32\fpc.cfg
Hint: End of reading config file C:\Develop\fpc\2.7.x\bin\i386-win32\fpc.cfg
Free Pascal Compiler version 2.7.1 [2013/05/21] for arm
Copyright (c) 1993-2013 by Florian Klaempfl and others
Target OS: Android for ARMEL
Compiling internettools.pas
Compiling .\internet\simpleinternet.pas
Compiling .\internet\androidinternetaccess.pas
internet\androidinternetaccess.pas(35,8) Fatal: Can't find unit LCLProc used by androidinternetaccess
I have both lcl and lclbase in package requirements.
Thanks,
Kjow



2013/5/23 Benito van der Zander <[hidden email]>
You do not really need to install anything.
Just add the paths with the units to the search paths.

But if you want to install it, you can open the internettools.lpk and click Use/Install


On 05/23/2013 10:51 AM, Kjow wrote:
2013/5/22 Benito van der Zander <[hidden email]>
Hi,
last week I ported my Internet Tools (http://benibela.de/sources_en.html#internettools) to Android
e.g.:

uses simpleinternet;
Memo2.Lines.text := retrieve(edit1.text);

or if you need the headers:

uses androidinternetaccess;
var internet: TAndroidInternetAccess;
begin
    internet:=TAndroidInternetAccess.create;
    Memo2.Lines.text := internet.get(edit1.text);
    Memo1.Lines.Assign(internet.GetLastHTTPHeaders);
    internet.free;
end;
Thank you, but I can't get it working... neither x64-win64 nor Android.
I can't find an installation guide, so I don't understand what is needed and how to set it.

Can you help me?

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Kjow
177 posts
2013/5/26 Benito van der Zander <[hidden email]>

Anyway, something is broken on (my?) lazarus/fpc... when I compile for Android it builds, but app crashes at start
(Well, on Galaxy Note it crashes at start, on Nexus 10 the app goes on loop flashing all time until I kill it)
Always or just with the internettools?

Did you check the logcat?

Well, now I restored lazarus/fpc and I can compile for arm-android (*) with also internettools requirement.

About internettools, with only "Memo1.Lines.Text:= retrieve(Edit1.Text);" for x86_64-win64 (or i386-win32) it works, but on arm-android (Nexus 10 or Galaxy Note) the app crashes as soon as I launch the code (e.g. in buttonclick).

Any ideas?

Thank you,
Kjow

*I don't know exactly which was the problem, but now seems to be ok [I also reverted lazarus to r41240 and fpc to r24523]

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Kjow
177 posts
In reply to this post by Benito van der Zander
2013/5/22 Benito van der Zander <[hidden email]>
Hi,
last week I ported my Internet Tools (http://benibela.de/sources_en.html#internettools) to Android
e.g.:

uses simpleinternet;
Memo2.Lines.text := retrieve(edit1.text);

or if you need the headers:

uses androidinternetaccess;
var internet: TAndroidInternetAccess;
begin
    internet:=TAndroidInternetAccess.create;
    Memo2.Lines.text := internet.get(edit1.text);
    Memo1.Lines.Assign(internet.GetLastHTTPHeaders);
    internet.free;
end;

2013/5/24 Kjow <[hidden email]>

Anyway, something is broken on (my?) lazarus/fpc... when I compile for Android it builds, but app crashes at start

Well, now I restored lazarus/fpc and I can compile for arm-android (*) with also internettools requirement.

About internettools, with only "Memo1.Lines.Text:= retrieve(Edit1.Text);" for x86_64-win64 (or i386-win32) it works, but on arm-android (Nexus 10 or Galaxy Note) the app crashes as soon as I launch the code (e.g. in buttonclick).

Any ideas?

Thank you,
Kjow

*I don't know exactly which was the problem, but now seems to be ok [I also reverted lazarus to r41240 and fpc to r24523]

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Kjow
177 posts
Oops, I'm sorry for double post. It was a misprint.
Kjow


2013/5/27 Kjow <[hidden email]>
2013/5/22 Benito van der Zander <[hidden email]>
Hi,
last week I ported my Internet Tools (http://benibela.de/sources_en.html#internettools) to Android
e.g.:

uses simpleinternet;
Memo2.Lines.text := retrieve(edit1.text);

or if you need the headers:

uses androidinternetaccess;
var internet: TAndroidInternetAccess;
begin
    internet:=TAndroidInternetAccess.create;
    Memo2.Lines.text := internet.get(edit1.text);
    Memo1.Lines.Assign(internet.GetLastHTTPHeaders);
    internet.free;
end;

2013/5/24 Kjow <[hidden email]>

Anyway, something is broken on (my?) lazarus/fpc... when I compile for Android it builds, but app crashes at start
 

Well, now I restored lazarus/fpc and I can compile for arm-android (*) with also internettools requirement.

About internettools, with only "Memo1.Lines.Text:= retrieve(Edit1.Text);" for x86_64-win64 (or i386-win32) it works, but on arm-android (Nexus 10 or Galaxy Note) the app crashes as soon as I launch the code (e.g. in buttonclick).

Any ideas?

Thank you,
Kjow

*I don't know exactly which was the problem, but now seems to be ok [I also reverted lazarus to r41240 and fpc to r24523]

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Benito van der Zander
45 posts
In reply to this post by Kjow
What does the logcat say?


You need to have
<uses-permission android:name="android.permission.INTERNET"/>
in the Android manifest


And it has to be called in  a new thread, unless you have
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = 
        new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}

in the java file



On 05/27/2013 12:30 AM, Kjow wrote:
2013/5/26 Benito van der Zander <[hidden email]>

Anyway, something is broken on (my?) lazarus/fpc... when I compile for Android it builds, but app crashes at start
(Well, on Galaxy Note it crashes at start, on Nexus 10 the app goes on loop flashing all time until I kill it)
Always or just with the internettools?

Did you check the logcat?

Well, now I restored lazarus/fpc and I can compile for arm-android (*) with also internettools requirement.

About internettools, with only "Memo1.Lines.Text:= retrieve(Edit1.Text);" for x86_64-win64 (or i386-win32) it works, but on arm-android (Nexus 10 or Galaxy Note) the app crashes as soon as I launch the code (e.g. in buttonclick).

Any ideas?

Thank you,
Kjow

*I don't know exactly which was the problem, but now seems to be ok [I also reverted lazarus to r41240 and fpc to r24523]


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Kjow
177 posts
2013/5/27 Benito van der Zander <[hidden email]>
What does the logcat say?
 
[cut]
And it has to be called in  a new thread, unless you have
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = 
        new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}

in the java file

I have no experience about android dev, can you describe how to add this, in detail?

Thanks,
Kjow

PS about logcat I will try... I need to learn how to use it.

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Benito van der Zander
45 posts

I have no experience about android dev, can you describe how to add this, in detail?

In the LCLActivity.java there is an event onCreate.

There you can just copy it to afaik.



PS about logcat I will try... I need to learn how to use it.

You really need to its on of the most important tools out there

Just start by calling

android-sdk-linux/platform-tools/adb logcat




On 05/27/2013 10:21 AM, Kjow wrote:
2013/5/27 Benito van der Zander <[hidden email]>
What does the logcat say?
 
[cut]
And it has to be called in  a new thread, unless you have
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = 
        new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}

in the java file

I have no experience about android dev, can you describe how to add this, in detail?

Thanks,
Kjow

PS about logcat I will try... I need to learn how to use it.


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded | More    

Re: [Lazarus] Android and network

Kjow
177 posts
2013/5/28 Benito van der Zander <[hidden email]>
In the LCLActivity.java there is an event onCreate.

There you can just copy it to afaik.
 
Same crash,

You really need to its on of the most important tools out there

Just start by calling

android-sdk-linux/platform-tools/adb logcat

...
...
I/DEBUG   (   34):     4be776e8 18bd8002 e8bd4001 e240000c ea0054ab
I/DEBUG   (   34):     4be776f8 e12fff1e e1901f9f e2411001 e1802f91
I/DEBUG   (   34):     4be77708 e3520000 1afffffa e1b00001 e12fff1e
I/DEBUG   (   34):     4be77718 e12fff1e e3500000 15101008 12400008
I/DEBUG   (   34):     4be77728 012fff1e e3510000 aa000000 e12fff1e
I/DEBUG   (   34):     4be77738 e1901f9f e2811001 e1802f91 e3520000
I/DEBUG   (   34):     4be77748 1afffffa e1a00001 e12fff1e e12fff1e
I/DEBUG   (   34):     4be77758 e1902f9f e1803f91 e3530000 1afffffb
I/DEBUG   (   34):     4be77768 e1a00002 e12fff1e e12fff1e e1902f9f
I/DEBUG   (   34):     4be77778 e081c002 e1803f9c e3530000 1afffffa
I/DEBUG   (   34):     4be77788 e1a00002 e12fff1e e12fff1e e1903f9f
I/DEBUG   (   34):     4be77798 e3a0c000 e1530002 0180cf91 e35c0000
I/DEBUG   (   34):     4be777a8 1afffff9 e1a00003 e12fff1e e12fff1e
I/DEBUG   (   34):     4be777b8 e92d4000 e24dd004 ebffffcd e3500000
D/Zygote  (   37): Process 1285 terminated by signal (11)
I/ActivityManager(  282): Process com.pascal.lcltest (pid 1285) has died.
I/WindowState(  282): WIN DEATH: Window{410fd2c0 u0 com.pascal.lcltest/com.pasca
l.lcltest.LCLActivity}
W/ActivityManager(  282): Force removing ActivityRecord{412d7bd8 u0 com.pascal.l
cltest/.LCLActivity}: app died, no saved state
E/SurfaceFlinger(   36): ro.sf.lcd_density must be defined as a build property
W/EGL_emulation(  403): eglSurfaceAttrib not implemented
W/InputMethodManagerService(  282): Got RemoteException sending setActive(false)
 notification to pid 1285 uid 10044
D/ExchangeService(  618): Received deviceId from Email app: null
D/ExchangeService(  618): !!! deviceId unknown; stopping self and retrying
D/ExchangeService(  618): !!! EAS ExchangeService, onCreate
D/ExchangeService(  618): !!! EAS ExchangeService, onStartCommand, startingUp =
false, running = false
...
...
Thanks,
Kjow
http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Android-and-network-td4031396.html