Is there a way for Hollywood apps to be notified when there is an interuption, like an incoming call, or if the user accidently touches the home or menu button?
I want to detect this to be able to set my game into pause.
Edit. Will InactiveWindow work for android, even if it is in fullscreen?
Detect incoming calls on android
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Detect incoming calls on android
The InactiveWindow event handler is supported on Android but I don't know if it's going to trigger on incoming phone calls... it should definitely trigger when hiding the app.
Re: Detect incoming calls on android
Unfortunately it does not seem to trigger on android for me.airsoftsoftwair wrote: ↑Mon Sep 09, 2019 5:16 pm The InactiveWindow event handler is supported on Android but I don't know if it's going to trigger on incoming phone calls... it should definitely trigger when hiding the app.
I have this piece of code in my game, which does set the game on pause when I run it in windows and switch to another program.
But running it on android does not set pause mode if I activate another app.
Code: Select all
InstallEventHandler({InactiveWindow = p_HandlerFunc})
Function p_HandlerFunc(msg)
Switch(msg.action)
Case "InactiveWindow":
paused = True
DisplaySprite(22, 225, 175)
EndSwitch
EndFunction
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Detect incoming calls on android
Which Android version and how do you switch to another app?
Re: Detect incoming calls on android
I have tested on android 9.0 (my main phone), 8.1.0(tablet), and 4.2.1(old phone)airsoftsoftwair wrote: ↑Fri Sep 27, 2019 11:35 pm Which Android version and how do you switch to another app?
The way I switch to other app is tested on all devices, by either pressing the home button, or use the menu button to show all running apps and select another app. The game continues to run, without going to pause mode.
Additionally I have tested on my phone to get an incoming call while playing the game, then by accepting the call the phone switch to the calling screen, and still the game continues to run in the background.
Re: Detect incoming calls on android
Here is a small app for testing this with hollywood player on android.
I just realized that my example shown above was not a good example, since installeventhandler must be put after function in order to work.
I just realized that my example shown above was not a good example, since installeventhandler must be put after function in order to work.
Code: Select all
@DISPLAY {Title = "Test", Width = 640, Height = 480, Color = #BLUE}
Function p_HandlerFunc(msg)
Switch(msg.action)
Case "InactiveWindow":
TextOut(10,10, "INACTIVITY DETECTED")
Case "CloseWindow":
sel = SystemRequest("Quit?", "Quit app?", "Yes|Cancel")
If sel = 1 Then End
ResetTimer(2)
EndSwitch
EndFunction
InstallEventHandler({InactiveWindow = p_HandlerFunc, CloseWindow = p_HandlerFunc})
Repeat
CheckEvent()
Forever
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Detect incoming calls on android
Ok, this is not a bug. "InactiveWindow" and "ActiveWindow" are triggered when using multiple Hollywood displays and cycling through them. What you want is listening to "HideWindow" and "ShowWindow". Those will trigger when minimizing and deminimizing the app...
Re: Detect incoming calls on android
Thank you. I just compiled a version using HideWindow, and it does trigger when the app is sent to the background. It will not trigger directly on incoming calls, since the hollywood app window still is active behind the popup call buttons. When the call is accepted, the app window will be hidden and HideWindow is triggered.