Lazarus

Programming => Operating Systems => Android => Topic started by: schumi on September 25, 2019, 08:58:11 am

Title: APP crash with jTCPSocketClient
Post by: schumi on September 25, 2019, 08:58:11 am
hi,
I have a strange problem, my APP use jTCPSocketClient for send end receive simple string with PC.
With old device, smart monitor with android 4.4.2 working very well, now with new device, smart monitor same brand with android 7.1.2 app crash (freeze) at second connection with server, all the rest working normaly, freeze only on SendMessage / MessagesReceived but at the SECOND time.

I have upgrade at last LAMW from github, change init() --> InitShowing() but the problem persist.

someone have any advice?

thank you
Title: Re: APP crash with jTCPSocketClient
Post by: jmpessoa on September 25, 2019, 05:13:17 pm

Hi,  schumi

Maybe you have some "run time permission"  issue...
Title: Re: APP crash with jTCPSocketClient
Post by: schumi on September 26, 2019, 03:31:51 pm

Hi,  schumi

Maybe you have some "run time permission"  issue...

the APP have all permission in settings, how can I check run time permission ?

I make some test, ConnectAsync or ConnectAsyncTimeOut working normaly, but after the 2nd time CloseConnection() app don't respond.

thanks
Title: Re: APP crash with jTCPSocketClient
Post by: jmpessoa on September 26, 2019, 06:21:43 pm
Quote
how can I check run time permission ?

You need run time permission for some "critical"  use...

ex.  Read/Write files... and others...

The demo "AppCameraDemo" [and many others..]  show some use....
Title: Re: APP crash with jTCPSocketClient
Post by: schumi on September 27, 2019, 06:00:42 pm
I have try this:
Code: Pascal  [Select][+][-]
  1. if FConnected and IsRuntimePermissionGranted('android.permission.INTERNET') and
  2.       IsRuntimePermissionGranted('android.permission.ACCESS_NETWORK_STATE') and
  3.       IsRuntimePermissionGranted('android.permission.CHANGE_NETWORK_STATE') then
  4.   begin
  5.     ....
  6.   end
  7.   else  ShowMessage('Sorry... Some Runtime Permission NOT Granted ...');

but don't change, very strange
thanks for reply
Title: Re: APP crash with jTCPSocketClient
Post by: schumi on September 30, 2019, 10:42:20 am
I have tryed with other device with android 7.0 and android 8.0, same problem.

I suspect a problem with jTCPSocketClient and android >=7, someone use this component?

thanks
Title: Re: APP crash with jTCPSocketClient
Post by: schumi on October 04, 2019, 02:02:24 pm
Hi,
nobody use jTCPSocketCLient on android >= 7 ???

thanks
Title: Re: APP crash with jTCPSocketClient
Post by: jmpessoa on October 04, 2019, 10:50:31 pm

Hi, schumi!

I will try do some test here.....
Title: Re: APP crash with jTCPSocketClient
Post by: schumi on October 05, 2019, 09:22:36 am

Hi, schumi!

I will try do some test here.....
thank you a lot
Title: Re: APP crash with jTCPSocketClient
Post by: schumi on October 14, 2019, 10:49:51 pm
I try to fix AppTCPClientDemo1 with runtime permission, but don't work.
 :( :( :(
Title: Re: APP crash with jTCPSocketClient
Post by: schumi on October 17, 2019, 01:29:54 am
test with laz+fpc from fpcupdeluxe but same problem.
on CloseConnection() freeze (or infinite loop) >:(
Title: Re: APP crash with jTCPSocketClient
Post by: commanderz on October 29, 2019, 09:35:08 pm
this is jTCPSocketClient.java (why not to allow link file not in message?)
and with my modification this is not loop againe,
but not disconnecting too,
compare your old jTCPSocketClient.java  with this and you see and find why
becouse mRun not to going in stable false mode after mRunClose set to false;
need to more think and beautifily this mehanics.

jTCPSocketClient.java: 
Code: Pascal  [Select][+][-]
  1. but 20000character lengs so no data in this (((((((((((
  2. fckg sht
  3.  
  4.  
Title: Re: APP crash with jTCPSocketClient
Post by: schumi on October 29, 2019, 09:52:28 pm
I tried to modify jTCPSocketClient.java but I'm not java programmer so I abandoned TCP and now I use HTTP that works perfectly!!

thanks
Title: Re: APP crash with jTCPSocketClient
Post by: ADiV on October 31, 2019, 01:59:08 pm
Fixed "jTCPSocketClient" [by TR3E]

I attach the file, Greetings!
Title: Re: APP crash with jTCPSocketClient
Post by: schumi on October 31, 2019, 07:11:52 pm
Fixed "jTCPSocketClient" [by TR3E]

I attach the file, Greetings!

Thanks!
I will try it
Title: Re: APP crash with jTCPSocketClient
Post by: rca on October 31, 2019, 10:53:04 pm
Fixed "jTCPSocketClient" [by TR3E]

I attach the file, Greetings!

Thank you for your support to improve LAMW.

I tried your file with a smartphone and Android 7
Using the example AppTCPClientDemo.

I connect to a server PC via TCP. Windows 10
Using the example of Inet. "testnet"

From the smartphone to the PC, everything OK.

But the moment I send a message from the PC to
the smartphone, the mobile app closes.

With the original file, neither the transmission nor the reception worked for me.
With yours only fails me at the reception.

Cordially,
Title: Re: APP crash with jTCPSocketClient
Post by: commanderz on November 02, 2019, 10:25:21 am
Fixed "jTCPSocketClient" [by TR3E]

I attach the file, Greetings!

Work very well.
But if click Connect/Disconnect buttons very fast - something going wrong, but if not fast - all ok.
TR3E, Thanks a lot!
Title: Re: APP crash with jTCPSocketClient
Post by: ADiV on November 05, 2019, 11:55:36 am
Hello, I have corrected the errors you commented to me. Improving the source code. I send it attached in addition to the updated example.
Title: Re: APP crash with jTCPSocketClient
Post by: rca on November 06, 2019, 12:18:52 am
Hello, I have corrected the errors you commented to me. Improving the source code. I send it attached in addition to the updated example.

Excellent!

I tried it and now it works perfect.

Thank you.
TinyPortal © 2005-2018