While I'm searching around these forums and elsewhere, I thought I might as well post hoping for an answer.
What steps do I need to take to:
1) recognize an incoming phone call on a PPC Phone Edition device (Samsung i700 to be exact)
2) hide/minimize my GD app
3) restore the GD app when the user decides they want to
I need to ensure all surfaces are restored as well.
Is this the typical scenario for Phone Edition devices, or are there more steps required?
Basically you can't detect incoming phone calls on either the Smartphone or the PPC Phone Edition. What you can detect however is lost focus.
Simply set config.bMinimizeOnLostFocus to TRUE and you should be set...
You may also be interested in the bMinimizedActive field of the GDAPPCONFIG struct as well as the one Johan mentioned.
I guess you could use the CGapiDisplay::SurfacesAreLost within the OnRestore event to check for surface issues?
You may also want to turn off looping sounds etc within the OnMinimize event

Thanks! I'll give these suggestions a try.
Do you know of a way to simulate these events on a non-Phone Edition device (or the desktop)?
Here's what is happening on an i700 device - the game plays fine, but ignores any incoming phone call as though it never happened. The phone essentially never rings through (at least the user doesn't hear it ring). Not having one to test on directly makes it difficult to debug.
config.bMinimizeOnLostFocus = true
config.bMinimizedActive = true
These seem to what I was looking for. Thanks!
I presume I should call SurfacesAreLost() in ProcessNextFrame(), and if the return value is GDERR_SURFACELOST I need to call RestoreAllVideoSurfaces(). Should I also recreate all of my surfaces as a rule of thumb, or should I only do that if I get back GDERR_NOTINITIALIZED as the return code?
ppc: As a rule of thumb you should recreate all surfaces that could be created in video ram if surfaces are lost (i.e. dwFlags = NULL or some VIDEO parameter). No need to recreate those created in system memory.
It's best to consider stuff like video surfaces right now, because as soon as a device with enough VRAM is out there we will support it in GapiDraw...
Ok, so I'll simply recall my CreateSurfaces() methods whenever I get back a GDERR_SURFACELOST result from SurfacesAreLost(). Thanks!
Um. Also, if you use the new GapiApplication from 2.x, CreateVideoSurfaces are automatically called if surfaces should be lost....
Hmmm... so, I don't really have to test for lost surfaces in ProcessNextFrame, I can just setup CreateVideoSurfaces to rebuild my surfaces and it will be called as needed?
Yep..

You can check gapiapplication.cpp - search for "lost"...
Just a couple other tips I found.
CreateVideoSurfaces is called at program startup, so if you have a couple of surface load routines like I do (I load a few surfaces at startup, then load more after I display some splash screens so the user doesn't wait around with nothing happening), set a bool to say you're at startup so you can exit CreateVideoSurfaces before doing any work.
OnMinimize() and OnRestore() are great hooks for turning music on and off. You certainly don't want music playing in the background while you're trying to take a call.
I assume all of this should work the same for:
- Manual minimize.
- Smartphone incoming calls.
- Appointment reminders.
- Low battery warnings.
Am I right?
Do you know of a way to simulate these events on a non-Phone Edition device (or the desktop)?
I believe you can simulate a LostFocus event in the same way as a calendar event or notification pops up. These events function the same way as an incoming phone call event.
ppcStudios wrote:OnMinimize() and OnRestore() are great hooks for turning music on and off. You certainly don't want music playing in the background while you're trying to take a call.
This has been one of my problems too. My games minimize and was able to detect a LostFocus event but after that event has ended, the user has to go to the "running programs" list and select the game to be able to make it focused. Is there a way an app can automatically grab the focus after an event?
Is there a way an app can automatically grab the focus after an event?
Unfortunately not.. The "back" button works in some cases, but not all. It seems that the back button does not send proper notification events to the applications.
Re-launching the application is the safest way, and it is also how it works on all Symbian devices...
OK I have minimize working nicely on Pocket PC 2002.
Here's one weird thing that happens. I've had it happen when I minimize, and the SIP input area is revealed, then when I restore my game over top of it, it looks fine, but...
When I move the stylus over the area of the screen where the SIP is underneath, it reveals parts of the SIP under the stylus when it moves, and when it stops moving, the SIP is gone again.
Then I do a minimize, get rid of the SIP, and restore, and the problem is gone.
Is this normal?
Along the same lines of discussion, how does one disable OS settings like button clicks etc when launching a GD app? and what else if anything should be turned off, and then re-inabled after the app exits?
-B
mlepage: I will look into this and see if I can fix it up for 3.01 final...
brendan: Good question.. I wasn't actually aware that button clicks still made a sound (but they should probably do so).. I always turn of the button sound the first thing I do with a new phone... Perhaps people who want their buttons to sound when pressed also want this in their games too?

mlepage: Could you please try to add the line ":SHSipPreference(hWnd, SIP_DOWN);" before the line "::SHFullScreen(hWnd, SHFS_HIDESTARTICON | SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);" in ToggleFullscreen() and see if it solves the issue. If so, I'll add it to the 3.01 update...
Yep, they sure do click, I've got a new O2 xphone, and I'm beta testing my current game on it, and everytime I hit a button I get the OS click (along with my custom click).
This msdn article discuss' it briefly, along with the benifits to game framerates if disabled. but the example they give is only in XML, does anyone know a simple way to test what it is, disable it, and turn it back on at the end? or should I just use the example with builtin function?
http://msdn.microsoft.com/library/defau ... egames.asp