Answers for "restart service ondestroy android"

0

restart service ondestroy android

AppLog.i("System UI Service is Restarting")
        val startSystemUiIntent = Intent(context, AwesomeService::class.java)
        val restartServicePendingIntent = PendingIntent.getService(context, 1, startSystemUiIntent, PendingIntent.FLAG_ONE_SHOT)

        val alarmManager = getSystemService(ALARM_SERVICE) as AlarmManager
        alarmManager.setExact(AlarmManager.RTC_WAKEUP, SystemClock.currentThreadTimeMillis(), restartServicePendingIntent)


        stopService(Intent(context, SystemUIService::class.java))
Posted by: Guest on May-01-2021

Browse Popular Code Answers by Language