Run applications in backgroun

Hello

I have an application that needs to run in the background. In the application, I have a timer that checks for a specific start every minute. Up to this point, everything is Ok and I get good results (I mean that the timer run() method is called after each minute).

Now, I want to play an audio file after the run() method. The problem is that if the application is running in the foreground, the file is read, but if I press the Cancel button (to move the application in the background) the timer run() is called, but I can't run the audio file.

Can you give me an idea how to play the audio file when the application is running in Effect?

You can play sound in the background use the thread to call the audio room to make the sound in the background.

Below the sample will help you.

try {}
Sound = new playSound ("sample.wav");
                        
Thread.Sleep (1500);
} catch (InterruptedException e) {}
                       
}
}

public playSound (String AudioFile)
{
Super();
String [] types = Manager.getSupportedContentTypes (null);
                        
                        
for (cnt int = types.length - 1; cnt > = 0; cnt-) {}
If (types [cnt].equals("audio/mpeg")) {}
                      
try {}
InputStream is = getClass () .getResourceAsStream (AudioFile);
                               
Reader = javax.microedition.media.Manager.createPlayer (, "audio/mpeg" "");
Player.Realize ();
Player.prefetch ();
                                
Player.Start ();

is. Close();
                                  
} catch (Exception ex)
{
}
                             
}

}
}

Tags: BlackBerry Developers

Similar Questions

  • macOS needs repair your library to run applications. Type your password for this purpose.

    Just upgraded to macOS Sierra.

    Now, I get an avalanche of:

    "macOS needs repair your library to run applications. Type your password to allow this. ', dialog boxes.  They just continue to flow upward.

    I tried to set the permissions on the House and the library directories, by doing a Get Info-> sharing and Permissions-> select user-> select Read & Write-> apply to what's included...

    This seems to set the permissions that you expect.

    But Safari can't download files in my downloads folder.  Other changes to the settings in other applications.  Do not seem to hold.

    Whenever I connect again the dam of dialogue again.

    You have chosen a good time to remove permission to repair Apple disk utilities.

    So, how are we supposed to solve this problem?

    https://www.macissues.com/2014/04/11/how-to-fix-home-folder-permissions-in-OS-x/

  • the pop up Windows Defender when you are connected to the internet by dial-up readings; change of system in known application, type of change; running applications, cwindowssystem32mswsockdll, I am disconnected and then reconnected___

    the pop up Windows Defender when you are connected to the internet by dial-up readings; change of system in known application, type of change; running applications, cwindowssystem32mswsockdll, I disconnected and then reconnected.

    I just ran windows update on a large number of files all successful before this happened, it happens when I am connected to the internet, I use dial-up access

    added on 25/11/09 still have the problem mentioned above, even explore two windows are runnibg on the system, or two IE browsers running?

    Added 27/11/09 I ave followed all instructions up to and including thefix tool kb/93623, stiil I have this report of windows Defender quickly appearing twice in a row, then I'm disconnected from the internet. any more ideas thanks sam

    Visit this link:
    http://support.Microsoft.com/kb/936213

  • Cannot get his work when running applications with "Run as Administrator" all of a sudden.

    My daughter has been using my computer and done 'something' to him. To get the sound to work now under IE, Firefox, Ventrilo, etc etc I have to run applications as an administrator... even if my account has administrator privileges.  I'm at my wits end, because I've tried everything, and Google returns nothing to give me a helping hand.

    I am running Windows XP Pro SP 3

    I don't know that if Skyke was working or not, I removed it when I started to try to fix things. No program used his work properly, browsers, windows live messanger, ventrilo, etc..

    I tried both FixIt programs you listed above, found nothing.

    In the end, I gave up and reinstalled.

  • How can we operate two screen on vista - do not reproduce but to run applications separated on each screen-AT

    How can we operate two screen on vista - do not reproduce but to run applications separated on each screen-AT

    Choose the option 'Extended' instead of 'mirrored '.

    http://Windows.Microsoft.com/en-us/Windows-Vista/multiple-monitors-frequently-asked-questions

  • The Task Manager shows RFLed is a running application.

    The Task Manager shows RFLed is a running application. It is still there and seems to be a little hard drive. Computer is an ASI Innovace running Vista Home Premium and only a few months. Equipped with a wireless keyboard and mouse. 2 GB of RAM and 1 terabyte of disk.

    Analysis of virus and Spyware scans are both clear. Looking for a file/folder produces a result draw.

    What is this application and I should remove it?

    RFLed is a utility that my new keyboard and computer to use. It is a gateway keyboard and does not contain the NumLock or CapsLock LEDs on it, but a poster on the graphic screen every time I change these settings. It is annoying because it takes me out of my program document for 5 seconds if I accidentally hit the CapsLock key while typing.

  • How to kill your app running applications?

    Hello.. I m new on the developer forums...

    can someone help me to kill or close running applications like my... just application settings? Do I need permission to do this...?

    I'm working on blackberry os 7...  I used the application manager. but it does not help me...

    I see.  There is no way to prevent a user to remove your request if they wish.

    If your phone is on a BES, for example, the it policy can prevent the user to perform certain actions like that, but to the extent where an application itself cannot be deleted, no..

  • Running application

    Hello

    My blackberry application between the dispatcher of events such as Application. Thus, when the user clicks on the icon (for the first time) it pushes screens and after which prays for the background and working on some events.

    Now if the user clicks on the icon of the app again (from the Ribbon of demand), nothing happens that the application is already running. Is there a way I can get into the application again on that click? Pls. Let me know because I would push some screens again for the user to change their preferences.

    -EMA

    Sinc it is not related to the original question of this thread, please start a new Thread.  In addition, if this (running application) problem is solved, can mark you this thread resolved?

  • See all running Applications

    Is it possible to have an application that when run displays all running applications in the blackberry. They could be in the foreground or background.

    See you soon,.

    Merry Christmas everyone

    In this case, use ApplicationManager, ApplicationDescriptor classes

    ApplicationManager.getApplicationManager () .getVisibleApplications () - gives you the [ApplicationDescriptor] table of running applications. If you check the ApplicationDescriptor methods class its view all methods like getName () - for app name, getModuleName () for the name of the descriptor module... etc.

    For more information on these classes have check in API

    http://www.BlackBerry.com/developers/docs/7.0.0api/NET/rim/device/API/system/ApplicationManager.html

    http://www.BlackBerry.com/developers/docs/7.0.0api/NET/rim/device/API/system/ApplicationDescriptor.h...

    Concerning
    Anil

  • Flash Builder debugger cannot connect to the running application

    I've upgraded to Flash Builder 4.5 and now I get the error - old

    The Flash Builder debugger cannot connect to the running application.
    Ensure that:
    1. for applications in the browser, you run the debug version of Flash Player.
    2. for network debugging on a mobile device, you have a reliable network of the device connection and 7935 port is open on the firewall of your machine.
    Device connection help

    I get both on the Simulator (which is being upgraded to the latest version) and try to debug on my real playbook. There are a few other forums of discussion about this that suggest that the default Debug host IP is the usual culprit. However, which is set up correctly. I also added port 7935 firewall.

    I am able to ping ip address of my playbook without problem. Any other thoughts on what I might have configured wrong?

    Flash Builder 4.5 uses Air 2.6 for iphone and Android, for the moment, we can use only Air 2.5, so the compiler needs a couple of parameters. You have in the ActionScript Preferences tab build package-advanced - forceAirVersion 2.5 and under ActionScript compiler an extra line - swf-version 10

  • Is it possible to stop a running application and uninstall it

    Hello

    From an application, I created a new codemodule and ran another application (HelloWorld.cod) by using - ApplicationManager runApplication() method.

    Now on certain events (for example the application that ran HellowWorld out).

    (a) I want to stop the running application - HelloWorld. Is there a possible way?

    (b) once the application is stopped, is it possible to uninstall?

    Thanks in advance.

    POOJA-

    Yes you are right... Could you solve the thread now ?

    See you soon...

  • The Flash Builder debugger cannot connect to the running application

    Good evening everyone. I installed my signature key, debugging debugging keys and transferred my token to the device and everything seems good, no errors except when I try and debug an application on my device. I click on debug, and it says it's installation. The app looks like it's opening on my device but closes immediately. The FB debugger continues to say "pending to connect to the running application". The icon is on my device but when I try to run it it opens and then closes immediately. I use the software 1.0.2 SDK.

    How about configuration in the app.xml file or the XML of BB? Because you are running 4.5, you have the parameters of the solution defined to force AIR 2.5 and Flash 10?

  • I got following message from the installation program Adobe - other instances of running Applications Adobe Manager that must be closed before you install this product. Please close or wait until they end. Please indicate how can I resolve the issue?

    I got following message from the installation program Adobe - other instances of running Applications Adobe Manager that must be closed before you install this product. Please close or wait until they end. Please indicate how can I resolve the issue?

    Please check if this helps https://helpx.adobe.com/creative-suite/kb/error-instance-updater-running-cs5.html

    Concerning

    Stéphane

  • Impossible to run applications CC and impossible to uninstall - stuck in the circle of the error.

    Downloaded the Suite CC, habit run when I click on any of the programs, won't let me uninstall, when I try to uninstall all of the programs; Errror says - I need of application manager. So I download and run application home manager says Setup could not initialize and I need to download the adobe support advisor - but which was interrupted... Help!

    Run Dell Latitude 5540

    Win 7

    16 GB of ram

    Intel i5 cpu clocked at 2.6 ghz

    uninstall all cc (uninstall the Adobe Creative Cloud desktop application)

    clean a http://www.adobe.com/support/contact/cscleanertool.html

    Restart your computer

    Reinstall the cc desktop application, https://creative.adobe.com/products/creative-cloud

  • BUG? Page apex 4.1 zero "run Application" button do not work

    Hello

    On apex.oracle.com when I edit zero page I see the button "Run Application".
    When I press the button it just reload page.
    Button OnClick source seems to be. Is - this bug?
    javascript:redirect('')
    I guess that the button should run application and e.g. display page 1.

    If this app button run or I just misunderstand it function?


    Kind regards
    Jari

    Hi Jari,

    Thanks for the information. I filed bug #12883413 for that matter, citing the two scenarios. This will not be fixed in 4.1 even if I'm afraid.

    Thanks again for reporting this.

    Kind regards
    Anthony.

Maybe you are looking for