当前位置: 首页>>代码示例>>Java>>正文


Java PushCallback类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:27,代码来源:PushNotificationService.java

示例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;
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:18,代码来源:IOSImplementation.java

示例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);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:24,代码来源:PushNotificationService.java

示例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;
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:IOSImplementation.java

示例5: setPushCallback

import com.codename1.push.PushCallback; //导入依赖的package包/类
public static void setPushCallback(PushCallback callback) {
    pushCallback = callback;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:4,代码来源:IOSImplementation.java

示例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;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:8,代码来源:CodenameOneImplementation.java

示例7: getPushCallbackInstance

import com.codename1.push.PushCallback; //导入依赖的package包/类
public abstract PushCallback getPushCallbackInstance(); 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:2,代码来源:PushNotificationService.java


注:本文中的com.codename1.push.PushCallback类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。