【发布时间】:2015-10-20 14:07:26
【问题描述】:
我正在尝试使用AlarmManager 安排Alarm,它尝试每两小时重新创建一次QuickBlox 会话。我正在通过AlarmManager 在后台调用IntentService。
以下是崩溃的代码:
protected void onHandleIntent(Intent intent)
{
String APP_ID = "xxxx";
String AUTH_KEY = "xxxx";
String AUTH_SECRET = "xxxx";
QBSettings.getInstance().fastConfigInit(APP_ID, AUTH_KEY,AUTH_SECRET);
if (!QBChatService.isInitialized()){
QBChatService.init(getApplicationContext());
}
ChatService.getInstance().chatCreateWriteSessionWithoutPlay(getApplicationContext());}
chatCreateWriteSession的定义如下:
public void chatCreateWriteSessionWithoutPlay(final Context ctx) {
chatService = QBChatService.getInstance();
// Create QB user
final QBUser user = new QBUser();
user.setLogin(AppController.getInstance().getCHAT_ID());
user.setPassword(AppController.getInstance().getCHAT_PASSWORD());
QBAuth.createSession(user, new QBEntityCallbackImpl<QBSession>() {
@Override
public void onSuccess(QBSession session, Bundle args) {
}
@Override
public void onError(List<String> errors) {
}
});
}
【问题讨论】:
标签: android quickblox intentservice android-intentservice