Да, можно, используя Context и Binding.
Создать Service:
Наследуется от Service
(или IntentService
/JobIntentService
).
Реализовать onBind(Intent intent)
который возвращает IBinder
.
kotlin
Подключиться из Activity:
Использовать Context.bindService()
.
Реализовать ServiceConnection
.
kotlin
Да, можно, используя Context и Binding.
Создать Service:
Наследуется от Service
(или IntentService
/JobIntentService
).
Реализовать onBind(Intent intent)
который возвращает IBinder
.
kotlin
Подключиться из Activity:
Использовать Context.bindService()
.
Реализовать ServiceConnection
.
kotlin
Register or sign in to get access to full answers for all questions from the question bank.