Basic4ppc automatically converts numbers and strings.
Using a timer is more foolproof than using the OnCom event.
You need something like:
B4X:
Sub Timer1_Tick
If Serial.InBufferCount > 0 Then
data = Serial.InputString
if StrIndexOf(data,"%",0) > -1 then '% was sent
Serial.Output("somestring")
end if
end if
End Sub