0

I am developing the SIP application for call and i have used AlertDialog for incoming call notification but its not feasible because when application is running on the background and someone calls, the "call screen" isn't been launched.what should i do? should i create a new screen for that or i can use the native incoming call screen? if you have idea about this please let me know. thanks in advance. Related this question:see this link.

Community
  • 1
  • 1
Juned
  • 6,290
  • 7
  • 45
  • 93

1 Answers1

1

You should register the intent filter with a service and then launch the activity with the AlertDialog style form the service.

pablisco
  • 14,027
  • 4
  • 48
  • 70
  • can you explain me in detail how do i achieve this task? i have used FLAG_ACTIVITY_NEW_TASK and it opens the dialog while application is on background but the problem is when i am clicking on any button either accept or reject the application is crashes. please see this [link](http://stackoverflow.com/questions/9766679/application-crashes-while-using-a-method-of-different-class) – Juned Mar 19 '12 at 11:22
  • Can you post the crash? Thanks – pablisco Mar 19 '12 at 14:18
  • java.lang.Nullpointerexception com.example.android.sip.IncomingCallReceiver.acceptCall(IncomingCallReceiver.java:123) com.example.android.sip.IncomingCallPage$1.onClick(IncomingCallPage.java:31) com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:159) android .os.handler.dispatchmessage(Handler) android .os.looper.loop.java:123 android.app.ActivityThread.main(ActivityThread.java:3683) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) Caused by: java.lang.InstantiationException: com.example.android.sip.IncomingCallReceiver – Juned Mar 19 '12 at 14:45
  • @ pablisco to verify the code please see the link which i have mentioned in first comment. thanks – Juned Mar 19 '12 at 14:48
  • Well, that's a NullPointerException. One of the easier exceptions to fix. It means that the app is trying to access a pointer that has no memory address assigned to it. Try entering the `acceptCall()` method from debug mode on Eclipse and see what it is that is null. – pablisco Mar 19 '12 at 17:09
  • yeah you are right. Actually the code for acceptCall() method is written in incomingCallReciever.java file and i am accessing this method in incomingCallpage.java. if i am calling this acceptCall() method in incomingCallreciver.java then it works properly rather then it gives me nullpointer exception. – Juned Mar 20 '12 at 05:35
  • even i dont know how to enter the method from debug mode on eclipse. – Juned Mar 20 '12 at 07:39
  • i tried with this. i am getting the listener as a null which receives the incoming call.this is happens because i am moving to different activity on this page all value becomes null and i am getting this NullpointerException.so the problem is context only.what is the solution of this problem? why that values becomes null when i am calling that method from another class? – Juned Mar 20 '12 at 10:47
  • I think you are not using the BroadCastReceiver correctly. Have a look at this tutorial: http://www.vogella.de/articles/AndroidServices/article.html Saying that I am not going to post any more comments since this is not a chat. Good luck. – pablisco Mar 20 '12 at 11:18