Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-05

Android and network

21 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Kjow

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130522/da1b0699/attachment.html>

Reply by email

Michael Schnell
to Kjow
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

Reply by email

Felipe Monteiro de Carvalho
to Michael Schnell

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

Reply by email

Paul Breneman
to Kjow: I'm trying Android development on Lazarus and it seems to works almost well (of course…
Kjow wrote 35 lines
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

Reply by email

Benito van der Zander
to Kjow: I'm trying Android development on Lazarus and it seems to works almost well (of course…

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

Kjow wrote 43 lines
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 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130522/cffca92d/attachment.html>

Reply by email

Kjow
to Michael Schnell: Do you suppose you can access Linux TCP/IP sockets from an app ? I gather that this is…

Ok, maybe I will try.

Kjow

2013/5/22 Michael Schnell

Show quoted text 21 lines
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 .**freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130523/68fd3569/attachment.html>

Reply by email

Kjow
to Felipe Monteiro de Carvalho: Maybe call the necessary Java API via JNI? That's my solution to almost everything in…

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

Show quoted text 24 lines
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 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130523/a9233de5/attachment.html>

Reply by email

Kjow
to Benito van der Zander: last week I ported my Internet Tools (http://benibela.de/sources_en.html#internettools)…

2013/5/22 Benito van der Zander

Show quoted text 19 lines
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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130523/86a421be/attachment.html>

Reply by email

Benito van der Zander
to Kjow

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

Kjow wrote 35 lines
2013/5/22 Benito van der Zander < <mailto:>> 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 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130523/9c72c277/attachment.html>

Reply by email

Kjow
to Benito van der Zander

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

Show quoted text 50 lines
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 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 ://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130524/b8501e82/attachment.html>

Reply by email

Benito van der Zander
to Kjow

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

Kjow wrote 87 lines
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 < <mailto:>> 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 < > <mailto:>> > > 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 > <mailto:> > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list <mailto:> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130524/71b91221/attachment.html>

Reply by email

Kjow
to Benito van der Zander

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

Show quoted text 111 lines
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 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 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 ://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing ://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130524/d91f3c22/attachment.html>

Reply by email

Benito van der Zander
to Kjow
Show quoted text 5 lines
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?

Kjow wrote 145 lines
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 < <mailto:>> 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 < > <mailto:>> > > 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 < >> <mailto:>> >> >> 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 >> <mailto:> >> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > -- > _______________________________________________ > Lazarus mailing list > > <mailto:> > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > > > > -- > _______________________________________________ > Lazarus mailing list > <mailto:> > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list <mailto:> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130526/776729ea/attachment-0001.html>

Reply by email

Kjow
to Benito van der Zander

2013/5/26 Benito van der Zander

Show quoted text 11 lines
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]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130527/76b63b67/attachment.html>

Reply by email

Kjow
to Benito van der Zander: last week I ported my Internet Tools (http://benibela.de/sources_en.html#internettools)…

2013/5/22 Benito van der Zander

Show quoted text 19 lines
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

Show quoted text 5 lines
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]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130527/dbdf7f8c/attachment.html>

Reply by email

Kjow
to Kjow

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

Kjow

2013/5/27 Kjow

Show quoted text 46 lines
2013/5/22 Benito van der Zander > 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 > > 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]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130527/cdd80959/attachment.html>

Reply by email

Benito van der Zander
to Kjow: 2013/5/26 Benito van der Zander Well, now I restored lazarus/fpc and I can compile for…

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

Kjow wrote 37 lines
2013/5/26 Benito van der Zander < <mailto:>> > > 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 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130527/5bf0f3d3/attachment.html>

Reply by email

Kjow
to Benito van der Zander

2013/5/27 Benito van der Zander

What does the logcat say?

[cut]

And it has to be called in a new thread, unless you have

Show quoted text 7 lines
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. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130527/a5a0d9fc/attachment.html>

Reply by email

Benito van der Zander
to Kjow
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

Kjow wrote 35 lines
2013/5/27 Benito van der Zander < <mailto:>> 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 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130528/a890f9ad/attachment.html>

Reply by email

Kjow
to Benito van der Zander

2013/5/28 Benito van der Zander

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

Show quoted text 6 lines
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130528/3236159a/attachment.html>

Reply by email

Benito van der Zander
to Kjow
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 think the interesting stuff comes *before* that

lcltest/.LCLActivity}: app died, no saved state

then it's died, everything afterwards does not matter

Kjow wrote 65 lines
2013/5/28 Benito van der Zander < <mailto:>> 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 -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130530/eff6ac80/attachment.html>

Reply by email