I'm trying to create an application that can use the android as a fax machine, IE Send a picture as a fax or receive a fax and save as a picture. So far I'm starting from the ground up and making sure I can intercept a call at the users discretion. I have an Receiver registered in the Manifest of my program with a filter of Phone_State which flags when the state has changed(IE incoming call).
So on my BroadcastReceiver I'm trying to have an AlertDialog popup prompting the user to either accept as fax or call but the AlertDialog seems to throw a android.view.WindowManager$BadTokenException Error when it has an incoming call. My code is just simple an onReceive(context arg0, intent arg1) and I pass the arg0 to the AlertDialog...
The full error message is below
08-08 00:16:14.315: ERROR/AndroidRuntime(275): java.lang.RuntimeException: Unable to start receiver com.android.fax.IncomingFax: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
08-08 00:16:14.315: ERROR/AndroidRuntime(275): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2550)
08-08 00:16:14.315: ERROR/AndroidRuntime(275): at android.app.ActivityThread.access$3000(ActivityThread.java:116)
08-08 00:16:14.315: ERROR/AndroidRuntime(275): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1843)
From what I have seen in the AlertDialog code, it passes the context as well as a Window and WindowManager, which I believe is why it's crashing, is there a better way or something else I should be using which might overlay the call screen?