|
|
|
|
@ -3,6 +3,8 @@ package com.deniscerri.ytdl.work
|
|
|
|
|
import android.app.PendingIntent
|
|
|
|
|
import android.content.Context
|
|
|
|
|
import android.content.Intent
|
|
|
|
|
import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE
|
|
|
|
|
import android.os.Build
|
|
|
|
|
import android.os.Handler
|
|
|
|
|
import android.os.Looper
|
|
|
|
|
import android.util.Log
|
|
|
|
|
@ -50,9 +52,12 @@ class TerminalDownloadWorker(
|
|
|
|
|
val intent = Intent(context, TerminalActivity::class.java)
|
|
|
|
|
val pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE)
|
|
|
|
|
val notification = notificationUtil.createDownloadServiceNotification(pendingIntent, command.take(65), NotificationUtil.DOWNLOAD_TERMINAL_RUNNING_NOTIFICATION_ID)
|
|
|
|
|
val foregroundInfo = ForegroundInfo(itemId, notification)
|
|
|
|
|
setForegroundAsync(foregroundInfo)
|
|
|
|
|
|
|
|
|
|
if (Build.VERSION.SDK_INT > 33) {
|
|
|
|
|
setForegroundAsync(ForegroundInfo(itemId, notification, FOREGROUND_SERVICE_TYPE_SPECIAL_USE))
|
|
|
|
|
}else{
|
|
|
|
|
setForegroundAsync(ForegroundInfo(itemId, notification))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val request = YoutubeDLRequest(emptyList())
|
|
|
|
|
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
|
|
|
|
|
|
|
|
|
|