本文整理汇总了Java中com.codename1.push.PushCallback类的典型用法代码示例。如果您正苦于以下问题:Java PushCallback类的具体用法?Java PushCallback怎么用?Java PushCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PushCallback类属于com.codename1.push包,在下文中一共展示了PushCallback类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: push
import com.codename1.push.PushCallback; //导入依赖的package包/类
@Override
public void push(final String value) {
final PushCallback callback = getPushCallbackInstance();
if(callback != null) {
Display.getInstance().callSerially(new Runnable() {
public void run() {
callback.push(value);
}
});
} else {
NotificationManager nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Intent newIntent = new Intent(this, getStubClass());
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, newIntent, PendingIntent.FLAG_CANCEL_CURRENT);
Notification.Builder builder = new Notification.Builder(this)
.setContentIntent(contentIntent)
.setSmallIcon(android.R.drawable.stat_notify_sync)
.setTicker(value)
.setAutoCancel(true)
.setWhen(System.currentTimeMillis())
.setContentTitle(value)
.setDefaults(Notification.DEFAULT_ALL);
Notification notif = builder.build();
nm.notify((int)System.currentTimeMillis(), notif);
}
}
示例2: setMainClass
import com.codename1.push.PushCallback; //导入依赖的package包/类
public static void setMainClass(Object main) {
if(main instanceof PushCallback) {
pushCallback = (PushCallback)main;
}
if(main instanceof PurchaseCallback) {
purchaseCallback = (PurchaseCallback)main;
}
if(main instanceof RestoreCallback) {
restoreCallback = (RestoreCallback)main;
}
if (main instanceof LocalNotificationCallback) {
setLocalNotificationCallback((LocalNotificationCallback) main);
}
if (main instanceof BackgroundFetch) {
backgroundFetchCallback = (BackgroundFetch)main;
}
}
示例3: push
import com.codename1.push.PushCallback; //导入依赖的package包/类
@Override
public void push(final String value) {
final PushCallback callback = getPushCallbackInstance();
if(callback != null) {
Display.getInstance().callSerially(new Runnable() {
public void run() {
callback.push(value);
}
});
} else {
NotificationManager nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Intent newIntent = new Intent(this, getStubClass());
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, newIntent, PendingIntent.FLAG_CANCEL_CURRENT);
Notification notif = new Notification();
notif.icon = android.R.drawable.stat_notify_sync;
notif.tickerText = value;
notif.flags |= Notification.FLAG_AUTO_CANCEL;
notif.when = System.currentTimeMillis();
notif.defaults = Notification.DEFAULT_ALL;
notif.setLatestEventInfo(this, value, "", contentIntent);
nm.notify((int)System.currentTimeMillis(), notif);
}
}
示例4: setMainClass
import com.codename1.push.PushCallback; //导入依赖的package包/类
public static void setMainClass(Object main) {
if(main instanceof PushCallback) {
pushCallback = (PushCallback)main;
}
if(main instanceof PurchaseCallback) {
purchaseCallback = (PurchaseCallback)main;
}
}
示例5: setPushCallback
import com.codename1.push.PushCallback; //导入依赖的package包/类
public static void setPushCallback(PushCallback callback) {
pushCallback = callback;
}
示例6: setPushCallback
import com.codename1.push.PushCallback; //导入依赖的package包/类
/**
* Allows the system to register to receive push callbacks
* @param push the callback object
*/
public static void setPushCallback(PushCallback push) {
callback = push;
}
示例7: getPushCallbackInstance
import com.codename1.push.PushCallback; //导入依赖的package包/类
public abstract PushCallback getPushCallbackInstance();