Recent

Author Topic: Android Module Wizard  (Read 518455 times)

abssistemas

  • New Member
  • *
  • Posts: 21
Re: Android Module Wizard
« Reply #1080 on: August 30, 2018, 02:50:59 pm »
does not work because the SendMessage command does not send bytes that are not valid characters, such as '$00', '$0A'.

Handoko

  • Hero Member
  • *****
  • Posts: 3155
  • My goal: build my own game engine using Lazarus
Re: Android Module Wizard
« Reply #1081 on: August 30, 2018, 02:54:30 pm »
Not I didn't mean like that.

You convert a char $0A to become a string that contains 2 characters '0A'.

This trick is useful for transmitting binary data as human-readable text, read more:
https://en.wikipedia.org/wiki/Base64
« Last Edit: August 30, 2018, 03:00:52 pm by Handoko »

abssistemas

  • New Member
  • *
  • Posts: 21
Re: Android Module Wizard
« Reply #1082 on: August 30, 2018, 03:03:07 pm »
I understood, but then I would have to convert inside my firmware again, I did not want that.
The bluetoothclientsocket.pas file sends text and bytes, with the WriteMessage and write method respectively. Would you be able to implement the write method in the tcpsocketclient.pas file?

Handoko

  • Hero Member
  • *****
  • Posts: 3155
  • My goal: build my own game engine using Lazarus
Re: Android Module Wizard
« Reply #1083 on: August 30, 2018, 03:27:41 pm »
It doesn't seem hard to implement but unfortunately I'm not familiar with network programming.

You can make a feature request. But if you need the feature to be implemented quickly, you can consider to create a bounty for it:
http://wiki.freepascal.org/Bounties

abssistemas

  • New Member
  • *
  • Posts: 21
Re: Android Module Wizard
« Reply #1084 on: August 30, 2018, 03:35:46 pm »
Okay, thanks for the help.

jmpessoa

  • Hero Member
  • *****
  • Posts: 1455
Re: Android Module Wizard
« Reply #1085 on: August 30, 2018, 05:14:23 pm »

Hi abssistemas!

Can you try  "procedure SendFile(fullPath: string) ...?
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

jmpessoa

  • Hero Member
  • *****
  • Posts: 1455
Re: Android Module Wizard
« Reply #1086 on: September 01, 2018, 09:03:48 am »
 @Horas
Quote
I would like to upload an image file to my http server using httpclient post, Can you help me.
jHttpClient looks like doesn't support file upload, please can you provide me with an example code to upload file or image from the android mobile to http server

Done!!!

Added method "UploadFile" to jHttpClient!
[demo "AppHttpClientDemo3"]

Thank you!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

jmpessoa

  • Hero Member
  • *****
  • Posts: 1455
Re: Android Module Wizard
« Reply #1087 on: September 03, 2018, 08:04:55 am »
@abssistemas

Quote
I'm using the jTCPSocketClient component in an android project and need to send a 1024 bytes sequence, but it can not send bytes, only string by the jTCPSocketClient.SendMessage command.
It would have a way to send bytes instead of text.

Done! 

Code: Pascal  [Select]
  1. procedure TAndroidModule1.jButton2Click(Sender: TObject);
  2. var
  3.   data: TDynArrayOfJByte;
  4. begin
  5.   SetLength(data, 2);
  6.   data[0]:= $0A;
  7.   data[1]:= $00;
  8.  
  9.   if  FConnected then
  10.       jTCPSocketClient1.SendBytes(data, True);
  11.  
  12.            //"True" will write FIRST the Len=2 to the Server ...
  13.            //"False" will write only the "data" to the Server ...
  14.  
  15.    SetLength(data, 0);
  16. end;  
  17.  
« Last Edit: September 03, 2018, 08:08:18 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

abssistemas

  • New Member
  • *
  • Posts: 21
Re: Android Module Wizard
« Reply #1088 on: September 03, 2018, 01:52:37 pm »
I'm using version 0.7.0, how do I upgrade to 0.8.0, so I can test? I tried updating online but did not upgrade.

jmpessoa

  • Hero Member
  • *****
  • Posts: 1455
Re: Android Module Wizard
« Reply #1089 on: September 03, 2018, 06:37:14 pm »

Well,  the "ideal" is to install a "git" client,
so you can "update/synchronize"  your system...

But,  You can, too,  "download" as zip e reinstall/replace all packages/folders..

   .Install order.

      tfpandroidbridge_pack.lpk   [..../android_bridges]
      lazandroidwizardpack.lpk   [..../android_wizard]
      amw_ide_tools.lpk      [..../ide_tools]

Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

CC

  • Full Member
  • ***
  • Posts: 119
Re: Android Module Wizard
« Reply #1090 on: September 05, 2018, 05:26:04 pm »
Hi,  CC!

1) For not "AppCompat" themes  you can use/target any recent API .... [warning: the R24.4.1 is the last that support "ant" builder]   ... Recommended: target 21 or 22 [not run permission is required !!!]

2) Yes, R24.4.1  [or any...] is not "complete" out of box...

[from "LAMW getting started.txt"]
                1)after unpacked [R24.4.1 or any...], open a terminal and go to "sdk/tools"  folder
      2)run  cmd "android sdk" to open a GUI "SDK Manager"
      3)check "Android SDK Tools"
      4)check "Android SDK Platform-Tools"
      
      5)check "Android SDK Build-Tools 25.0.3" [need for "gradle" builder]    

      5.1)check  "Android SDK Build-Tools 26.0.2"  [need for "gradle" builder]
      
      6)go to "Android 7.1.1 (API 25)" and check  "SDK Platform" [need for "AppCompat" themes and "gradle" builder]

      7)go to "Extras" and check:
            "Android Support Repository"            
            "Android Support Library"            
            "Google USB Drive"
 
3) For "AppCompat" themes the only "recommended"  for LAMW:

"Android SDK Build-Tools 25.0.3" [need by old "gradle" plugin]    
"Android SDK Build-Tools 26.0.2"  [need by 3.0.1  "gradle" plugin ...]
"Android 7.1.1 (API 25)"
"Extras":          "Android Support Repository"            
            "Android Support Library"

Thanks!

abssistemas

  • New Member
  • *
  • Posts: 21
Re: Android Module Wizard
« Reply #1091 on: September 06, 2018, 03:02:05 pm »
Well,  the "ideal" is to install a "git" client,
so you can "update/synchronize"  your system...

But,  You can, too,  "download" as zip e reinstall/replace all packages/folders..

   .Install order.

      tfpandroidbridge_pack.lpk   [..../android_bridges]
      lazandroidwizardpack.lpk   [..../android_wizard]
      amw_ide_tools.lpk      [..../ide_tools]

I compiled tfpandroidbridge_pack.lpk and it worked, but when I tried to compile the lazandroidwizardpack.lpk it gave error as follows:

Mensagens
Verbose: Selected chip architecture: armeabi-v7a
Verbose: Taking libraries from folder: c:\Agenor\Lazarus\GS4\libs\armeabi-v7a
Verbose: Found library: libcontrols.so
Hint: (11030) Start of reading config file c:\laztoapk\downloads\laz4android1.8\fpc\3.0.4\bin\i386-win32\fpc.cfg
Hint: (11031) End of reading config file c:\laztoapk\downloads\laz4android1.8\fpc\3.0.4\bin\i386-win32\fpc.cfg
Free Pascal Compiler version 3.0.4 [2017/12/07] for arm
Copyright (c) 1993-2017 by Florian Klaempfl and others
(1002) Target OS: Android for ARMEL
(3104) Compiling lcl.pas
(3104) Compiling C:\laztoapk\downloads\laz4android1.8\lcl\interfaces\gtk2\alllclintfunits.pas
(3104) Compiling C:\laztoapk\downloads\laz4android1.8\lcl\interfaces\gtk2\gtk2cellrenderer.pas
(3104) Compiling C:\laztoapk\downloads\laz4android1.8\lcl\interfaces\gtk2\gtk2int.pas
C:\laztoapk\downloads\laz4android1.8\lcl\interfaces\gtk2\gtk2int.pas(37,6) Fatal: (10022) Can't find unit XLib used by Gtk2Int
Fatal: (1018) Compilation aborted
Error: c:\laztoapk\downloads\laz4android1.8\fpc\3.0.4\bin\i386-win32\ppcrossarm.exe returned an error exitcode

jmpessoa

  • Hero Member
  • *****
  • Posts: 1455
Re: Android Module Wizard
« Reply #1092 on: September 06, 2018, 04:58:35 pm »

@abssistemas

Before you try (re)instal any package you need open a default windows project in Lazarus....

[if a LAMW project is open in the IDE...  you can get some strange error!!!]
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

abssistemas

  • New Member
  • *
  • Posts: 21
Re: Android Module Wizard
« Reply #1093 on: September 07, 2018, 01:17:12 pm »
Okay, now it worked.
I have another problem now. When I send an array of 1024 bytes using the method, jTCPSocketClient1.SendBytes (data, False); it works normally, but soon after sending the bytes the connection is lost, and I do not get any more data through the socket. I have to connect again. The jTCPSocketClient1.SendMessage method remains connected without problems.

jmpessoa

  • Hero Member
  • *****
  • Posts: 1455
Re: Android Module Wizard
« Reply #1094 on: September 07, 2018, 06:20:52 pm »

@abssistemas

OK. I will improve  "jTCPSocketClient"  SendBytes!

Thank you!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard