Example usage for android.content Intent EXTRA_ALARM_COUNT

List of usage examples for android.content Intent EXTRA_ALARM_COUNT

Introduction

In this page you can find the example usage for android.content Intent EXTRA_ALARM_COUNT.

Prototype

String EXTRA_ALARM_COUNT

To view the source code for android.content Intent EXTRA_ALARM_COUNT.

Click Source Link

Document

Used as an int extra field in android.app.AlarmManager intents to tell the application being invoked how many pending alarms are being delievered with the intent.

Usage

From source file:com.hivewallet.androidclient.wallet.service.BlockchainServiceImpl.java

@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
    if (intent != null) {
        log.info("service start command: " + intent
                + (intent.hasExtra(Intent.EXTRA_ALARM_COUNT)
                        ? " (alarm count: " + intent.getIntExtra(Intent.EXTRA_ALARM_COUNT, 0) + ")"
                        : ""));

        final String action = intent.getAction();

        if (BlockchainService.ACTION_CANCEL_COINS_RECEIVED.equals(action)) {
            nm.cancel(NOTIFICATION_ID_COINS_RECEIVED);
        } else if (BlockchainService.ACTION_RESET_BLOCKCHAIN.equals(action)) {
            log.info("will remove blockchain on service shutdown");

            resetBlockchainOnShutdown = true;
            stopSelf();//from  w  w w  .  j a  v a  2  s.c  o  m
        } else if (BlockchainService.ACTION_BROADCAST_TRANSACTION.equals(action)) {
            final Sha256Hash hash = new Sha256Hash(
                    intent.getByteArrayExtra(BlockchainService.ACTION_BROADCAST_TRANSACTION_HASH));
            final Transaction tx = application.getWallet().getTransaction(hash);

            if (peerGroup != null) {
                log.info("broadcasting transaction " + tx.getHashAsString());
                peerGroup.broadcastTransaction(tx);
            } else {
                log.info("peergroup not available, not broadcasting transaction " + tx.getHashAsString());
            }
        }
    } else {
        log.warn("service restart, although it was started as non-sticky");
    }

    return START_NOT_STICKY;
}

From source file:com.bushstar.htmlcoin_android_wallet.service.BlockchainServiceImpl.java

@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
    if (intent != null) {
        log.info("service start command: " + intent
                + (intent.hasExtra(Intent.EXTRA_ALARM_COUNT)
                        ? " (alarm count: " + intent.getIntExtra(Intent.EXTRA_ALARM_COUNT, 0) + ")"
                        : ""));

        final String action = intent.getAction();

        if (BlockchainService.ACTION_CANCEL_COINS_RECEIVED.equals(action)) {
            notificationCount = 0;/*from www .  j  a  v  a2 s  . c  om*/
            notificationAccumulatedAmount = BigInteger.ZERO;
            notificationAddresses.clear();

            nm.cancel(NOTIFICATION_ID_COINS_RECEIVED);
        } else if (BlockchainService.ACTION_RESET_BLOCKCHAIN.equals(action)) {
            log.info("will remove blockchain on service shutdown");

            resetBlockchainOnShutdown = true;
            stopSelf();
        } else if (BlockchainService.ACTION_BROADCAST_TRANSACTION.equals(action)) {
            final Sha256Hash hash = new Sha256Hash(
                    intent.getByteArrayExtra(BlockchainService.ACTION_BROADCAST_TRANSACTION_HASH));
            final Transaction tx = application.getWallet().getTransaction(hash);

            if (peerGroup != null) {
                log.info("broadcasting transaction " + tx.getHashAsString());
                peerGroup.broadcastTransaction(tx);
            } else {
                log.info("peergroup not available, not broadcasting transaction " + tx.getHashAsString());
            }
        }
    } else {
        log.warn("service restart, although it was started as non-sticky");
    }

    return START_NOT_STICKY;
}

From source file:ja.keystore00.wallet.service.BlockchainServiceImpl.java

