Use startForegroundService instead of startService when available
This commit is contained in:
parent
7a95328bbd
commit
0cee190638
1 changed files with 8 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
package eu.depau.etchdroid.fragments
|
package eu.depau.etchdroid.fragments
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -38,8 +39,13 @@ class ConfirmInfoFragment : WizardFragment() {
|
||||||
|
|
||||||
intent.setDataAndType(StateKeeper.imageFile, "application/octet-stream")
|
intent.setDataAndType(StateKeeper.imageFile, "application/octet-stream")
|
||||||
intent.putExtra("usbDevice", StateKeeper.usbDevice)
|
intent.putExtra("usbDevice", StateKeeper.usbDevice)
|
||||||
activity?.startService(intent)
|
|
||||||
activity?.finish()
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||||
|
activity!!.startForegroundService(intent)
|
||||||
|
else
|
||||||
|
activity!!.startService(intent)
|
||||||
|
|
||||||
|
activity!!.finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||||
|
|
Loading…
Reference in a new issue