title: Foreground service problem when message is received on socket.io chat
body: <p>App run with foreground service and device stay connected, but when a message is sent from other client, the app unfortunately stops. and i get that error:</p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: EventThread
      Process: com.github.nkzawa.socketio.androidchat, PID: 6693
      java.lang.NullPointerException: Attempt to invoke virtual method 
  'void android.support.v4.app.FragmentActivity.runOnUiThread(java.lang.Runnable)'
   on a null object reference
    at com.github.nkzawa.socketio.androidchat.MainFragment$6.call(MainFragment.java:339)
  </code></pre>
  
  <p>This is code in my Fragment class, that logcat give me causing the error.</p>
  
  <pre><code>    private Emitter.Listener onNewMessage = new Emitter.Listener() {
          @Override
          public void call(final Object... args) {
              getActivity().runOnUiThread(new Runnable() {
                  @Override
                  public void run() {
                      JSONObject data = (JSONObject) args[0];
                      String username;
                      String message;
                      try {
                          username = data.getString("username");
                          message = data.getString("message");
                      } catch (JSONException e) {
                          Log.e(TAG, e.getMessage());
                          return;
                      }
  
                      removeTyping(username);
                      addMessage(username, message);
                      setNotificationMessage(message, username);
                  }
              });
          }
      };
  </code></pre>