#1279 - Fix scheduled messages not sending

This was an issue with background services on Android O
This commit is contained in:
Moez Bhatti
2018-09-19 19:33:09 -04:00
parent adf007f92c
commit 116f9824e9
5 changed files with 15 additions and 16 deletions
@@ -22,14 +22,14 @@ import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.os.Build
import com.moez.QKSMS.service.SendScheduledMessageService
import com.moez.QKSMS.receiver.SendScheduledMessageReceiver
import javax.inject.Inject
class AlarmManagerImpl @Inject constructor(private val context: Context) : AlarmManager {
override fun getScheduledMessageIntent(id: Long): PendingIntent {
val intent = Intent(context, SendScheduledMessageService::class.java).putExtra("id", id)
return PendingIntent.getService(context, id.toInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT)
val intent = Intent(context, SendScheduledMessageReceiver::class.java).putExtra("id", id)
return PendingIntent.getBroadcast(context, id.toInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT)
}
override fun setAlarm(date: Long, intent: PendingIntent) {