wait for response for x time, send a message by x time, or when response receive

wvmarle:

while( s0 != '|' || s1 != '|' ){//terminates if '|' is received

This will only stop the loop when you receive "||", not a single "|" as the comment suggests. So one of the two is wrong and needs to be corrected.

while( s0 != '|' || s1 != '|' ){//terminates if '|' is received

doesnt this mean the loop will run when s0 or s1 are not equal to '|'.

meaning, if either s0 or s1 is equals to '|' , it will stop?

if(HWSERIAL.available() == 0 && millis() - Timer > 1){

You should also seriously look into why the message gets lost, as that shouldn't happen to begin with. I bet that device of yours will have some kind of serial buffer.

the "w" sent to android might've gotten lost while the flags are being set.

Android app: on thread 1: receives "w" sets its flag to true
on thread 2: processes and sends 2bytes to Arduino, set flag to false

Arduino: receives the 2 bytes, replies with "w", wait for next 2 bytes.

on multiple occasions, the stream stops completely. and i cant make the arduino keep sending "w" without some sort of control. the Android app will crash due to too many internal broadcasts(broadcast is sent whenever incoming message).