@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
    if (intent != null) {
        log.info("service start command: " + intent
                + (intent.hasExtra(Intent.EXTRA_ALARM_COUNT)
                        ? " (alarm count: " + intent.getIntExtra(Intent.EXTRA_ALARM_COUNT, 0) + ")"
                        : ""));

        final String action = intent.getAction();

        if (BlockchainService.ACTION_CANCEL_COINS_RECEIVED.equals(action)) {
            notificationCount = 0;//from w  w  w .j a va2  s . c om
            notificationAccumulatedAmount = BigInteger.ZERO;
            notificationAddresses.clear();

            nm.cancel(NOTIFICATION_ID_COINS_RECEIVED);
        } else if (BlockchainService.ACTION_RESET_BLOCKCHAIN.equals(action)) {
            log.info("will remove blockchain on service shutdown");

            resetBlockchainOnShutdown = true;
            stopSelf();
        } else if (BlockchainService.ACTION_BROADCAST_TRANSACTION.equals(action)) {
            final Sha256Hash hash = new Sha256Hash(
                    intent.getByteArrayExtra(BlockchainService.ACTION_BROADCAST_TRANSACTION_HASH));
            final Transaction tx = application.getWallet().getTransaction(hash);

            if (peerGroup != null) {
                log.info("broadcasting transaction " + tx.getHashAsString());
                peerGroup.broadcastTransaction(tx);
            } else {
                log.info("peergroup not available, not broadcasting transaction " + tx.getHashAsString());
            }
        }
    }
    return START_NOT_STICKY;
}

From source file:com.cannabiscoin.wallet.service.BlockchainServiceImpl.java

@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
    log.info("service start command: " + intent
            + (intent.hasExtra(Intent.EXTRA_ALARM_COUNT)
                    ? " (alarm count: " + intent.getIntExtra(Intent.EXTRA_ALARM_COUNT, 0) + ")"
                    : ""));

    final String action = intent.getAction();

    if (BlockchainService.ACTION_CANCEL_COINS_RECEIVED.equals(action)) {
        notificationCount = 0;/* w  ww .j av a 2s. c o  m*/
        notificationAccumulatedAmount = BigInteger.ZERO;
        notificationAddresses.clear();

        nm.cancel(NOTIFICATION_ID_COINS_RECEIVED);
    } else if (BlockchainService.ACTION_RESET_BLOCKCHAIN.equals(action)) {
        log.info("will remove blockchain on service shutdown");

        resetBlockchainOnShutdown = true;
        //WalletApplication.scheduleStartBlockchainService(this);  //disconnect feature
        stopSelf();
    } else if (BlockchainService.ACTION_BROADCAST_TRANSACTION.equals(action)) {
        final Sha256Hash hash = new Sha256Hash(
                intent.getByteArrayExtra(BlockchainService.ACTION_BROADCAST_TRANSACTION_HASH));
        final Transaction tx = application.getWallet().getTransaction(hash);

        if (peerGroup != null) {
            log.info("broadcasting transaction " + tx.getHashAsString());
            peerGroup.broadcastTransaction(tx);
        } else {
            log.info("peergroup not available, not broadcasting transaction " + tx.getHashAsString());
        }
    } else if (BlockchainService.ACTION_STOP_SERVICE.equals(action)) {
        log.info("stopping self");
        // deliberate stop command, so don't schedule restart
        stopSelf();
    }

    return START_NOT_STICKY;
}

From source file:crea.wallet.lite.service.CreativeCoinService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Log.e(TAG, "onStartCommand");

    org.creativecoinj.core.Context.propagate(CONTEXT);
    if (intent != null) {
        Log.i(TAG,/*from   w  w w.  j  a v a  2 s .  c  o m*/
                "service start command: " + intent
                        + (intent.hasExtra(Intent.EXTRA_ALARM_COUNT)
                                ? " (alarm count: " + intent.getIntExtra(Intent.EXTRA_ALARM_COUNT, 0) + ")"
                                : ""));

        final String action = intent.getAction();

        if (ACTION_CANCEL_COINS_RECEIVED.equals(action)) {
            notificationAccumulatedAmount = Coin.ZERO;
            transactionsReceived.clear();

            if (nm != null) {
                nm.cancel(NOTIFICATION_ID_COINS_RECEIVED);
            }

        } else if (ACTION_BROADCAST_TRANSACTION.equals(action)) {
            broadcastTransactionPendingTx(intent);
        } else if (ACTION_RESET_BLOCKCHAIN.equals(action)) {
            Log.i(TAG, "will remove blockchain on service shutdown");

            resetBlockchainOnShutdown = true;
            stopSelf();
        } else if (ACTION_SEND_PEERS.equals(action)) {
            broadcastPeers();
        } else if (peerGroup != null && peerGroup.isRunning()) {
            broadcastSyncStarted();
        }
    } else {
        Log.e(TAG, "service restart, although it was started as non-sticky");
    }
    return START_NOT_STICKY;
}

From source file:com.blu3f1re.reddwallet.service.BlockchainServiceImpl.java

