Android Question DateTime.Date and DateTime.Time Question

StephanJ

New Member
Licensed User
Longtime User
Hello,

I'm having some difficulties with the Methods DateTime.Time and DateTime.Date.
In my App i'm getting Data from a Bluetooth Device via AsyncStreams in a service running in the background. Every time Data comes through the _NewData Event i log it in a Textfile with a Time Stamp. Recently i changed that and used the 2 mentioned Methods to format the Timestamp into readable State with the Result being that from time to time the received Data gets scrambled. This only happens sometimes when the Phone is under Stress anyways (for example when many applications are in use).

I would like to keep the formatted Datetime but am out of ideas to work around this issue.

Does anybody here have any ideas? Any help would be appreciated.

Thanks in Advance :)
 

DonManfred

Expert
Licensed User
Longtime User
Can you upload a small example which shows your problem?
Or maybe some code you have problems with.

Without seeing your code it is hard to give congrete advices.
 
Upvote 0

StephanJ

New Member
Licensed User
Longtime User
Thanks for the quick response.

The problem is the App is licensed and i am not allowed to post too much of the code...

Sub AStreams_NewData(Buffer() As Byte)
.
.
.
newProtocol = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
sb.Initialize
sb.Append(DateTime.Date(DateTime.Now)).Append(" ").Append(DateTime.Time(DateTime.Now))
sb.Append(";").Append(pos).Append(";").Append(batteryLevel).Append(";").Append(vers).Append(xstring).Append(";").Append(validProtocol)
Generell.AppendString(Main.dateien.Pfad, Generell.lieNr & "_Funk.txt", newProtocol & ";" & sb.ToString, True)
.
.
.

This is the Part where i log the incoming Protocol with further information into the Logfile. The only part before this is a Checksum method which is crucial so i can't leave it out.
I know this isn't much but i hope it helps.
 
Upvote 0
Top