Open l2fprod opened 6 years ago
@l2fprod It is a string in response. So you can use anything there.
To get the deviceID please use this,
public void onSuccess(String response) {
updateTextView("Device is registered with Push Service.");
try {
response = response.substring(response.indexOf("Response Text: ") + ("Response Text: ").length() , response.length());
JSONObject jsonOBJ = new JSONObject(response);
String retDeviceId = jsonOBJ.getString("deviceId");
} catch (JSONException e){
Log.e("Error",e.getMessage());
}
}
I will update the doc to remove that deviceId
part
It would be great if the SDK was providing a helper to parse this String. what if you change the format? A proper POJO with fields would be more robust to changes.
I'm using the following to register a device
The javadoc for MFPPush says:
It says "onSuccess" would provide the deviceId but it does not look like it. It is a "toString()" of the Response object instead. So how does one retrieve the deviceId?