本文整理汇总了Java中com.avos.avoscloud.PushService类的典型用法代码示例。如果您正苦于以下问题:Java PushService类的具体用法?Java PushService怎么用?Java PushService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PushService类属于com.avos.avoscloud包,在下文中一共展示了PushService类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initAVSDK
import com.avos.avoscloud.PushService; //导入依赖的package包/类
private void initAVSDK(Context context) {
Map map = this.getAppInfo();
if(map != null && map.get("appId") != null && map.get("appKey") != null) {
// 初始化应用信息
String appId = map.get("appId").toString();
String appKey = map.get("appKey").toString();
AVOSCloud.initialize(context, appId, appKey);
// 启用崩溃错误统计
AVAnalytics.enableCrashReport(context.getApplicationContext(), true);
AVOSCloud.setLastModifyEnabled(true);
AVOSCloud.setDebugLogEnabled(true);
//必须要设置默认的通知回调或者订阅一个频道,否则接收不到通知
mRNPushNotificationHelper = new RNPushNotificationHelper(this.mApplication);
PushService.setDefaultPushCallback(context.getApplicationContext(), mRNPushNotificationHelper.getMainActivityClass());
//this.subscribeChannel("public");
// 保存 installation 到服务器
AVInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
public void done(AVException e) {
String installationId = AVInstallation.getCurrentInstallation().getInstallationId();
sendRegistrationToken(installationId);
}
});
}
}
开发者ID:zzzkk2009,项目名称:react-native-leancloud-sdk,代码行数:27,代码来源:AvOsCloudPackage.java
示例2: onCreate
import com.avos.avoscloud.PushService; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
// AVOSCloud.useAVCloudUS();//
CrashReport.initCrashReport(getApplicationContext(), "900020615", false);
// CrashReport.testJavaCrash();
AVOSCloud.initialize(this, "6vNrCi5ou4rw5sb0fx8b0J4w-gzGzoHsz", "zfuBYXx8X235VVi6O7acOM8G");
AVInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
public void done(AVException e) {
if (e == null) {
// 保存成功
String installationId = AVInstallation.getCurrentInstallation().getInstallationId();
// 关联 installationId 到用户表等操作……
} else {
// 保存失败,输出错误信息
}
}
});
PushService.setDefaultPushCallback(this, UpdateActivity.class);
}
开发者ID:JianxunRao,项目名称:FangYanShuo,代码行数:21,代码来源:MyApplication.java
示例3: onCreate
import com.avos.avoscloud.PushService; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
initData();
}
// 接受消息推送 广播 数据 处理相应逻辑
if (BROAD_RECEIVER_ACTION.equals(getIntent().getAction())) {
Bundle bundle = getIntent().getBundleExtra(PushBroadcastReceiver.BROAD_DATA_KEY);
String title = bundle.getString("title");
Log.i(BROAD_RECEIVER_ACTION, title);
}
// 第三方SDK初始化
AVInstallation.getCurrentInstallation().saveInBackground();
PushService.setDefaultPushCallback(this, MainActivity_.class);
FeedbackAgent agent = new FeedbackAgent(this);
agent.sync();
UmengUpdateAgent.update(this);
BmobPay.init(this, Constants.BMOB_APPLICATION_ID);
}
开发者ID:AndroidCreativeDesign,项目名称:AndroidSharingPlatform,代码行数:23,代码来源:MainActivity.java
示例4: initAVSDK
import com.avos.avoscloud.PushService; //导入依赖的package包/类
private void initAVSDK() {
// We need to run this on the main thread, as the React code assumes that is true.
// Namely, DevServerHelper constructs a Handler() without a Looper, which triggers:
// "Can't create handler inside thread that has not called Looper.prepare()"
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
// 初始化应用信息
AVOSCloud.initialize(getApplication().getApplicationContext(), leancloudAppId, leancloudAppKey);
// 启用崩溃错误统计
AVAnalytics.enableCrashReport(getApplication().getApplicationContext(), true);
AVOSCloud.setLastModifyEnabled(true);
AVOSCloud.setDebugLogEnabled(true);
Context context = getApplication().getApplicationContext();
Intent pushService = new Intent(context, PushService.class);
context.startService(pushService);
//必须要设置默认的通知回调或者订阅一个频道,否则接收不到通知
mRNPushNotificationHelper = new RNPushNotificationHelper(getApplication());
PushService.setDefaultPushCallback(getApplication().getApplicationContext(), mRNPushNotificationHelper.getMainActivityClass());
//this.subscribeChannel("public");
// 保存 installation 到服务器
AVInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
public void done(AVException e) {
String installationId = AVInstallation.getCurrentInstallation().getInstallationId();
sendRegistrationToken(installationId);
}
});
}
});
}
开发者ID:zzzkk2009,项目名称:react-native-leancloud-sdk,代码行数:36,代码来源:RNPushNotificationRegistrationService.java
示例5: initChat
import com.avos.avoscloud.PushService; //导入依赖的package包/类
/**
* 初始化聊天系统所必须的
*/
private void initChat() {
AVIMMessageManager.registerDefaultMessageHandler(new DefaultHandler(this));
//开启推送
AVInstallation.getCurrentInstallation().saveInBackground();
// 设置通知默认打开的 Activity
PushService.setDefaultPushCallback(this, LoginActivity.class);
AVIMMessageManager.setConversationEventHandler(new MyConversationEventHandler(this));
AVIMClient.setOfflineMessagePush(true);
}
开发者ID:ChenAt,项目名称:PlayTogether,代码行数:15,代码来源:MyApplication.java
示例6: initLeanCloud
import com.avos.avoscloud.PushService; //导入依赖的package包/类
private void initLeanCloud() {
AVOSCloud.initialize(this, BuildConfig.LEANCLOUD_APP_ID,BuildConfig.LEANCLOUD_APP_KEY);
AVInstallation.getCurrentInstallation().saveInBackground();
PushService.setDefaultPushCallback(this, HomeActivity.class);
AVAnalytics.enableCrashReport(this, true);
setNotification(PreferenceManager.getDefaultSharedPreferences(this));
}
开发者ID:linroid,项目名称:Sky31Radio,代码行数:8,代码来源:App.java
示例7: setNotification
import com.avos.avoscloud.PushService; //导入依赖的package包/类
private void setNotification(SharedPreferences sharedPreferences){
boolean enableNotification = sharedPreferences.getBoolean(getString(R.string.pref_allow_new_program_notification), true);
Timber.d("setNotification:%s",String.valueOf(enableNotification));
if(enableNotification){
PushService.subscribe(this, Constants.CHANNEL_NEW_PROGRAM, HomeActivity.class);
}else{
PushService.unsubscribe(this, Constants.CHANNEL_NEW_PROGRAM);
}
}
开发者ID:linroid,项目名称:Sky31Radio,代码行数:10,代码来源:App.java
示例8: init
import com.avos.avoscloud.PushService; //导入依赖的package包/类
public void init(Context context) {
this.context = context;
PushService.setDefaultPushCallback(context, SplashActivity.class);
subscribeCurrentUserChannel();
}
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:6,代码来源:PushManager.java
示例9: subscribeCurrentUserChannel
import com.avos.avoscloud.PushService; //导入依赖的package包/类
private void subscribeCurrentUserChannel() {
String currentUserId = HiTalkHelper.getInstance().getCurrentUserId();
if (!TextUtils.isEmpty(currentUserId)) {
PushService.subscribe(context, currentUserId, SplashActivity.class);
}
}
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:7,代码来源:PushManager.java
示例10: unsubscribeCurrentUserChannel
import com.avos.avoscloud.PushService; //导入依赖的package包/类
public void unsubscribeCurrentUserChannel() {
String currentUserId = HiTalkHelper.getInstance().getCurrentUserId();
if (!TextUtils.isEmpty(currentUserId)) {
PushService.unsubscribe(context, currentUserId);
}
}
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:7,代码来源:PushManager.java
示例11: onCreate
import com.avos.avoscloud.PushService; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
mApp = this;
AVOSCloud.initialize(this, "gDpARhub8jcfHz7vYKGsDhP9-gzGzoHsz", "gvbvf4DiEbIest3NLWocwT3s");
//AVOSCloud.initialize(this, "pySLrj5CnOhCxhUE5bK7OBUn-gzGzoHsz", "H2hUpKhbI3MGBpsoXfi8F0LS");
//启动消息推送服务
PushService.setDefaultPushCallback(this, MainActivity.class);
//启动即时通信服务
AVIMMessageManager.registerMessageHandler(AVIMTypedMessage.class, new LCIMMessageHandler(this));
PushService.subscribe(this, "public", HomeActivity.class);
AVInstallation.getCurrentInstallation().saveInBackground();
LCChatKit.getInstance().setProfileProvider(CustomUserProvider.getInstance());
AVOSCloud.setDebugLogEnabled(true);
LCChatKit.getInstance().init(getApplicationContext(), APP_ID, APP_KEY);
}
开发者ID:linsir6,项目名称:TripBuyer,代码行数:27,代码来源:BaseApplication.java
示例12: subscribeChannel
import com.avos.avoscloud.PushService; //导入依赖的package包/类
private void subscribeChannel(String channel) {
PushService.subscribe(AVOSCloud.applicationContext, channel, mRNPushNotificationHelper.getMainActivityClass());
}
开发者ID:zzzkk2009,项目名称:react-native-leancloud-sdk,代码行数:4,代码来源:RNPushNotificationModule.java
注:本文中的com.avos.avoscloud.PushService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论