I cast an object into a JSONObject then get the string and compare it with "play_audio." The IF statement gives a false result even though my log is giving me correct string - what is going on?
JSONObject data = (JSONObject)args[0];
String command = null;
try {
command = data.getString("command");
} catch (JSONException e) {
e.printStackTrace();
}
Log.i(TAG, "<<<<---- RECEIVING COMMAND ----->>> " + command);
if (command == "ping_audio") { //WHY IS THIS FALSE?
Log.i(TAG, "<<<<---- PLAYING AUDIO ----->>> ");
}
logcat
<<<<---- RECEIVING COMMAND ----->>> ping_audio