SystemListener powerOff()

JDE: 4.3.0

I'm developing a MIDlet and I implemented the SystemListener in order for me to use the powerOff method that is called when the powers of the user out of the unit. When I run the Simulator and run the MIDlet and then hold the red button, the extinction method is not called, is the method powerOn() when I press the red button again. It is also the dehaviour on the device. I have also written a midlet to test but I get the same results.

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import net.rim.device.api.system.SystemListener;

public class PowerOffTest extends MIDlet implements SystemListener {
   Form f = new Form ("Power Off");
   Display d;

   public PowerOffTest() {
      d = Display.getDisplay( this );
      d.setCurrent( f );
   }

    public void startApp() {
       f.append( "START APP CALLED" );
       System.out.println( "START APP" );
    }

    public void pauseApp() {
       f.append( "PAUSE APP CALLED" );
       System.out.println( "PAUSE APP" );
    }

    public void destroyApp(boolean unconditional) {
       f.append( "DESTORY APP CALLED" );
       System.out.println( "DESTROY APP" );
    }

   public void powerOff() {
      f.append( "POWER OFF CALLED" );
      System.out.println( "POWER OFF" );
   }

   public void powerUp() {
      f.append( "POWER UP CALLED" );
      System.out.println( "POWER UP" );
   }

   public void batteryLow() {

   }

   public void batteryGood() {

   }

   public void batteryStatusChange( int arg0 ) {

   }
}

Can someone tell me what I need to do for my MIDlet to detect the device is off.

resolved, in my midlet I use

Application.getApplication () .addSystemListener (this);

works a charm!

Tags: BlackBerry Developers