@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
    log.info("service start command: " + intent
            + (intent.hasExtra(Intent.EXTRA_ALARM_COUNT)
                    ? " (alarm count: " + intent.getIntExtra(Intent.EXTRA_ALARM_COUNT, 0) + ")"
                    : ""));

    final String action = intent.getAction();

    if (BlockchainService.ACTION_CANCEL_COINS_RECEIVED.equals(action)) {
        notificationCount = 0;//from  ww w . j  ava 2s. c  o m
        notificationAccumulatedAmount = BigInteger.ZERO;
        notificationAddresses.clear();

        nm.cancel(NOTIFICATION_ID_COINS_RECEIVED);
    } else if (BlockchainService.ACTION_RESET_BLOCKCHAIN.equals(action)) {
        log.info("will remove blockchain on service shutdown");

        resetBlockchainOnShutdown = true;
        stopSelf();
    } else if (BlockchainService.ACTION_BROADCAST_TRANSACTION.equals(action)) {
        final Sha256Hash hash = new Sha256Hash(
                intent.getByteArrayExtra(BlockchainService.ACTION_BROADCAST_TRANSACTION_HASH));
        final Transaction tx = application.getWallet().getTransaction(hash);

        if (peerGroup != null) {
            log.info("broadcasting transaction " + tx.getHashAsString());
            peerGroup.broadcastTransaction(tx);
        } else {
            log.info("peergroup not available, not broadcasting transaction " + tx.getHashAsString());
        }
    }

    return START_NOT_STICKY;
}

From source file:com.kncwallet.wallet.service.BlockchainServiceImpl.java

@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
    String action = null;//from  w ww .jav  a 2s . co m

    if (intent == null) {
        log.info("Blockchain service started with null intent");
    } else {
        log.info("service start command: " + intent
                + (intent.hasExtra(Intent.EXTRA_ALARM_COUNT)
                        ? " (alarm count: " + intent.getIntExtra(Intent.EXTRA_ALARM_COUNT, 0) + ")"
                        : ""));

        action = intent.getAction();
    }

    if (BlockchainService.ACTION_CANCEL_COINS_RECEIVED.equals(action)) {
        notificationCount = 0;
        notificationAccumulatedAmount = BigInteger.ZERO;
        notificationAddresses.clear();

        nm.cancel(NOTIFICATION_ID_COINS_RECEIVED);
    } else if (BlockchainService.ACTION_RESET_BLOCKCHAIN.equals(action)) {
        log.info("will remove blockchain on service shutdown");

        resetBlockchainOnShutdown = true;
        stopSelf();
    } else if (BlockchainService.ACTION_BROADCAST_TRANSACTION.equals(action)) {
        final Sha256Hash hash = new Sha256Hash(
                intent.getByteArrayExtra(BlockchainService.ACTION_BROADCAST_TRANSACTION_HASH));
        final Transaction tx = application.getWallet().getTransaction(hash);

        if (peerGroup != null) {
            log.info("broadcasting transaction " + tx.getHashAsString());
            peerGroup.broadcastTransaction(tx);
        } else {
            log.info("peergroup not available, not broadcasting transaction " + tx.getHashAsString());
        }
    }

    return START_NOT_STICKY;
}

From source file:com.hamradiocoin.wallet.service.BlockchainServiceImpl.java

@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
    if (intent != null) {
        log.info("service start command: " + intent
                + (intent.hasExtra(Intent.EXTRA_ALARM_COUNT)
                        ? " (alarm count: " + intent.getIntExtra(Intent.EXTRA_ALARM_COUNT, 0) + ")"
                        : ""));

        final String action = intent.getAction();

        if (ACTION_CANCEL_COINS_RECEIVED.equals(action)) {
            notificationCount = 0;/*from ww  w .  j  a  v a2s.c  o m*/
            notificationAccumulatedAmount = BigInteger.ZERO;
            notificationAddresses.clear();
            nm.cancel(NOTIFICATION_ID_COINS_RECEIVED);
        } else if (ACTION_RESET_BLOCKCHAIN.equals(action)) {
            log.info("will remove blockchain on service shutdown");

            resetBlockchainOnShutdown = true;
            stopSelf();
        } else if (ACTION_BROADCAST_TRANSACTION.equals(action)) {
            final Sha256Hash hash = new Sha256Hash(intent.getByteArrayExtra(ACTION_BROADCAST_TRANSACTION_HASH));
            final Transaction tx = application.getWallet().getTransaction(hash);

            if (peerGroup != null) {
                log.info("broadcasting transaction " + tx.getHashAsString());
                peerGroup.broadcastTransaction(tx);
            } else {
                log.info("peergroup not available, not broadcasting transaction " + tx.getHashAsString());
            }
        }
    } else {
        log.warn("service restart, although it was started as non-sticky");
    }

    return START_NOT_STICKY;
}

