Android audio
Monkey Targets Forums/Android/Android audio
| ||
Hi, Is android audio puasing correctly when user suspends up by clicking home button? This is with latest V31. It works fine here with the 'audiotest' demo in samples, but someone said it didn't...? |
| ||
Hi Mark, I built my newest Monkey game Invaders using v31 and it does continue to play after pressing the home button. You can download the apk here to test: http://www.therevillsgames.com/monkey/invaders/ [Edit: Just had a thought... do we actually have to code the stuff to stop within the OnSuspend events or does Monkey automatically does this for us? ] |
| ||
I think the app should only know it's in OnSuspend mode, but do nothing else. If I make some background music player, it should be able to play sounds and draw on a transparent canvas when the user hits the Home button. |
| ||
Hi, > I built my newest Monkey game Invaders using v31 and it does continue to play after pressing the home button. Would you mind emailing me the source/media? And this is on a Samsung Galaxy S? |
| ||
@therevills I downloaded your apk, but my Galaxy S refuses to install it. Weird, I havent had problem installing any of my own apk before. @Mark I compiled your audiotest from the monkey samples and installed on my phone. All modes from menu (key 1-7) play. Using key 7 (loopsound) the sound stop when I hit the home key. However I cant play my own ogg files. Do you use some custom config for your ogg files? Is there any reason (relatetd to audio) you are setting "SetUpdateRate" low as 15? |
| ||
Sent to your gmail account Mark. Nope my Android phone is the LG Optimus One P500. Also tested on the Nexus One which also continues the sounds/game when the Home key is pressed. @Virtech - What error did you get? |
| ||
> What error did you get? Simply a screen telling the apk was not installed. I tryed several times. |
| ||
Have you got Unknown sources ticked in Settings > Applications ? |
| ||
Yes I have 'usb-debug-mode' & 'unknown-sources' ticked. I noted your apk dont have -debug appended to the filename. When I compile for Android (from Jungle IDE) I always get -debug in the filename. Regardless if I set release or debug. Did you just rename your apk? |
| ||
Yep I renamed it. How are you installing tha apk? When Samah installed it he used the adb.exe: Go to here in CMD: C:\Program Files (x86)\Android\android-sdk\platform-tools Type: adb install MonkeyGame.apk (You might have to copy MonkeyGame.apk to the same folder) |
| ||
Its a very straighforward procedure. - usb cable - transfer the apk to a folder on the sdcard - disconnect usb link - on the phone: browse to the apk file - touch the apk file to start install - open (start) the installed apk |
| ||
Can you try using the adb.exe? Also do you have another MonkeyGame.apk installed on your phone? (If so, can you uninstall it and try again). |
| ||
I tryed using the adb method. Thanks for the tip! That was an even easyer way of installing the apk :) And now your game works on my phone. But its strange it didnt the way I usually do it. Do you know if the adb method also works over wifi? About the sound. Yes I can still hear explosion sounds after I hit the HOME key. So there is definitely a difference in behaviour relative to how you install the apk on the phone. |
| ||
The audiotest sound stops when suspended on my HTC Desire. |
| ||
I don't see any code which stops the sounds in audiotest. It should not stop playing sounds if it's not explicitely wanted by the programmer. Somekind of a IsSuspended() function would be enough, then the programmer can choose if he wants to stop the sounds, which is usually the case for games, or if he wants to keep the sounds playing when the user presses the home button, which is good for music players. The Android home button is exactly the same as the Show Desktop button in Windows, it should only defocus (=IsSuspended()=true) the apps, but not do anything else. On my Android emulator it stops the sound when I press the home button, which is bad. |