Fixed appContext exchange, removed some nullPointers, written
onMessageReceived, etc.