From source file:cc.mintcoin.wallet.service.BlockchainServiceImpl.java

@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
    log.info("service start command: " + intent
            + (intent.hasExtra(Intent.EXTRA_ALARM_COUNT)
                    ? " (alarm count: " + intent.getIntExtra(Intent.EXTRA_ALARM_COUNT, 0) + ")"
                    : ""));

    //log.info("org.bitcoin.NativeSecp256k1.enabled=" + org.bitcoin.NativeSecp256k1.enabled);

    if (blockChain == null) {
        boolean blockChainFileExists = blockChainFile.exists();
        boolean tryStarting = true;

        if (DownloadCompleteReceiver.isDownloading(application)) {
            log.info("isDownloading");
            DownloadCompleteReceiver.updateDownloadState(application); // it can fix itself this way

            tryStarting = false;/*from   ww  w . j  av  a2s . co  m*/
        } else if (!blockChainFileExists) {
            if (DownloadCompleteReceiver.isObbAvailable(application)) {
                initializeBlockchainFast();
                tryStarting = true;
            } else if (intent.getBooleanExtra(DownloadCompleteReceiver.INTENT_EXTRA_SKIP_OBB_INIT, false)) {
                tryStarting = true;
            } else {
                // open dialog box to ask user what to do for download
                Intent intent2 = new Intent(this, InitialBlockchainActivity.class);
                intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
                startActivity(intent2);
                tryStarting = false;
            }
        }

        if (tryStarting) {
            try {
                startBlockChain();
            } catch (Error e) {
                stopSelf();
                throw e;
            }
        } else {
            stopSelf();
        }
    }

    String action = intent.getAction();

    if (BlockchainService.ACTION_CANCEL_COINS_RECEIVED.equals(action)) {
        notificationCount = 0;
        notificationAccumulatedAmount = BigInteger.ZERO;
        notificationAddresses.clear();

        nm.cancel(NOTIFICATION_ID_COINS_RECEIVED);
    } else if (BlockchainService.ACTION_RESET_BLOCKCHAIN.equals(action)) {
        log.info("will remove blockchain on service shutdown");

        resetBlockchainOnShutdown = true;
        stopSelf();
    } else if (BlockchainService.ACTION_BROADCAST_TRANSACTION.equals(action)) {
        final Sha256Hash hash = new Sha256Hash(
                intent.getByteArrayExtra(BlockchainService.ACTION_BROADCAST_TRANSACTION_HASH));
        final Transaction tx = application.getWallet().getTransaction(hash);

        if (peerGroup != null) {
            log.info("broadcasting transaction " + tx.getHashAsString());
            peerGroup.broadcastTransaction(tx);
        } else {
            log.info("peergroup not available, not broadcasting transaction " + tx.getHashAsString());
        }
    }

    return START_NOT_STICKY;
}

From source file:de.schildbach.wallet.service.BlockchainService.java

@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
    super.onStartCommand(intent, flags, startId);

    if (intent != null) {
        log.info("service start command: " + intent
                + (intent.hasExtra(Intent.EXTRA_ALARM_COUNT)
                        ? " (alarm count: " + intent.getIntExtra(Intent.EXTRA_ALARM_COUNT, 0) + ")"
                        : ""));

        final String action = intent.getAction();

        if (BlockchainService.ACTION_CANCEL_COINS_RECEIVED.equals(action)) {
            notificationCount = 0;/*from ww w . j  a  v a 2 s.c  o m*/
            notificationAccumulatedAmount = Coin.ZERO;
            notificationAddresses.clear();

            nm.cancel(Constants.NOTIFICATION_ID_COINS_RECEIVED);
        } else if (BlockchainService.ACTION_RESET_BLOCKCHAIN.equals(action)) {
            log.info("will remove blockchain on service shutdown");

            resetBlockchainOnShutdown = true;
            stopSelf();
        } else if (BlockchainService.ACTION_BROADCAST_TRANSACTION.equals(action)) {
            final Sha256Hash hash = Sha256Hash
                    .wrap(intent.getByteArrayExtra(BlockchainService.ACTION_BROADCAST_TRANSACTION_HASH));
            final Transaction tx = application.getWallet().getTransaction(hash);

            if (peerGroup != null) {
                log.info("broadcasting transaction " + tx.getHashAsString());
                peerGroup.broadcastTransaction(tx);
            } else {
                log.info("peergroup not available, not broadcasting transaction " + tx.getHashAsString());
            }
        }
    } else {
        log.warn("service restart, although it was started as non-sticky");
    }

    return START_NOT_STICKY;
}