This is code working in PushReceiver class extended from BackendlessBoradcastReceiver
@Override
@Deprecated
public boolean onMessage(Context context, Intent intent) {
String message = intent.getStringExtra(PublishOptions.MESSAGE_TAG);
Log.d("MESSAGE CONTENTS", message);
try {
JSONObject jsonObject = new JSONObject(message);
nameValue = jsonObject.getString(TAGS.TAG_NAME);
messageTitle = jsonObject.getString(TAGS.TAG_MESSAGE_TYPE);
jsonObject.put(TAGS.TAG_JSON_RECEIVED_DATE_TIME,
TAGS.getCurrentTime());
// make sure its not the message originated from the same
// device ID
if (!jsonObject.getString(TAGS.TAG_DEVICE_ID).equals(
MainActivity.prefs.getString(TAGS.TAG_DEVICE_ID))) {
processNotification(context, message);
}
} catch (JSONException e) {
e.printStackTrace();
processAdminNotification(context, message);
}
// Saving Data
Log.d("SAVESAVE", "Receiver DID THIS");
new AppSettings(context).saveDataOnDrive();
return true;
} // working fine.............
This same code written in MyPushService extended from BackendlessPushService doesnt works, it wont even log it out. I did read documentation, checked with PushDemo from SDK.
It like its never reached.
@Override
public boolean onMessage(Context context, Intent intent) {
String message = intent.getStringExtra(PublishOptions.MESSAGE_TAG);
Log.d("MESSAGE CONTENTS", message);
try {
JSONObject jsonObject = new JSONObject(message);
nameValue = jsonObject.getString(TAGS.TAG_NAME);
messageTitle = jsonObject.getString(TAGS.TAG_MESSAGE_TYPE);
jsonObject.put(TAGS.TAG_JSON_RECEIVED_DATE_TIME,
TAGS.getCurrentTime());
// make sure its not the message originated from the same
// device ID
if (!jsonObject.getString(TAGS.TAG_DEVICE_ID).equals(
MainActivity.prefs.getString(TAGS.TAG_DEVICE_ID))) {
processNotification(context, message);
}
} catch (JSONException e) {
e.printStackTrace();
processAdminNotification(context, message);
}
// Saving Data
Log.d("SAVESAVE", "Receiver DID THIS");
new AppSettings(context).saveDataOnDrive();
return true;
}
Please shed some light on this issue, because i am forced to use Deprecated method…
Thanks,