Your title mentions App inventor which means to me that you are taking the character input from an Android device.
I have been testing with input from the Serial monitor.
What happens if you disconnect the device which is taking input from the App Inventor app and use Serial input from the monitor?
Do you see the same loss of response with time?
If you see correct functioning with Serial monitor input (as I do) then we'll know where to focus the attention--i.e. on the app inventor/phone side.