Я пытаюсь запланировать Alarm
с использованием AlarmManager
, который пытается воссоздать сеанс QuickBlox
каждые два часа. Я звоню IntentService
в фоновом режиме через AlarmManager
.Quickblox создает сеанс, вызванный службой замысла
Ниже приведен фрагмент кода, который выходит из строя:
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) {
}
});
}