Launch application on KeyPress sequence - Code example included

I searched this forum and google hours and could not get it to work.

I used this thread:

http://supportforums.BlackBerry.com/T5/Java-development/launch-application-on-12345/m-p/502771

I have a background process which is a PhoneListener.

It intercepts the void callInitiated(int callid) and checks the sequence.

If the sequence is the right one, she injects an end key and starts the application.

There are 2 problems:

(1) the dialed number appears with? prefix and I can't seem to find the right channel for the game.

(2) if I inject end, the call ended, but so is my application that I just launched.

I tried waiting and I tried the function calls but no dice the reorganization.

public void callInitiated(int callid) {

        String dialedNumber = Phone.getCall(callid).getDisplayPhoneNumber();
        System.out.println("!!!!!!!!!!!!  Dialed:" + dialedNumber.length());

        if (true || dialedNumber.endsWith(KEY_SEQUENCE)) {

            // end the call
        //  EventInjector.KeyCodeEvent ev = new EventInjector.KeyCodeEvent(EventInjector.KeyCodeEvent.KEY_DOWN, ((char)Keypad.KEY_END), KeypadListener.STATUS_NOT_FROM_KEYPAD);
        //  EventInjector.invokeEvent(ev);

            final UiApplication app = UiApplication.getUiApplication();
            app.invokeLater(new Runnable() {
                public void run() {
                    try {
                        Thread.sleep(20);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    try {
                        ApplicationManager.getApplicationManager().launch(
                        "MyApp?gui");
                    } catch (ApplicationManagerException e) {
                        e.printStackTrace();
                    }
                }
            });

        }
    }

any help?

Thank you

He solved.

for some reason, the callInitiated (.) is called several times for each call

Make sure that your code to initiate and end the call is executed only once (I used a hashtable and stored the callid) and you're golden.

Tags: BlackBerry Developers

Similar Questions

  • Do not install the 'Online Store' Application and the Code example

    The following error occurs when you try to install
    the file imported, online_store_installer_1.0.sql
    the application of the "shop online" and the Code examples.
    downloaded yesterday from:

    http://www.Oracle.com/technology/products/database/application_express/packaged_apps/packaged_apps.html#store

    I had created beforehand the user "eshop".

    I have the Version 3.1.1 of the Apex



    1 error has occurred
    NOT COMPATIBLE (your export may contain calls not supported by your version of the application.)


    Connected to the workspace: ESHOP

    Export the WorkspaceID file: 1150504199010437
    Export Application file: 129
    Version of the export file: 2007.01.08
    Analysis of export in the form of schema file: EBA
    Origin of the application: the application has been exported from a different workspace.

    Hello

    Maybe you need to grant more \n(Assurez-vous ESHOP?
    try to give this user DBA \n(Assurez-vous and see the results.

    See you soon,.

    Peter

  • browser launch application problem

    Hello
    In order to launch a browser from an application, I used the code snippet of this
    page:

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800440/How_To _...

    Everything I do is provide my own url for it and run it. It works very well and has
    was working fine until recently. A number of customers complained
    receive the following error message:

    Eception exception: net.rim.device.api.system.ControlledAccessException

    In the hunt for the cause, I have tried on a number of different devices.
    Including OS versions:

    Rogers Blackberry 8700 v4.2.1 - works fine
    Rogers Blackberry 8800 v4.2.1 - works fine
    Rogers Blackberry 8310 v4.2.2 - works fine
    Bell Blackberry 8830 v4.2.2 - above displays error
    Bell Blackberry 8130 v4.3.0 - above displays error

    I tried the device simulators:
    v4.2.2.123 Bell 8830
    4.3.0.07 uscc 8130
    and they both worked fine.

    We're going a little crazy here trying to figure out the cause. If it's not OS
    linked version, maybe that's a problem of provider?
    Is there a known issue with Bell relating to the safety of the launch of the browser
    applications? Is there a work around?

    Thank you

    OK problem solved. Lancéo has got to me referring to the document that I originally brought it up. I just stumbled on the wording. It did not clear in the document that extract of code belonged to which version. In addition, a some devices running v4.2.2 colleagues was not the problem. Where as the document basically says that she should have. I should still try.

    So I have now two versions of the same application. The snippet of code on the bottom of the document

    is used for versions 4.2.1 below. Initially, the code snippet is used to 4.2.2 and more.

    Thanks again for all of you who have posted.

  • Calendar in El Capitan can launch applications as scheduled events... No work around?

    After upgrading to El Capitan of Lion (10.7.5) - I jumped over the Mountain Lion, the Mavericks and the Yosemite - now I'm missing a very important feature in the new calendar (iCal formally): it cannot launch applications such as events scheduled at set intervals.

    I also absolutely do not remove the possibility that it is me who is a bad thing.

    In some other forums people suggest to uncheck calendars in iCloud settings and then create a local calendar (and name it for example "on my Mac") who should be able to launch applications and then synchronize the calendars in iCloud again.

    Unfortunately, as soon as I uncheck calendars in iCloud, the application calendar itself does not create new calendars at all - local or not.

    I'm doing something wrong? If not, is there perhaps a workaround?

    Any help will be greatly appreciated!

    Use Automator to create a calendar alarm clock that would launch the applications.

    When you open the automate, create a new Document.

    Choose the type of alarm calendar.

    Stretching the library of utilities in an action to launch the Application. Set this to the application you want to run.

    Save it and it will create a local calendar with an event in its operation this alarm clock calendar. You can then handle this event.

  • Please give full code example of a program

    Am a beginner to the native sdk. Please give me a code example to understand any structure and files of header... In the documentation, that I don't understand the coding parts separately. Please someone help and give a complete coding of the sampling program...

    If you go here:

    http://developer.BlackBerry.com/native/sampleapps/BB10/

    you will find several examples of applications where you can download the source code in the IDE and run.

    If you go here:

    http://developer.BlackBerry.com/native/documentation/BB10/framework.html

    You can find the documentation relating to several aspects of the use of the native SDK programming.  There are tutorials that can help you get started with the source code.

  • How to attach the code examples?

    If I post/reply to an entry there is an information displayed right combobox 'emoticon' (use 'Attach the Code' to include examples of code in the message.)

    Can someone help me how to use this feature to "Join Code"?
    (I tried all the buttons without success, if I delete the spaces between brackets [i] the code is always treated as italic ;())

    Thank you
    Kcell

    browser: Firefox 2012

    Today I connected again cause I wanted to reply to a message and... voila... the button "attached code" is now visible.

    Thanks to the Adobe forum ;) administrator

  • myRIO C code examples

    Hi all

    I'm just starting to watch myRIO for use for programming in C labs

    with the students.

    Depending on the resources, there is a link to the C code examples, for example. on

    http://www.NI.com/Tutorial/14619/en/

    but this link is broken. Examples are still available?

    Thank you

    Select this option.

    Hi Mark,

    This is the link you're talking to the step 3 download NOR myRIO C examples and Documentation? I tried it myself and it worked fine.

    If it is this link, you are talking about try this: http://www.ni.com/download/labview-myrio-toolkit-2014/4949/en/

    I hope it works for you,

  • Code example for single asynchronous reading of multiple waveforms

    Hello

    I looked around but have not been able to find the code example for single asynchronous reading of multiple waveforms.  Could someone point me in the right direction?

    Thank you

    Dale

    Hi Dale,

    Have you looked at the code using .NET Framework DAQmx example? It shows this code:

    class DAQmxAsyncRead
    {
    private AnalogSingleChannelReader reader = null;

    public DAQmxAsyncRead (task t)
    {
    Create the drive
    Reader = new AnalogSingleChannelReader (t.Stream);
    Acquire 100 samples
    Handful of IAsyncResult = reader. BeginReadMultiSample (100, New AsyncCallback (OnDataReady), null);
    }

    Public Sub OnDataReady (IAsyncResult i)
    {
    Recover data that has been read.
    At this point, all that occurred during the asynchronous read exceptions are thrown
    Double data = reader. EndReadMultiSample (i);

    You can call the method BeginReadMultiSample here once again
    }
    }

    In addition, this article: http://digital.ni.com/public.nsf/allkb/485201B647950BF886257537006CEB89?OpenDocument talk about different causes of the reserved resource error.

    Kind regards

    Alexandra Valiton

  • Need help with the launching track pack for forza code 4

    Bought new Forza 4 and the lancer Track Pack code does not work, how do I get a code that is generated in the form I've already paid for it. Rank of loads of numbers and sent 10 s of emails but cant seem to get help.

    This is the help I get when the cat to an Ambassador xbox on xbox.com

    Terry wrote:
    Need help with the launching track pack for forza code 4
    The Xbox Ambassador says:
    Location of Ambassador of the community...
    The Xbox Ambassador says:
    Location of Ambassador of the community...
    The Xbox Ambassador says:
    Your question will be answered by an Ambassador of the Xbox. You have been connected to the Ambassador as a user Xbox [3]
    The Xbox Ambassador says:
    Hello
    Terry wrote:
    Hello
    The Xbox Ambassador says:
    Hey
    Terry wrote:
    just to be on the phone to xbox live support and was told to come here
    The Xbox Ambassador says:
    ok\
    The Xbox Ambassador says:
    What is your problem?
    Terry wrote:
    I bought the 4 for forza ansd 360 new sealed Christmas...
    Terry wrote:
    has got 2 codes that accompanies the game but the pack track code does not work
    The Xbox Ambassador says:
    Wow good
    Terry wrote:
    whenever I put in the code it says code redeemed
    The Xbox Ambassador says:
    I think the code is used. You must return to the retailer
    Terry wrote:
    I tried to, but since I already opened the case they will not accept
    The Xbox Ambassador says:
    Oh. No,
    Terry wrote:
    the code had been used or defective as I am the only person who has touched the game once opened, tried to enter the code when it is open
    The Xbox Ambassador says:
    Maybe it was auto bought?
    Terry wrote:
    so, how do I get another code generated track Pack if defective?
    The Xbox Ambassador says:
    I do not know.
    Terry wrote:
    bought the game new, so I get the track pack
    The Xbox Ambassador says:
    Oh. It's bad.
    The Xbox Ambassador says:
    I think that if you Exchange 1 code it will buy it
    Terry wrote:
    car pack code worked, starter pack did not work
    The Xbox Ambassador says:
    Oh.
    The Xbox Ambassador says:
    It's a bad
    The Xbox Ambassador says:
    BTW you have an evolution of the tests?
    Terry wrote:
    Yes, I want to? but more anxious to get a code object generated for this pack
    The Xbox Ambassador says:
    Hey if I help can u give me this game too?
    Terry wrote:
    ?????????????????
    Terry wrote:
    So is it possible to get a code for that time?
    The Xbox Ambassador says:
    Hey
    The Xbox Ambassador says:
    Yes.
    The Xbox Ambassador says:
    you need to contact them
    The Xbox Ambassador says:
    and tell them that the code is used.
    Terry wrote:
    I was told to come here? where can I go to get the code?

    Hi Terryg76,

    ·         What version of the operating system is installed on the computer?

    I suggest you to contact the game manufacturer for more help and information.

  • I lost all my startup applications is empty got code ox80070005 how to fix

    I lost all my startup applications is empty got code ox80070005 how can I fix this windows 8.1

    Willie, welcome to the forum.

    I suggest that you do a System Restore.  This will take your computer to a point when things worked correctly.

    Please click on the Thumbs up button '+' if I helped you and click on "Accept as Solution" If your problem is resolved.

  • Complete code example Widget push?

    Some body knows if there are some complete code example push Widgets, with subscription, unsubscribe, background, Service Push BlackBerry...?

    I'm looking and only found parts, not a complete example.

    Thanks in advance

    Not a complete example, but here's my JavaScript to push functionality.

    var port = 201;
    ...
    function subscribe() {
       blackberry.push.openPushListener(handleReturnData,port);
    }
    
    function handleReturnData(data) {
       var wasBackground = false;
       if (!blackberry.app.isForeground) {
          wasBackground=true;
          blackberry.app.requestForeground();
       }
       if (data!==null) {
          var text = blackberry.utils.blobToString(data.payload);
          ...
          //do some work with text
          ...
       }
    
       if (wasBackground)
          blackberry.app.requestBackground();
    }
    
    function unsubscribe() {
       blackberry.push.closePushListener(port);
    }
    

    also...

    function init() {
       ...
       blackberry.system.event.onHardwareKey(blackberry.system.event.KEY_BACK,sendToBackground);
       blackberry.system.event.onHardwareKey(blackberry.system.event.KEY_ENDCALL,sendToBackground);
       blackberry.app.event.onExit(unsubscribe);
    }
    
    function sendToBackground() {
       blackberry.app.requestBackground();
    }
    

    stick that in a js file and call init() and subscribe() in the 'onLoad' of your HTML page, you should get close to a working example. Up some alerts in the handeReturnedData function to see what pushed you.

  • RichList code example does not

    I tried to use the code example provided for the RichList UI component, but it did not work. I get illegalStateException or another similar error. I didn't with my richlist photos so I changed it to look like this:

    List of RichList =

    new RichList (getMainManager (), false, 1, 1);

    List.Add)

    new Object [] {"Device 1"});

    BTW, when I copied and tried the unmodified original code, it didn't always work (I got the photos stored in the folder too and still did not work)

    If anyone can explan the parameters to the constructor in plain English he could really help me, thanks.

    Nevermind, I solved it. I had to add super(Manager,NO_VERTICAL_SCROLL) to the upper part of the constructor, and then I had to change the bitmap to bitmapfield and set it like this:

    BitmapField bmp = new BitmapField (Bitmap.getBitmapResource ("pic.png"))

    When I used just bitmap he says illegalstateexception and says that I can only use channels, fields and images bitmap, but bitmaps don't work lol.

  • In my adf application, I use sequences, the problem that I face, is that this sequence break at 2:21 or three insertions. Any reason?

    Mr President

    In my adf application, I use sequences, the problem that I face, is that this sequence break at 2:21 or three insertions. Any reason?

    Concerning

    How can I correct this situation?

    Well, look at your definition of the sequence and correct

    There are CACHE 20 then change or recreate your sequence and use NOCACHE

    Dario

  • Launch applications published in the workspace of the internet 2.0

    Hello

    I can't launch applications published in the workspace of the internet 2.0. When I open an application opens a client application to view my horizon and the error message "error: host name cannot be resolved"appears. "

    I have access to the workspace via the internet on a load balancer (ZEN). I configured both connectors. One for connecting internal Kerberos authentication with external authentication with password authentication. This works well. From the local network, it works like a charm.

    Do I have to give the Horizon view connection manager a public IP address?

    Another (or maybe THE) problem is on the balancer FQDN/SSL setting. The FULL domain name is the portal.domain.com. Load Balancing is done via the internet with the same accessible URL. When I select the option "Load Balancer" in the workspace Configurator, it copies the CA certificate root of LB all go, restart the Tomcat server and then the page throw me back to the original page where the button load balancer is not selected. I get no error message and in the newspapers, I see only errors. You guys have an idea what I am doing wrong?

    Kind regards

    Andreas

    Yes, the Horizon view connection server must be solved also (must be a public IP address for this)

  • We purchased complete team CC w/One (1) license. If we can deploy specific applications to separate computers, for example the Photo-Design-Acro on a windows computer and first-After effects to a Mac, or license allows - as in recent CS - instalation on 2

    We purchased complete team CC w/One (1) license. If we can deploy specific applications to separate computers, for example the Photo-Design-Acro on a windows computer and first-After effects to a Mac, or license allows - as in recent CS - installation on separate computers of two 2?

    You can activate the subscription creative cloud on two machines, however, you cannot use both machines at the same time. Please check: http://wwwimages.adobe.com/content/dam/Adobe/en/legal/servicetou/Software_Terms-en_US-2015 0407_2200.pdf

    I hope this helps.

Maybe you are looking for

  • I can't download add ons

    I can't download any add ons. I get the message "there was an error downloading/add an insert on name here /.» Try again. » I have uninstalled/reinstalled Firefox without success.

  • MacBook Air overheating all using Skype

    When I use Skype, for some reason my macbook air gets very hot and the fan is non-stop. So I checked the activity monitor, and it seems that Skype uses 70% more than my CPU, which is not normal. I ran a virus and malware scan, everything is clean. My

  • meter returns garbage values

    I use cDAQ 9184 and 9401 digital I/o card, I use the counters available for the measurement of the frequency (pulses are generated by a sensor hall, whose frequency I want to measure to estimate the speed of the motor DC.) But the problem is that thi

  • is it possible for me to use maps created by MS streets and trips 2007?

    I just bought MS streets and trips 2013.  I have a lot of maps created in MS streets and trips 2007.  Is it possible to convrt these maps in a format that is compatible with ver2013?

  • Do installed Windows updates remain intact after back by using the system restore?

    I installed the Windows updates at the same time, I've updated my antivirus software, and now when I try to delete a message from Inbox in Outlook 2007 by using the DELETE key on my keyboard, Outlook crashes.  I am trying to determine if this problem