Code example for AlarmManager

Methods: cancel

0
        if (pending != null) {
            // Cancel any previous alarms that do the same thing. 
            AlarmManager alarmManager =
              (AlarmManager) context.getSystemService (Context.ALARM_SERVICE);
 
            alarmManager.cancel(pending);
        } 
    } 
 
    @Override 
    public void onReceive(Context context, Intent intent) {
        LocalBluetoothAdapter localBluetoothAdapter = LocalBluetoothAdapter.getInstance();
 
         if(localBluetoothAdapter != null  &&
            localBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON) {
            Log.d(TAG, "Disable discoverable...");
 
            localBluetoothAdapter.setScanMode(BluetoothAdapter.SCAN_MODE_CONNECTABLE);
         } else { 
            Log.e(TAG, "localBluetoothAdapter is NULL!!");
        }