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.
Getting Exception with google play services (Google Places API Android) with 10.2.0
How to make bottom sheet above maps activity?
run single instrumented(android) test case in maven through command line
Is it possible to display 3d models on desktop for Android devices with Android Studio or Unity?
Access USB OTG Storage File for IO with format support FAT, FAT32 and exFAT
Android Studio Canary 2.4 errors
How To Drag an Augmentation Model Using Touch Input
Android app “unfortunately stop”s while running. The error is no activity found to handle intent
Creating new Views by Drag and Drop & Controlling them (custom layouts)
How to find what media codec is being used by Android's media player?
Navigation Drawer Icon Disappearing with Collapsing ToolBar
RecyclerView shared transition and item animator incompatibility?
Android emulator running extremly slow on ubuntu 17.04 compared to windows 10
Why there is no module exit function for android binder driver
I need for expert advice for my android Application Project
Visual Studio Android building assembly files into app