Archived

This topic is now archived and is closed to further replies.

rizwanahmed24

how to recieve a call while playing game on mobile?

Recommended Posts

rizwanahmed24    122
hi Suppose i am playing a game in mobile, a call comes, i can immediately switch to recieve call and after done with the call i am able to resume the game. How this is done, does the game automatically goes in to pause state? and if it goes in to pause state then how? is there any call back to our application incase of call recieve? how the game is resumed? what i think is there is a callback to our application, we store the game state, and to resume we can read the game state , load it and play. bye

Share this post


Link to post
Share on other sites
RPGeezus    216
When your app is interrupted a pause function (in the midlet interface) gets called.

That is all that happens. It is your job to actually make your app pause. If you don''t then weird things can happen.

When the system retuns to your app it calls startApp again. It''s your responsibility to get your app back to normal again.

Good luck,
Will

BTW: An easy way to test this (on a T720 at least) is by adjusting the volume while in game. It will interrupt your app much like a phone call would, but it''s a lot easier to do than call your cell phone over and over again.

Share this post


Link to post
Share on other sites
Krontaber    122
hi rizwanahmed24,

The implementation depends on which SDK you are using, J2ME or Brew, etc. But one thing you will have to do is to implement a method to receive the phone call state and save your game state like we do when we want to save a game state. Of course you must chose the best way to do it thinking about the low memory of devices and read/write permissions. Go to www.qualcomm.com/brew and download the brew 3.0 sdk. Read the API reference, it has an phone call state sample. Writing code herer would be boring.

Bye

Game developer for mobile devices. BREW/J2ME
www.takenet.com.br

Share this post


Link to post
Share on other sites
Sneftel    1788
Note that the Nokia Series 40s and Series 60s more or less ignore the standard way of doing stuff, never calling the Paused function of the MIDlet. For those phones, the best way I''ve found to check is to test isShown on the canvas each frame.


"Sneftel is correct, if rather vulgar." --Flarelocke

Share this post


Link to post
Share on other sites
psamty10    148
quote:
Original post by Sneftel
Note that the Nokia Series 40s and Series 60s more or less ignore the standard way of doing stuff, never calling the Paused function of the MIDlet. For those phones, the best way I''ve found to check is to test isShown on the canvas each frame.


"Sneftel is correct, if rather vulgar." --Flarelocke


Sanyo phones too.... those SOBs never call pauseApp(), killed my Vegas trip in a time not so long ago...

Share this post


Link to post
Share on other sites
Woody FX    169
I think all phones use hideNotify() and showNotify()
you just need to implement them and it will handle this!

Some phones kill you app as soon as there is a call!

RPGeeezus... whazz up!

Share this post


Link to post
Share on other sites
keless    122
quote:
Original post by Woody FX
I think all phones use hideNotify() and showNotify()
you just need to implement them and it will handle this!


The Nokia 3650''s fairly moody about this one, too. It may have been a hidden problem with my code, but I was unable to get these messages to be received properly. *shrug* YMMV.

Share this post


Link to post
Share on other sites
dot    426
Just handle both. After a few version of evolution, my current midlet starts a thread on startApp, kills the thread on pauseApp, and sets flag for showNotify and hideNotify. Everything works well on every phone.

I remembered I tried to kill threads via show/hideNotify, but it just screws everything up. As it is now, I simply use it for pause flag setting

Share this post


Link to post
Share on other sites