L lsis Member Licensed User Longtime User May 14, 2014 #1 Any other way to read inputstream and write outputstream with a buffer except AsyncStreams? I read that AsynchStreams not fires new data event in a service with phone on sleep mode. Another one is that i want to read AsynchStreams new data buffer in a thread, but i think something goes wrong.
Any other way to read inputstream and write outputstream with a buffer except AsyncStreams? I read that AsynchStreams not fires new data event in a service with phone on sleep mode. Another one is that i want to read AsynchStreams new data buffer in a thread, but i think something goes wrong.
Erel B4X founder Staff member Licensed User Longtime User May 15, 2014 #2 I read that AsynchStreams not fires new data event in a service with phone on sleep mode. Click to expand... This is not related to AsyncStreams. Android pauses all apps when the phone is sleeping. You can use PhoneWakeState to acquire a partial lock to prevent the device from sleeping. Another one is that i want to read AsynchStreams new data buffer in a thread, but i think something goes wrong. Click to expand... You don't need to add additional thread. This is exactly the purpose of AsyncStreams. It handles the communication with two background threads. Upvote 0
I read that AsynchStreams not fires new data event in a service with phone on sleep mode. Click to expand... This is not related to AsyncStreams. Android pauses all apps when the phone is sleeping. You can use PhoneWakeState to acquire a partial lock to prevent the device from sleeping. Another one is that i want to read AsynchStreams new data buffer in a thread, but i think something goes wrong. Click to expand... You don't need to add additional thread. This is exactly the purpose of AsyncStreams. It handles the communication with two background threads.
L lsis Member Licensed User Longtime User May 15, 2014 #3 I need a continiue serial read write loop and polling. This is a too bad for a big application with one thread i think. Another one is that we have to change source code from other platforms where we know the good working state. Upvote 0
I need a continiue serial read write loop and polling. This is a too bad for a big application with one thread i think. Another one is that we have to change source code from other platforms where we know the good working state.
Erel B4X founder Staff member Licensed User Longtime User May 16, 2014 #4 need a continiue serial read write loop and polling. This is a too bad for a big application with one thread i think. Click to expand... But this is exactly the point behind AsyncStreams. It reads and writes the data in the background without affecting the main thread. BTW, you don't need to use AsyncStreams if you don't like. You can use InputStream / OutputStream directly (maybe with a timer). You need to set androidSdkVersion to 4 or otherwise you will get a NetworkOnMainThread exception. Upvote 0
need a continiue serial read write loop and polling. This is a too bad for a big application with one thread i think. Click to expand... But this is exactly the point behind AsyncStreams. It reads and writes the data in the background without affecting the main thread. BTW, you don't need to use AsyncStreams if you don't like. You can use InputStream / OutputStream directly (maybe with a timer). You need to set androidSdkVersion to 4 or otherwise you will get a NetworkOnMainThread exception.