aspose file tools*
The moose likes Android and the fly likes Incoming Call Screen obstruction by an Activity (Theme Dialog) over it. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Incoming Call Screen obstruction by an Activity (Theme Dialog) over it." Watch "Incoming Call Screen obstruction by an Activity (Theme Dialog) over it." New topic
Author

Incoming Call Screen obstruction by an Activity (Theme Dialog) over it.

Sangel Kapoor
Ranch Hand

Joined: Jan 12, 2013
Posts: 91

Hello geeks

I am trying to show an Activity (with Theme Dialog) over an Incoming call Screen to show some information. I am done with the that, but the problem is whenever the call comes, Activity Dialog pops up over it and it covers SLIDER ( for accepting/Rejecting calls) .

I want the Activity Dialog over Incoming call screen but still wants the user to pick/reject calls.

Warm Regards
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

You will have to add controls to your activity to handle the accept / reject calls.


Steve
Sangel Kapoor
Ranch Hand

Joined: Jan 12, 2013
Posts: 91

@Steve It seems like this is not the case as the following and many other apps are doing the same

Try this : [Current Caller ID] https://play.google.com/store/apps/details?id=com.webascender.callerid&hl=ms

Sangel Kapoor
Ranch Hand

Joined: Jan 12, 2013
Posts: 91

@Steve

Moreover iff you see Toast behavior , it does not obstruct the behavior of incoming call screen.

Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Sahil Rally wrote:@Steve

Moreover iff you see Toast behavior , it does not obstruct the behavior of incoming call screen.



Toasts are a special UI mechanism, it is hard to equate your UI to them. But it did get me thinking.

Toasts are sort of like timed modal dialogs. They actually do prevent interacting with the UI for a brief period of time (at least on my phones.) I know Android has Modal Dialog support (see http://developer.android.com/guide/topics/ui/dialogs.html). But do they have non-modal dialog support?

Turns out they do. There is a flag in the Windows Manager that can help: FLAG_NOT_TOUCH_MODAL. So you would use a Dialog to display your stuff, and when you make the dialog use myDialog.getWindow().setFlags() with the FLAG_NOT_TOUCH_MODAL flag.

See if that helps you out. I think when dialogs appear they actually dim the background making it hard to see what is around them (to keep your focus). I am sure this is also a Flag, probably in the same WindowManager.LayoutParams class.
Sangel Kapoor
Ranch Hand

Joined: Jan 12, 2013
Posts: 91

@Steve

I am already using this flag. This flag is used in order to send the user touch events to the windows behind it. But the problem is i cannot see the slider behind it, only slider is invisible, the other part ie the Incoming phone number is visible.


Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

I have been playing around with it a bit, and had the same thing happen a few times - off and on, so I figured it was a timing issue. I added a Thread.sleep(1000) in the phone state listener before showing the Activity I overlayed on the screen and that seemed to make the thing behave smoother. This is in the emulator so a real phone may need less time (I didn't really try any value but 1000).

One thing I noticed is the Animation on the incoming call screen does not continue, but the control is there and functional.

The activity
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

p.s. You probably shouldn't use Thread.sleep(), rather use a scheduler (like the Handler) to postpone the startActivity() call.
Sangel Kapoor
Ranch Hand

Joined: Jan 12, 2013
Posts: 91

I tried , issue is not of timings, issue is not being able to touch the Slider behind since it disappears when my avtivity is launched over it. The problem still persists ....

I used the following in my Activity


and my manifest dictates





Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Sahil Rally wrote:I tried , issue is not of timings, issue is not being able to touch the Slider behind since it disappears when my avtivity is launched over it. The problem still persists ....

Did you try the delay? As I said, in my code above I saw the same behavior. After analyzing it looks like the phone activity gets built in 3 parts. The background, the top portion where the person's picture/incoming info appears, and the bottom part where the answer/reject control sits. It seems (in my demo code) when the dialog appeared before one of the parts, that part would not show up, and it would be most likely to appear before the answer/reject section was visible.

The delay pushed the dialog to not show until after all components were made.

So, 2 things to try:
1) Add the delay before showing your activity
2) Try my code and see if you get different behavior

Sangel Kapoor
Ranch Hand

Joined: Jan 12, 2013
Posts: 91

I was already doing the delay, since the Dialog activity goes behind the incoming call screen.

Here is the code.... Seems like if my Dialog activity launches after the "Second Part" and before the "Third part (ie Answer dialer) , then everything woks fine.


Here is my code..... dont know where the problem is..... and the fact is other applications are successfully doing this.....


Sangel Kapoor
Ranch Hand

Joined: Jan 12, 2013
Posts: 91

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Incoming Call Screen obstruction by an Activity (Theme Dialog) over it.