Android SIP Service Persistence
I have a messaging and SIP app that needs to listen for received messages, incoming calls, etc. in the background, and then display or output them in various activities (depending on message type). My question is: what is the best way to accomplish the SIP part of this? AsyncTask, Service, IntentService, etc.? So, when my app starts, I initially start a startup activity which shows a loading indicator, shows loading status to the user, takes care of some initial things (like checking in with our server application, setting sound level, etc.). At that point, I'd like to then register as a SIP client with my SIP server, and sit there listening for incoming calls in the background, while other activities may run in the foreground (like a clock or WebView with a web page, etc.). If a SIP call comes in, I need the background SIP client to answer it and take over the screen from whatever activity may have been there. Originally, I began with an AsyncTask for my SipListener class; but have two concerns: 1) I don't want to risk memory leaks, and 2) I couldn't get the SIP client to persist after successful registration with the SIP server (so, no incoming calls were being listened for, much less answered). Next, I tried porting my SipListener class into a Service. But the problem was that I couldn't even register because SIP is a network service and I was getting Network-on-Main-Thread exceptions. Now, I'm seeing this IntentService option, and wondering if that's the way to go? I'm learning Android, so I know just enough to be dangerous, as they say! Can someone point me in the right direction?
You can implement Sip in service, not only listener, and start an activity or push a notification on incoming call (messages). if you want to challenge yourself check out Linphone for android. Try to build it, it will be great practice for you, use it and customize. Also they have a Service, that can help you. Good luck.
Draw multiple rectangles on button click on the same canvas in android
I'm struggling to find helpful, clear resources for OpenCV
android app invoking google map with car,public,walking controls
Clues about reason for dropping into Debug mode seem convoluted
Changing the color of over scroll in scrollview in android
Android: TabActivity deprecated using Fragment instead
how to customize audio recording quality in android?
MultiPoint Bluetooth Connection
easier way of doing both portrait and landscape in one xml file? in android
lock canvas fail when using MediaPlayer with Surfaceview
“Unfortunately (my app) has Stopped” error when trying to run my application
Convert String to Double excluding part of the string
populate a list in callback method of fragment
Azimuth in android
How to add elements to multidimensional arrayList
android bluetooth application unresponsive during phone call