Similar Questions

  • Wake up auto and sleep mode. Please explain.

    Hello

    For as far as I understand this (SystemListener-> powerOff()) event called when the application is delivered in mode waiting (not the total power off). In this mode the awakening can automatically switch to the alarm time.

    Issues related to the:

    How can my application determine that the device will mode sleep?

    In both cases (when the device goes to the waiting and the total power off - the same method of SystemListener called - powerOff())

    How can my application automatically activate the device when it is in standby as awakening of blackberry application?

    Please explain.

    Thank you.

    Yes, this is the exact reason that powerUp() exists. I use it in my controller class (s) to restart the thread of communication in the same scenario, when a user has auto-on/off and let the software running.

    as I looked upwards, I saw powerOffRequested (int reason) in the SystemListener2 interface, the only reason listed is POWER_OFF_KEY_PRESSED. not very useful I guess.

  • Anyway to be notified if a device is reset?

    Nice day

    Although far-fetched, (application crashes in particular), is it possible for an application to be notified if and until the device has been reset?

    Since I use information in the store of DURATION, and make clean up routine tasks, I would need to perform these tasks before the unit resets.

    See you soon,.

    Nik.

    SystemListener.powerOff ().

    RuntimeStore is allowed out right now too.

    Just referring to your previous question, for things like ApplicationMenuItems, it works really well.  If you add an ApplicationMenuItem and add it to RuntimeStore, you can detect whether they have been added by checking your RuntimeStore. And you have no need to remove to powerOff because it will happen anyway and your RuntimeStore is erased, keeping everything in sync without any effort on your part!

  • Wait on powerOff()

    Hello

    in my application I send via FTP some files and I need to wait until it finished so stop the bb user.

    I use SystemListener, I've implemented on my screen and I do things in the same thread (I do not use invokeLater or something similar).

    When I press the botton to stop at the stop near the bottom of the Terminal there are not running everything what I want... an idea?

    Thank you

    You put something in this routine and put a breakpoint to ensure that it is achieved:

    public void powerOff() {}

    }

    Make sure that you add the SystemListener:

    Application.getApplication () .addSystemListener (this);

  • Issue of SystemListener

    In my application, UiApplication i have implemented SystemListener and don't have any other point of entry.

    If I left my app app still receives such powerOff() and powerOn() notifications?

    How do I get this to work as the earpiece of the phone that works even when the application is not running or in the background?

    "If I leave my app app still receives such powerOff() and powerOn() notifications?  NO.

    "How do I get it works like the earpiece of the phone that works even when the application is not running or in the background?" You can not.

  • Add SystemListener in any application related to the foreground?

    Can we add SystemListener as soon as any application, in blackberry, comes to foregound? I mean, how can I check when ANY application comes to the foreground and SystemListener add?

    Thanks in advance.

    You cannot add a listener for another application.

    You might be able to consider applications "active" and figure that it has the focus. You can also detect when it starts or stops using the ApplicationManager.getVisibleApplications

  • Create logs in real-time after poweroff vms

    I create script poweroff mV. I would record in real time in an excel or html file which were poweroff vms to follow. Is possible?

    I think you'd better examine the events to get the start and stop times, i.e. the events of ignition and extinction.

    The following will give you a list of these events in the last 10 days

    $events = get-VIEvent-start (Get-Date).adddays(-10) |

    where {$_-is [VMware.Vim.VmPoweredOnEvent] - or $_-is [VMware.Vim.VmPoweredOnEvent]} |

    Group-object - property {$_.} Vm.Name} | %{

    $_. Group | Select @{N = "VMname"; E={$_. Vm.Name}},

    @{N = "Createduserid"; E={$_. Createduserid}},

    @{N = 'Action'; {E = {if ($_-is [VMware.Vim.VmPoweredOnEvent]) {'Poweron'} else {'Poweroff'}}},

    @{N = 'User'; E={$_. User name}}

    }

    $events | Export-Csv "C:\VM-power.csv" - NoTypeInformation - UseCulture

  • How can you poweroff VM in vSphere 4.1

    I start the vmware on a XP machine tool in machine host ESX 4.1. Now, I'm unable to poweroff and following error message invites.

    "Another task is already underway"

    You can help

    Also you can connect to ESX through ssh, get the pid process by ' ps - ax | grep "and kill pid.

  • Poweroff / poweron VM via the powerCLI script

    Hello

    Is it possible to script a poweroff OWN for all my VM on a cluster (RedHat and Windows). Ditto for the ignition.

    If YES, can you give me the lines in the batch

    THX

    Yes, this triggers a stop through the guest OS.

    For a cluster, you could do

    Get-Cluster -Name  | Get-VM | Shutdown-VMGuest -Confirm:$false
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Should I the privilege-"VirtualMachine.Interact.PowerOff".

    My requirement is to check if the user running the script got Priviledge to turn off a computer virtual-"VirtualMachine.Interact.PowerOff". How can I check this?

    I am able to make groups of users with permissions on my virtual machine, but impossible to get the PRIVILEGE - I have to check if I have the privilege of 'VirtualMachine.Interact.PowerOff' on myVM and then take action.

    Connect-Viserver & lt; viServer & gt;

    $si = get-view ServiceInstance

    $am = $si.content.authorisationManager

    $myVM = get - VM & lt; myVM & gt; Get-View

    $perm = $am. RetrieveEntityPermission ($myVM.MoRef, $true)

    $perm

    -


    Outout-


    Entity: VMware.Vim.ManagedObjectReference

    Main: users

    Group: true

    RoleId: 156

    Spread: true

    DynamicType:

    DynamicProperty:

    -


    How to get the privileges for users? or control user got a specific privilege

    Thank you

    Isn't better to use the effectiveRole property.

    There is no need to call the RetrieveEntityPermissions method, given that the system that has already done for you.

    Something like this for example?

    $am = get-view (Get-View ServiceInstance).Content.AuthorizationManager
    $myVM = Get-VM testVM | Get-View
    
    foreach($effRole in $myVM.EffectiveRole){
         foreach($role in $am.RoleList){
              if ($role.RoleId -eq $effRole){
                   foreach($priv in $role.Privilege){
                        if($priv -eq "VirtualMachine.Interact.PowerOff"){
                             Write-Host "User has power off permission"
                        }
                   }
              }
         }
    }
    
  • Iwatch Poweroff Navigation app

    Hello

    I use an app of Navigation (Navigon) and discovered that there is an app iwatch. But there is a big problem: after a while, the application on the watch is somehow stopped and useless for this purpose. I mean: when I turn my wrist, the watch display is turned off. As soon as I move my wrist forward again, it comes back to life and shows the navigation app. But after awhile, in doing so, the app is no longer active and I can only see the normal time display. This means that I don't get any information on how I have to go.

    Now I wonder if it's a problem of the app or setting for the watch. It may be the last, because I discovered that other applications also show this behavior.

    CCAN anyone help me please on this?

    Hello

    The display on Apple Watch may stay awake up to 70 seconds after being woken up by tapping on it. To set this option:

    On your iPhone, in the application of the watch, go to: My Watch (tab) > General > screen Wake > under "The tap", select Wake for 70 seconds.

    On the same screen, under the title "Raise the wrist", also choose the option of last activity to resume.

    Your watch will then automatically return to the last app consulted when the display is awakened from his sleep.

  • Quick PowerOff and PowerOn some VM

    We do a test this weekend where I need to start/stop a number of VM, it can be done by a simple script like:

    SE connect-VIServer vcenter1 - WarningAction: SilentlyContinue | Out-Null

    $OTA = ipcsv d:\ota.csv-delimiteur ';

    $AllVMs = $OTA | % {Get - VM $_.} VM}

    $AllVMs | Stop-VMGuest-confirm: $false - WhatIf

    Disconnect-VIServer vcenter1 - confirm: $false - WarningAction: SilentlyContinue

    But it takes about 10 minutes before the AllVMs table is built with about 64 targeted virtual computer. I have little time to dive the function get-view and I was wondering if this can be done more quickly in any case. BTW, I need to start the machines too, so I want to use the same script, but then with a start-vm. But if I can build the table a little faster it would be pretty useful up to now

    And Yes, I added - whatif to test course

    Hey, it will be much faster if you only use the names of the virtual machines in the CSV:

    $OTA = ipcsv d:\ota.csv-delimiteur ';

    $AllVMs is get - VM $OTA. Name

    $AllVMs | Stop-VMGuest-confirm: $false - WhatIf

  • How to get VM IP is invited is poweroff?

    Hi all

    I would like to get the IP address of the machine which is extinguished in the inventory, but $_. ExtensionData.Guest œuvres; only when the machine is under voltage.

    is it possible to do this by using network cards or... Exchange of dv-switch.
    other details:
    vCenter - 5.0
    DVS - 5.0

    PowerShell - v3.0

    Thanks in advance

    --
    Kind regards

    Sanshis.

    If the mahcine is on the field... and you know the name of a field FULL of the virtual machine then look in DNS or DHCP on your domain controller

  • Building my first application

    Guys, I'm new to the forum. I built a base application that opens a menu IM--> system Messages.

    However after that giving a sleep of 1000 ms the application switches to the MyScreen.java.However I don't want my MyScreen is visible. I want my Menu IM to stay on the bb screen, and then I want to access the menu--> options--> and the following screen... Help me pzzz. And don't forget that I am new to the community. Thank you

    package mypackage;
    
    import net.rim.device.api.system.ApplicationManager;
    import net.rim.device.api.system.ApplicationManagerException;
    import net.rim.device.api.system.SystemListener;
    import net.rim.device.api.ui.UiApplication;
    
    /**
     * This class extends the UiApplication class, providing a
     * graphical user interface.
     */
    public class MyApp extends UiApplication implements SystemListener
    {
        /**
         * Entry point for application
         * @param args Command line arguments (not used)
         */
        public static void main(String[] args)
        {
            //BlackBerryMessenger bbm= BlackBerryMessenger.getInstance();
    
       try {
                ApplicationManager.getApplicationManager().launchApplication("net_rim_bb_qm_peer");
             }
         catch (ApplicationManagerException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } 
    
         try {
                Thread.sleep(1000);
             }
          catch (InterruptedException e)
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
    
            // Create a new instance of the application and make the currently
            // running thread the application's event dispatch thread.
            MyApp theApp = new MyApp();
            theApp.enterEventDispatcher();
    
         try
         {
                Thread.sleep(1000);
         }
    
         catch (InterruptedException e)
    
         {
                // TODO Auto-generated catch block
                e.printStackTrace();
         }
    
       }
    
        public MyApp()
        {
            // Push a screen onto the UI stack for rendering.
            pushScreen(new MyScreen());
        }
    
        public void batteryGood() {
            // TODO Auto-generated method stub
    
        }
    
        public void batteryLow() {
            // TODO Auto-generated method stub
    
        }
    
        public void batteryStatusChange(int status) {
            // TODO Auto-generated method stub
    
        }
    
        public void powerOff() {
            // TODO Auto-generated method stub
    
        }
    
        public void powerUp() {
            // TODO Auto-generated method stub
    
        }
    }
    

    I used your code then change MyScreen.java

    Import net.rim.device.api.system.Application;
    Import net.rim.device.api.system.ApplicationManager;
    Import net.rim.device.api.system.ApplicationManagerException;
    Import net.rim.device.api.ui.MenuItem;
    Import net.rim.device.api.ui.container.MainScreen;

    /**
    * A class that extends the class screen, which offers default standard
    * behavior for BlackBerry GUI applications.
    */
    / public final class MyScreen extends form {}
    /**
    * Creates a new object of MyScreen
    */
    public MyScreen() {}
    Set the displayed title of the screen
    setTitle ("MyTitle");
    addApplicationMenu (this);

    }

    /**
    * Adds a menu that allows the user to perform various message store
    * actions.
    *
    @param screen
    Screen to add the menu to
    */
    void addApplicationMenu (screen display) {}
    AppendUnreadMenuItem MenuItem = new MenuItem ("open Messenger", 1, 1) {}
    public void run() {}
    try {}
    ApplicationManager.getApplicationManager)
    .launchApplication ("net_rim_bb_qm_peer");
    } catch (ApplicationManagerException e) {}
    e.printStackTrace ();
    } {Finally
    Application.getApplication () .requestBackground ();
    }

    }
    };

    mainScreen.addMenuItem (appendUnreadMenuItem);

    }
    }

    and remove the code from MyApp.java. your MyApp will be like this

    **
    * This class extend the UiApplication class, providing a
    * graphical user interface.
    */
    SerializableAttribute public class MyApp extends UiApplication
    {
    /**
    * Entry point for application
    @param args command-line arguments (not used)
    */
    Public Shared Sub main (String [] args)
    {
    Create a new instance of the application and make the currently
    who runs the thread of the application of the event dispatch thread.
    MyApp PAP = new MyApp();
    theApp.enterEventDispatcher ();
    }

    /**
    * Creates a new object MyApp
    */
    public MyApp()
    {
    Push a screen onto the stack in the user interface for rendering.
    pushScreen (new MyScreen());
    }
    }

    (or just copy the code to PASE in your eclipse).

  • app to auto-launch at the start of the device

    I need to run my application at startup of the unit. How to get there. I did a lot of research but doesnot find a good solution. I also tried to implement SystemListener and its different methods, but not the solution as powerUp() and powerOff() method is not called on device turns on or off. I have also tried to change the descriptor and setting auto run on startup but help out me. I ask everyone to please solve my problem as soon as possible because it is very urgent for me. Thanks in advance.

    With the help of which IDE is you you are developing the application... Is - this BlackBerry JDE or using Eclipse...

    If it's BlackBerry JDE then right click on your project and go to properties->, tab Application-click-> and select the check box for system Module & Auto Run on Start Up.

Maybe you are looking for

  • How can I change the setting to remember the password if by chance, I've selected Remember password?

    It seems that every time that my friend goes back to facebook that his login and password are registered even if only she was disconnected before. But that only happens if you go directly to facebook.com on my computer.

  • iPhotos, photos, iCloud?

    I just transferred my huge library of iPhoto (120GB) to Photos app on my iMac, which is not sync to iCloud, but they are all stored on a local hard drive.  I also have iPhone where I backup all of my Photos on iCloud (25 GB) - and can see all these w

  • Does anyone know what com.sec.faxdb.plist refers too?

    Hello Does anyone know what com.sec.faxdb.plist refers too? He used to appear as failed on etrecheck and follow the etrecheck now it upgrade shows up as file unknown /Library/LaunchDaemons/com.sec.faxdb.plist I also always com.google.Chrome.framework

  • HP pavilion g6: laptop

    I have laptop foget administering Power nd on my health key password is 96062477

  • Scanning Photosmart HP 7510 question

    In 2013, I bought a prointer, scanner, fax machine and copier HP Photosmart 7510.  I was able to use all 4 functions after the installation of the printer.  Scanning has been activtated through the HP Photosmart camera on my desktop icon.  Two months