Android :: Cannot Stop Soundpool Loop Even After Exiting Application
Nov 4, 2010
I have a timer thread setup to play a loop using soundpool, but for some reason I cannot get _soundPool.stop(_playbackTimer); to stop the loop. even if I exit the application the loop keeps running. I have to physically power off the phone to get it to stop. am I missing something here? Does anyone have any experience with this? I have searched with no resolution. below is a snippet.
if(timeLeft>0 && timeLeft<20 && ticking == false){ _soundPool.play(_playbackTimer, 0.3f, 0.3f, 0, -1, 1); ticking=true; }
if(timeLeft==0 || timeLeft>20){ _soundPool.stop(_playbackTimer); ticking=false; }
View 2 Replies
Jul 13, 2009
I have a service receiving and sending data to a server in separate threads each. The service lifecycle methods look like this:..................
View 3 Replies
View Related
Aug 22, 2010
What is the Easiest way to stop a soundpool of 4 streams.
mSoundManager.addSound(1, R.raw.svphorn);
mSoundManager.addSound(2, R.raw.svpphaser);
mSoundManager.addSound(3, R.raw.svpwail);
mSoundManager.addSound(4, R.raw.svpyelp);
I need a button to stop all sounds playing @ one time.
View 1 Replies
View Related
Aug 28, 2010
What I have here is a simple button that plays a looped sound while it's pressed. It works great. However, sounds.autoPause(); wasn't introduced until API 8 and I really need something that is cupcake compatible (API 3) So i was going through the dev reference site filtered by API 3 stuff and i saw pause so i figured i'd try sounds.pause(sound); but it doesn't stop the sound when i release it. (Maybe i'm just using it wrong?) Does anyone know of a cupcake friendly way to stop this sound? thanks!
sounds = new SoundPool(5, AudioManager.STREAM_MUSIC, 0); sound = sounds.load(this.getApplicationContext(), R.raw.red_long_one, 1); Then here's my touch event................
View 4 Replies
View Related
Jul 29, 2009
I have an app that receives and stores SMS messages. The main use is to run in the background, although it does have a full GUI when running in the foreground. I'm using a notification with the FLAG_ONGOING_EVENT flag so users can tell the application is running, even if it's in the background. However, the user could easily close the app by viewing the main screen and clicking the back button. The notification icon goes away, but I would like to be able to warn the user that closing the app would prevent it from capturing the SMS messages. Is there any way to prompt the user if they really want to exit the application when they hit the back button, and prevent the exit if they say no? Or should I take a different approach? And a bonus question: is there a way of receiving an SMS message, but prevent it from passing on to, say, the Messenging app?
View 5 Replies
View Related
Jan 14, 2010
I am seeing a curious behaviour in my app. I have a widget that gets updated by a service every # hours, when the service finishes I stop it, using "stopService(new Intent(this, MyService.class));", the widget if pressed launches an Activity. Now it gets interesting, while im on the activity everyting works fine, then when I exit the app(by the back key or a button I designed which simply calls this.finish() ) the ActivityManager would tell me that my process has died, I do not see any error of any kind, just that the process has died.
Why I am seeing that message and what does it mean exactly? That is having a side effect on my service regarding static variables getting set to default. Could my code be the cause of this? Is there any way to know that your process has died? I have tested my app on a HTC Hero running 1.5, it always works well on the emulator and I never get that message. I know android kills processes to reclaim memory but Im always careful to close apps heavy on resources.
View 4 Replies
View Related
Nov 18, 2009
I would like to know how to execute code before exiting application. My application is composed of several activities. When the user starts the application (from the launcher menu or from a notification in the status bar), he goes in an InitActivity where I process some initializations. From user experience, application always restarts. One of these initializations is to init a network manager and start a thread that periodically sends a network request to notify a server that application is active.
I need to process some end operations, like stopping this thread when user quits application, for example by pressing the HOME key or BACK key when he's in the root activity. However, when the user press the HOME key, application is still running in background.
Q1 : is it possible to execute code when exiting application (I see the onTerminate() method of the class Application but it seems not to be always called)?
Q2 : Is it possible to force application exit (activity method finish () only destroy the current activity, not the application)?
Q3 : Is it possible to handle HOME key press (onKeyDown() is not called when this button is pushed)?
View 3 Replies
View Related
Mar 5, 2009
Say a user runs my app from the HOME screen. The app has 3 tabs. Say he/she selectes a different tab, so he/she is in a different screen (same task). Now - if the user presses BACK - the device returns to the HOME screen. If the user launches my app again - the default tab is shown. BUT - if the user presses HOME - the device returns to the HOME screen (same). If the user launches my app again - the OTHER tab is shown.
I understand (sort of) the logic - BACK returns to previous app, popping my app from the history stack, so when launched again - it is started from scratch. But this is confusing my customers - they say it's a bug ! They dont understand the different between two keys doing the same thing as far as they see (returning to HOME). Moreover - I see a different behavior with the built-in DIALER app - I change tabs, press HOME, launch the app again - and it starts with the default tab.
View 11 Replies
View Related
Feb 9, 2010
With Android Eclair 2.1 on ARM-based target, we are executing Instrumentation test application from command line:
am instrument -e class android.app.foo. -w com.android.cts.foo.MyTestApp/android.test.InstrumentationTestRunner
Test application executes fine, showing result of the sub-tests in the MyTestApp. But, Application Manager is not exiting properly. This is observed from "ps" command output:
1114 0 52328 S app_process /system/bin com.android.commands.am.Am in....
Due to this issue, we are not able to execute the test applications in shell script.
View 3 Replies
View Related
Dec 30, 2009
Does anybody have any insight as to why a game appliction would restart when exiting with the back button. It does not automatically restart when using the Home button to exit and this only occurs one time (after the second attempt to exit with the back button, it exits cleanly). Also, I can reproduce this consistently on the Motorola Droid, but have not been able to reproduce on the G1 or the emulator running 2.0. I've tried changing the launchMode of my activities, but have not found something that works. These are my activities:
1. Splash Screen, Single Instance, Main/Launcher 2. Help, Single Instance 3. High Score, Single Top 4. Preferences, Single Top 5. Options, Single Top 6. Game, Single Top, with SurfaceView
The steps to reproduce the problem are: 1. User starts application, launching Splash Screen Activity 2. User starts game, launching Game Activity 3. Game Activity launches Options Activity (for result) 4. Game Activity restarts with result and game begins. 5. Pressing Back Button returns to Splash Screen Activity 6. Pressing Back Button again, briefly shows home screen, then relaunches Game Activity which starts Options Acitivity 7. Pressing Back Button again finally shows the home screen
View 2 Replies
View Related
Feb 18, 2009
the thread sleeped not killed and it wakes up after 10 sec and try to post message and it causes exception. is there any way to kill the threads those are in sleep mode while exiting the application?
View 5 Replies
View Related
Apr 12, 2010
I am using a class which extends Handler class to update my activity UI.
The code is as follows in side main activity...
But here i am facing one problem that is it is running after closing my application also .
please solve my problem to stop this handler when close this application.
View 1 Replies
View Related
Jan 5, 2010
In my application i have several activities and i want to start background music whenever my *Application* is launched and stop music whenever *Application* is paused or stopped.
View 4 Replies
View Related
Sep 9, 2010
Does anyone know of a video loop recording app that would work so as to allow "retrospective " recording - i.e. it records full time but discards after say five minutes, so that by -say -pressing a button, the previous five minutes recording could be retained , reviewed and possibly saved? I know it could be done by recording to a file for a fixed period and then discarding that file and starting a new one, but then it would be random as to the length of the recording that was available on the current file - depending on when the button was pressed. What I need is something that writes data to a fixed length file and pushes the earliest written data off the end - or some other process that simulates that.
View 1 Replies
View Related
Sep 8, 2009
I setup my SoundPool, and load a sound resource as this in onCreate():
soundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0);
soundId = soundPool.load(this, R.raw.edible_underwear, 1);
And then I try to play this sound twice in a onClick(), one slow mostly in left speaker, and one fast mostly in the right speaker:
soundPool.play(soundId, 0.9f, 0.1f, 0, -1, 0.7f);
soundPool.play(soundId, 0.1f, 0.1f, 0, -1, 1.5f);
No sound can be heard. I have fiddled with the volumes, priorities and rates. So far to no avail. Am I missing something obvious?
View 2 Replies
View Related
Feb 12, 2009
there seems to be a dead-lock problem when using sound effects with SoundPool. I was hoping the the problem would be fixed in the new firmware update, but unfortunately, it was not. The application still locks up after couple of minutes when playing sound effects using SoundPool. My application is a game playing a background music scenario with multiple simultaneous sound effects. Any word from devs as when we can expect stable SoundPool would be very welcome.
View 21 Replies
View Related
Mar 2, 2009
I need a recommendation from someone for the most accurate way of timing SoundPool sounds. I can't loop them because what's desired is not a loop but very accurate (to the ear at least) timing.
View 3 Replies
View Related
Nov 1, 2010
I've been trying to use SoundPool to play the default ringtone without success. In the code below
String ringtone = Settings.System.DEFAULT_RINGTONE_URI.getPath();
SoundPool ringPhone = new SoundPool(2, AudioManager.STREAM_RING, 1);
int soundID = ringPhone.load(Settings.System.DEFAULT_RINGTONE_URI.getPath(), 1);
int soundID = ringPhone.load(ringtone, 1);
ringPhone.play(soundID, 0.99f, 0.99f, 1, 0, 1);
I get the message "error loading content /system/ringtone sample 0 not READY". Replacing the URI with a hard path to an existing mp3 file on the sd card yields similar results.
View 1 Replies
View Related
Sep 8, 2010
Is there a reliable way to prevent truncating of sounds in soundpool? I have had some success with the sleep() function between sounds, but they still sometimes miss the last bit of sound before starting another sound. My app plays short sounds in sequence.
View 1 Replies
View Related
Feb 25, 2009
I've recently started working with the SoundPool class in SDK 1.1R1, and noticed that my app deadlocks from time to time, or sounds are not loaded. I remember reading, back in November, that this was to be addressed in the next SDK. I've used pretty much the same code that others have used and most of the time it works for a bit. Just a minute ago, the app completely crashed with no "Force Close" and returned to the home screen. Logcat reveals that "HeapWorker is wedged: 26577ms spent inside Landroid/media/SoundPool;.finalize()V" I'm not sure if this is the same issue others had with SoundPool or if I have encountered an entirely new beast.
View 13 Replies
View Related
Oct 31, 2010
How do I get the default ringtone to play? I've tried using SoundPool (preferred method) and MediaPlayer to play it but I'm getting nowhere. I've done so many dumb things, I'll just include the last fail. In the following snippet: String ringtone = Settings.System.DEFAULT_RINGTONE_URI.getPath(); SoundPool ringPhone = new SoundPool(1, AudioManager.STREAM_RING, 0); int soundID = ringPhone.load Settings.System.DEFAULT_RINGTONE_URI.getPath(), 1); ringPhone.play(soundID, 0.99f, 0.99f, 1, 0, 1.0f);
loads but plays nothing. When I display Settings.System.DEFAULT_RINGTONE_URI.getPath(), it's returning /system/ ringtone
View 2 Replies
View Related
May 20, 2009
I just found that left/right channels are swapped when calling SoundPool.play(int soundID, float leftVolume, float rightVolume, int priority, int loop, float rate), running in 1.1 emulator on MacOS. Unfortunately I'm far away from my G1 headset (with proprietary connector) so I can't check if the behavior is the same.
View 2 Replies
View Related
Oct 26, 2009
I first have to say that I'm biased, 'cus I like to write music apps (like music generation apps). However, this affects games as well. It's somewhat disappointing how OpenGL has made it into the NDK now but there isn't any NDK methods to get to sound to have faster access. Over the weekend I did some more testing and if you make a "drum" app, for example, and play the sound using either SoundPool or AudioTrack, you will get about a 100ms delay buffer, which is clearly audible (gap).
I made a test app where when you touch the screen, upon the DOWN event, it would play a short sound (like a drum sound). It clearly was not real time responsive or even close - you could hear the delay. I'd be interested to know if anyone who has made a game has any trouble with sounds? It seems like they aren't going to really trigger real time enough if you use SoundPool, for example. Am I completely wrong? Seems like your game is going to perform an action, play a sound, but the sound will have latency which I would think would throw off the game a bit..................
View 12 Replies
View Related
Oct 13, 2009
I find that when I am running 2 android devices connected to 1 linux machine, I find I can get ADB shell to exit abnormally. If I start a shell on Device 1, then on Device 2 start a shell and type reboot. Device 2 resets like expected, but the shell on device 1 will exit. I find that functionality of running controlling multiple devices with ADB very useful for testing. My question is can anyone reproduce this? Has this been fixed upstream? Is ADB planning on first class support for multiple devices, or was this an after thought feature? Any help debugging this, or possible just a little information in the right direction so I can make a patch myself.
View 5 Replies
View Related
Sep 4, 2009
I am experiencing a crash in my app when I quit (via the back button) out of my Activity. So far as I can tell this is happening in the Android codebase and not mine, but I'm not completely convinced of that.
AndroidRuntime E Uncaught handler: thread main exiting due to uncaught exception
AndroidRuntime E java.lang.RuntimeException: Unable to stop activity {MyApp/MyApp.MainActivity}: java.lang.NullPointerException
AndroidRuntime E at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3097)
AndroidRuntime E at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3159)
AndroidRuntime E at android.app.ActivityThread.access$2400(ActivityThread.java:112)
AndroidRuntime E at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1724)
AndroidRuntime E at android.os.Handler.dispatchMessage(Handler.java:99)
AndroidRuntime E at android.os.Looper.loop(Looper.java:123)
AndroidRuntime E at android.app.ActivityThread.main(ActivityThread.java:3948)
AndroidRuntime E at java.lang.reflect.Method.invokeNative(Native Method)
AndroidRuntime E at java.lang.reflect.Method.invoke(Method.java:521)
AndroidRuntime E at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
AndroidRuntime E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
AndroidRuntime E at dalvik.system.NativeStart.main(Native Method)
AndroidRuntime E Caused by: java.lang.NullPointerException
AndroidRuntime E at android.app.Activity.performStop(Activity.java:3575)
AndroidRuntime E at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3092)
AndroidRuntime E ... 11 more
View 1 Replies
View Related
Aug 18, 2010
I'm using the Android SAX parser to search for entries in a rather large (6MB) XML file. I'm basically using a derivative of the code shown in listing 8 here. The question I have is how do I stop parsing once my match has been found? The code shown continues parsing through the end of the file but I want to stop before then. Is this possible or do I need to use something other than SAX
View 1 Replies
View Related
May 25, 2010
I have five screen in my application. While in performing one action in fifth screen I encountered with Stop Application message. On which, I am getting 3 times "Stop Application" msg box, which covers 3 previous screen and comes back to the first screen. I understand I must have encountered with Error may be IndexOutOfBoundException which I have not addressed it in my code. I was wondering why it asks for extra 3 times "Stop Application" system message. It is fine to display an "Stop Application" system message if I encountered an error in any screen it should stop that particular screen and should come to the next screen on. How can I trap/catch such incidents not to occur in the consecutive screen. If the above description is not clear at any place please let me know that I be more clear to you.
View 4 Replies
View Related
Jun 20, 2010
I've been researching the OS a bit and I can't really tell what happens to programs when you hit the home button to leave them. Do they stay running in the background? After a little bit of time does the system close them out? What happens to them? I have a Sprint Evo and I don't see a way to close them out. I know that battery life can always be helped, and I would hate to leave them running all day just sucking the life out of the phone if they don't have to be.
View 18 Replies
View Related
Oct 24, 2010
I installed handcent and really really like it but how do I stop the default messaging app from popping up with alerts for new texts. It keeps popping up on the top bar whenever I get a text from anyone even after accessing that text in Handcent. It's not that big a deal but I need to go into my messaging app and view it to get rid of that notification. Is there a way to stop the notifications for the messaging app? Thank you.
View 2 Replies
View Related
Sep 10, 2010
I have an application with many forms implemented as separate activities. The form variables are dynamically built based on a database, and there are a ton of variables in the C++ side of the application (accessed via JNI). I don't see how saving out all of this data to persistent storage each time the onPause() or the onSaveInstanceState() of one of these many activities goes into the background is a smart use of processor time. And I don't see how even if I save the local variables for each activity during that time I'd be able to restore a single activity within the context of all the others.
I have set up a service that auto saves the files when I detect that the app has gone into the background. (I set a time stamp when onPause() is called in any activity and then clear the time stamp when onResume() is called on any other activity. If the time elapsed is more than a few seconds, I know I'm not the top activity any longer and the service saves the files).
What I'd like to do is continue on as normal unless the OS kills one of my activities. Since we don't always get notified of this, I thought it would be nice if there were a way to tell the OS that I'd rather you kill the whole app than just one activity.
View 1 Replies
View Related