本文整理汇总了Java中javapns.devices.implementations.basic.BasicDevice类的典型用法代码示例。如果您正苦于以下问题:Java BasicDevice类的具体用法?Java BasicDevice怎么用?Java BasicDevice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BasicDevice类属于javapns.devices.implementations.basic包,在下文中一共展示了BasicDevice类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: validateObject
import javapns.devices.implementations.basic.BasicDevice; //导入依赖的package包/类
@Override
public boolean validateObject(PushNotificationManager manager) {
PushedNotification notification = null;
try {
notification = manager.sendNotification(new BasicDevice(RandomStringUtils.randomNumeric(64)),
PushNotificationPayload.test());
} catch (Exception e) {
logger.error("validate manager:[{}] due to error:[{}]", manager, ExceptionUtils.getStackTrace(e));
}
return notification != null && notification.isSuccessful();
}
开发者ID:pippo1980,项目名称:upns,代码行数:12,代码来源:PushNotificationManagerPool.java
示例2: push
import javapns.devices.implementations.basic.BasicDevice; //导入依赖的package包/类
private void push(final APNSPushTask event, final List<Device> devices) {
int appId = event.getMessage().getAppId();
final PushNotificationTemplate pushNotificationTemplate = templates.payloads.get(appId);
if (pushNotificationTemplate == null) {
logger.warn("can not find pushNotificationTemplate with appId:[{}], ignore event:[{}]", appId, event);
return;
}
pushNotificationTemplate.push(new PushNotificationProcessor() {
@Override
public void process(PushNotificationManager manager) throws Exception {
//int unread = timelineRepository.unread(event.userId, event.message.appId) + 1;
PushNotificationPayload payload = PushNotificationPayload.combined(event.message.title, 1, "default");
for (Device device : devices) {
if (device.token == null || device.token.length() != 64) {
continue;
}
PushedNotification notification = manager.sendNotification(new BasicDevice(device.token), payload,
false);
if (notification != null) {
logger.debug(
"push message:[{}] to apns[user/device]:[{}/{}], the acknowledge is:[{}], the push result is:{}",
event.message.title,
device.userId,
device.token,
notification,
notification.isSuccessful());
}
}
}
});
}
开发者ID:pippo1980,项目名称:upns,代码行数:38,代码来源:APNSPushTaskConsumer.java
注:本文中的javapns.devices.implementations.basic.BasicDevice类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论