Created
November 7, 2019 16:53
-
-
Save Suchiq/9f00b7f1018ae1bc2ca720b27ae12462 to your computer and use it in GitHub Desktop.
Payload receive callback
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final PayloadCallback mPayloadCallback = new PayloadCallback() { | |
@Override | |
public void onPayloadReceived(@NonNull String s, @NonNull Payload payload) { | |
final byte[] receivedBytes = payload.asBytes(); | |
AppUtil.runOnUiThread(new Runnable() { | |
@Override | |
public void run() { | |
long timestamp = System.currentTimeMillis(); | |
long timeTaken=(timestamp-Long.valueOf(new String(receivedBytes)))/1000; | |
strReceived=strReceived+"\n"+timeTaken +""+" sec"+"\n"; | |
txtReceivedData.setText(strReceived+""); | |
} | |
}); | |
} | |
@Override | |
public void onPayloadTransferUpdate(@NonNull String s, | |
@NonNull PayloadTransferUpdate payloadTransferUpdate) { | |
if (payloadTransferUpdate.getStatus() == PayloadTransferUpdate.Status.SUCCESS) { | |
// Do something with is here... | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment