F
F
foonfyrick2021-01-15 10:31:19
Android
foonfyrick, 2021-01-15 10:31:19

PendingResuld vs BroadcastReceiver?

I’m figuring out how to use the service on a statrandroyd, they showed 2 methods of data exchange, through pendingResult and through broadcastReceiver, and which one should be used when? Or maybe one of them is outdated and should not be used?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2021-01-15
@foonfyrick

I'll tell you so. You will need a service with a very small probability. Basically now it is playing sounds and the like, in the background, with the foreground flag and a notification. Such a service will not transfer data anywhere. If there is ui, it's easier to just bind it and that's it.
Broadcast receiver in 2021 is needed only for interprocessor communication, and not within a single application, that's for sure.
Upd is a non-foreground service in modern androids, after the application goes into the background, it lives for a very, very short time. Seconds.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question