I have written a SIP client that makes and receives calls. However, when the application is minimized, it can be unloaded from memory and receive calls accordingly. How to implement an application similar to Skype (until recently), when on launch it appears in the status bar and works until the exit button is pressed? Surely there is an article on this topic, but my searches were not crowned with success.
1 answer
Judging by your confused testimony, we are talking about 3 different components of the application:
- Notification - component responsible for the appearance of the icon in the status bar
- Service is a kind of long-lived component, in principle, you can make it non-paged.
- BroadcastReceiver - component responsible for intercepting incoming calls. To make it "non-paged", it must be declared in the manifest with the flag
exported=true
Compositionally do this:
- We expose the notification, so that when you click on it, the
Activity
your application starts. - We hang
BroadcastReceiver
configured to filter incoming / outgoing SIP calls. When intercepting a call -BroadcastReceiver
will raise the desiredActivity
- The business logic of the application, which should always be at hand, is placed in the
Service
, so that you can access theService
from theActivity
.
PS IMHO you can do without Service
- but the taste and color ...
|