
com.avos.avoscloud.SendCallback Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leancloud-common Show documentation
Show all versions of leancloud-common Show documentation
leancloud java sdk common library
The newest version!
package com.avos.avoscloud;
/**
*
* A SendCallback is used to run code after sending a AVPush in a background thread.
*
*
* The easiest way to use a SendCallback is through an anonymous inner class. Override the done
* function to specify what the callback should do after the send is complete. The done function
* will be run in the UI thread, while the send happens in a background thread. This ensures that
* the UI does not freeze while the send happens.
*
*
* For example, this sample code sends the message "Hello world" on the "hello" channel and logs
* whether the send succeeded.
*
*
*
* AVPush push = new AVPush();
* push.setChannel("hello");
* push.setMessage("Hello world!");
* push.sendInBackground(new SendCallback() {
* public void done(AVException e) {
* if (e == null) {
* Log.d("push", "success!");
* } else {
* Log.d("push", "failure");
* }
* }
* });
*
*/
public abstract class SendCallback extends com.avos.avoscloud.AVCallback {
public SendCallback() { /* compiled code */}
/**
* Override this function with the code you want to run after the send is complete.
*
* @param e The exception raised by the send, or null if it succeeded.
*/
public abstract void done(com.avos.avoscloud.AVException e);
@Override
protected final void internalDone0(java.lang.Void returnValue, com.avos.avoscloud.AVException e) {
this.done(e);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy