How to register for an event when the device is connected to the PC in USB mode or sync

I develop application on blackberry with phonegap.

I want to hear event when the BlackBerry device is connected to the PC by USB MODE or sync.
I saw mediagallery and applications Filemanager showing the dialogue that the application cannot be used when connected to the PC in USB mode.
I want to display dialog similar to my request.
Can anyone please help on how to do it.

I saw blackberry webworks API

public static Boolean blackberry.system.isMassStorageActive)

who says if massstorage is active or not.

But I can't keep on request this API every time. I'm looking for an API that gives me the reminder.

Can you please help.

On the side of Java, this can be done by implementing a FileSystemListener and the rootChanged method:

public void rootChanged(final int state, String rootName) {
    if (rootName.equalsIgnoreCase("sdcard/")) {
        if (state == FileSystemListener.ROOT_ADDED) {
            /* SD Card is available. */
        } else if (state == FileSystemListener.ROOT_REMOVED) {
            /* SD Card is not available. */
        }
    }
}

I was not able to find a corresponding WebWorks API or API community well, so I think you need to create your own custom extension to implement this feature of the listener.
https://developer.BlackBerry.com/HTML5/documentation/using_javascript_extensions_1866976_11.html

Tags: BlackBerry Developers

Similar Questions

  • How to get an onChange event when the user clicks a button?

    Hello

    I'm new to APEX and have the following problem:

    Implementation:
    There are two text elements, one for the zip code and the other for the city.

    When you change the zip code, the city will be changed accordingly with the data from the database.

    I've implemented an "OnChange" in the zip code for this element.

    Problem: The on change event is executed only if the user leaves the text with a tab element or click on another piece of text.

    When it hits the "next page" button directly the city is not changed.

    Pointers for a solution please.


    Turalf

    Published by: Turalf on May 12, 2010 07:52

    Well, depends on how your button is built but, in any case, Javascript supports the onclick event on the element for each HTML.
    Model based buttons are often created as links using the indicator A, but which prevent you from adding an onclick on her event.
    In this case you must choose if you want to cancel the default action, or you prefer to perform the default action (the doSubmit in general) as well as the onclick event.
    The order of execution is
    1. the onclick event
    2. default action

    If you return false from the associated with onclick the function Manager, the default action will be canceled if you return true, he will be executed.

    Flavio

    ----
    http://oraclequirks.blogspot.com

  • I have vista ultimate 64 and I try to run HAWX in DX10. It is gray in the game. When I run DXDIAG it says that I'm running DX 11. How can this be? How to register for dx10?

    I have vista ultimate 64 and I try to run HAWX in DX10. It is gray in the game. When I run DXDIAG it says that I'm running DX 11. How can this be? How to register for dx10?

    Gearrunner,
    I have Windows 7 32-bit last month.  I installed the demo of HAWX and he ran a program compatibility Wizard after installation.  He showed that DirectX 10 has been installed.  When I run DXDiag, I also show DirectX 11.  Now, I have installed DirectX 9 .0c on this machine.  Then you can try to install it and see if that makes a difference.

    DirectX 9 .0c

    Of course now that I've tried the demo you have shot me in another game I have to play.  :)

    Mike - Engineer Support Microsoft Answers
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to register for the web when all options gif gives me an error message?

    How to register for the web when all options gif gives me an error message? I have a tent to save a cinemagraphs.com second 8 and me still get an error message.Screen Shot 2015-09-30 at 7.44.08 PM.png

    Hi badasshe,

    Please reset the Photoshop preferences and then try.

    Steps to follow:

    To re-create the Photoshop preferences files, start the application while pressing Ctrl + Alt + Shift (Windows) or command + Option + shift (Mac OS). Then, click Yes to the message, "Delete the Adobe Photoshop settings file?"

    Reference: preference file works, names, places | Photoshop CS5

    Let us know if it helps.

    Kind regards

    ~ Mohit

  • Pop up scanner "no application is registered for this event." How can I register a claim?

    When I press scanning or copying or the E-Mail button on the Scanner, I get a message that says "there is no application registered for this event." How can I register a claim? The Scanner is Canon CanoScan3000ex.  Test Scanner or camera photo-bouton I get - your imaging device successfully completed the diagnostic test.  Device properties general tab: I receive - this device does not work correctly.  The Scanner appears in the control panel being installed.  When I open the properties of the Scanner, the applicatons box is empty and I can't access it.  How can I get the computer to chat with the scanner?

    Hello

    all that I can say that you do not give a brand name is to uninstall and reinstall the scanner using the latest drivers from vista on the site of scanner manufacturers

    If this does not work, contact the manufacturer of scan to support

  • Watch does not recognize the weight class as exercise-how can you add the duration of activity manually because none of the presets eg elliptical etc. is appropriate. Also does not count calories for example 35 when the rest of the group is around 500

    Look does not recognize the weight class as exercise-how can you add the duration of activity manually because none of the presets etc for example elliptical is appropriate and therefore do not count toward the daily goal. Also does not count calories for example 35 when the average of the others in the group is around 500.

    Hello

    When you use the application of the training session, choose the type of activity that best fits your business. For anything else - like weight - select the other category.

    During the follow-up of one year to the next helps:

    • Activity app will credit the ring of progress of exercise with one minute for every minute of the workout.
    • Active calories will be based on the data recorded by the heart rate sensor or a brisk walk, whichever is greater.

    Note, however, that the heart rate sensor is likely to give better results for the workouts that involve rhythmic (for example running) rather than the irregular movements.

    More information:

    Use of the workout on your Apple Watch - Apple Support

  • How can I cancel my account when the need help page only allows me to go to forums and does no real contact for adobe?

    How can I cancel my account when the need help page only allows me to go to forums and does no real contact for adobe? How can I contact Adobe actually?

    Please contact support by calling/chat for cancellation requests and billing queries:

    Contact the customer service

    * Be sure to stay connected with your Adobe ID before accessing the link above *.

    You can also check the help below document:

    https://helpx.Adobe.com/x-productkb/policy-pricing/cancel-membership-subscription.html

    Please go through the Adobe - General conditions of subscription as well.

    Concerning

    Stéphane

  • How can I 'include' a file different php depending on time? Work on a 'Happening Now' page for an event and the need to plan a different content to load as the day continues. Thank you!

    Work on a 'Happening Now' page for an event and the need to plan a different content to load as the day continues. Thank you!

    The event has class sessions all day (3 days). I would like the page happening now to show what classes are going on right now and what is coming up next. I was hoping just to separate configuration files and load them when necessary, but open to all suggestions.

    PHP has a powerful set of date and time functions.

    To do this is to create a DateTime object and then use conditional logic to include the files you want. A better way would be to keep the details in a database and use the time to retrieve and display the details you want.

    A DateTime object using:

    $now = new DateTime();

    $hour = $now-> format ('G'); This gives you time to the 24 hour clock.

    If ($hour == 13) {}

    It is between 13:00 and 14:00

    } else if ($hour == 14) {}

    It is between 14:00 and 15:00

    } ....

  • Intercept touch green application event when the device is locked

    Hi, I'm new to blackberry. What I want is I want to take a key event (green or red button) when the device is locked and do specific tasks in my application that runs in the background if this button is pressed. Is this possible? How can I do?

    Just to be 100% accurate, it is possible for a keyListener (look to the top of the class) to pick up some events even when running in the background.  It can be different events when the device is locked.  Indeed, the events may be different depending on whether the "locked" screen is currently displayed or not. And the entire lot is dependent on operating system level, in other words, the same device running two different levels of OS will possess differently in terms of what keys can detect a listener in the background.

    So if you have a BONE and a specific device, so it might be something you can do, especially if it is an older operating system.  However if you try to create something that works generically, then know that I've tried and failed!.

  • Absent voice memo to the homescreen on IPhone SE there is no 'utility' or 'extras' anywhere; folder Siri is voice memo, but can not get to the home screen? How to apply for voice memo on the homescreen?

    Absent voice memo to the homescreen on IPhone SE there is no 'utility' or 'extras' anywhere; folder Siri is voice memo, but can not get to the home screen? How to apply for voice memo on the homescreen?

    Try going into settings > general > reset > reset home screen presentation.

  • Need for a solution when the Boot Manager is missing.

    * Original title: startup

    need for a solution when the Boot Manager is missing

    Startup Repair,

    http://www.SevenForums.com/tutorials/681-startup-repair.html

  • Event when the application closes

    Hi *.

    is there an event when the PlayBook application is about to close? I would like to save at this time where the configuration etc.

    Not that I know of.  It will be an event at the level of the AIR that is triggered when this problem occurs, and I do not think that such an event is currently on the Tablet OS.

  • How to register for ePrint

    How to register for ePrint?  I am including a helpful video on how to register for ePrint with step by step instructions.

    I hope this helps!

  • How you uninstall photoshop elements 13 when the windows uninstaller does not work?

    How you uninstall photoshop elements 13 when the windows uninstaller does not work?

    Hi James,

    You can follow the article: use the Adobe Creative Cloud cleaning tool to solve installation problems and use Adobe Cleaner tool that helps you to uninstall the application.

    Let us know if it works or not.

    Thank you

    Yann Arora

  • How prevention JButton to actions generated when the user press down

    How prevention JButton to actions generated when the user hold down the key or the short cut
    The code below to show the question when the user keep pressing Alt O
    We want to stop the JButton to generate multi shares just a share only
    A code example shows the behavior that needs to be prevented. Keep pressing "Alt + O" and you will see that the standard ouptput will print the timestamp
    Note Please, I'm NOT interested in the mouse press which is a solution by adding a threshold (setMultiClickThreshhold (long line) on the JButton as an attribute.

     
    public class TestPanel extends JPanel
    {
    
       private JButton btn;
    
       public TestPanel()
       {
          btn = new JButton("Open");
          this.add(btn);
          registerCommand(new MyAction(), InputEvent.ALT_MASK,
                KeyEvent.VK_O, btn, btn.getText(), 0);
       }
    
       public static void registerCommand(AbstractAction action,
             int mask,
             int shortCommand,
             JComponent component,
             String actionName,
             int mnemonicIndex)
       {
          InputMap inputMap = component.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
          KeyStroke knappKombination = KeyStroke.getKeyStroke(shortCommand, mask);
    
          if ((component instanceof AbstractButton)
                && mnemonicIndex >= 0
                && mnemonicIndex < actionName.length()
                && (shortCommand >= KeyEvent.VK_A && shortCommand <= KeyEvent.VK_Z))
          {
             ((AbstractButton) component).setDisplayedMnemonicIndex(mnemonicIndex);
          }
    
          if (inputMap != null)
          {
             ActionMap actionMap = component.getActionMap();
             inputMap.put(knappKombination, actionName);
             if (actionMap != null)
             {
                actionMap.put(actionName, action);
             }
          }
       }
    
       public static class MyAction extends AbstractAction
       {
    
          /**
           * 
           */
          private static final long serialVersionUID = 1L;
    
          @Override
          public void actionPerformed(ActionEvent e)
          {
             System.out.println(System.currentTimeMillis());
    
          }
    
       }
    
       public static void main(String... args)
       {
          SwingUtilities.invokeLater(new Runnable()
          {
             public void run()
             {
                JFrame frame = new JFrame("Testing");
                JPanel panel = new TestPanel();
                frame.getContentPane().add(panel);
                frame.setPreferredSize(new Dimension(500, 500));
                frame.setMinimumSize(new Dimension(500, 500));
                frame.pack();
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setVisible(true);
             }
          });
       }
    
    }
    Published by: user12130673 on 13-feb-2013 03:01

    Use getKeyStroke (int keyCode, int modifiers, boolean onKeyRelease) hit with onKeyRelease = true instead?

Maybe you are looking for

  • Twitter does not correctly rendered

    Since I updated to Firefox 42.0, yesterday, no social media incorporates are correctly rendered, and it is through all Web sites. What is going on?

  • Satellite L500 - battery won't charge

    Hello I had a problem last week - my laptop (Satellite L500) works well on alternating current, but the icon shows "plugged in, not load ' and the battery charge is at 0%. So if I remove the outgoing cable it runs immediately. Lighting load LED on th

  • How in my settings on my iPad?

    For some reason when people call me, they get my friend Lynn instead. This happens regularly and I have to think it has something to do with my settings. I don't know where this logo of the tool (the key)? Can someone help me please. Thank you in adv

  • Gaberlunzie in the terminal instead of the hostname prompt

    Hello I launched terminal today and instead of the usual "HOSTNAME: directory$ ' format, he says" Gaberlunzie: directory$.  I left the terminal and restarted and it was gone and I was not able to reproduce.  From the Windows world, this seems highly

  • Password blackBerry Z10 enter peripheral

    I have 1 attempt left on 10! I'm went to sideload apps dev mode and then turned off. All my passwords are the same, but when I enter it on my device always tells me it is incorrect. This is the password that I asked after clicking on manage my device