From 2ed51f5b72869cab5bc4c4ad8cfe29b56821cb3b Mon Sep 17 00:00:00 2001 From: Santoso Wijaya Date: Wed, 5 Feb 2014 09:22:34 -0800 Subject: [PATCH] Again, move the scheduling of service restart upstream from onDestroy(). --- .../de/schildbach/wallet/service/BlockchainServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wallet/src/de/schildbach/wallet/service/BlockchainServiceImpl.java b/wallet/src/de/schildbach/wallet/service/BlockchainServiceImpl.java index a1d4e43788..3fb2a2887b 100644 --- a/wallet/src/de/schildbach/wallet/service/BlockchainServiceImpl.java +++ b/wallet/src/de/schildbach/wallet/service/BlockchainServiceImpl.java @@ -563,6 +563,7 @@ public void onReceive(final Context context, final Intent intent) if (isIdle) { log.info("idling detected, stopping service"); + WalletApplication.scheduleStartBlockchainService(BlockchainServiceImpl.this); stopSelf(); } } @@ -708,6 +709,7 @@ else if (BlockchainService.ACTION_RESET_BLOCKCHAIN.equals(action)) log.info("will remove blockchain on service shutdown"); resetBlockchainOnShutdown = true; + WalletApplication.scheduleStartBlockchainService(this); stopSelf(); } else if (BlockchainService.ACTION_BROADCAST_TRANSACTION.equals(action)) @@ -734,8 +736,6 @@ public void onDestroy() { log.debug(".onDestroy()"); - WalletApplication.scheduleStartBlockchainService(this); - unregisterReceiver(tickReceiver); application.getWallet().removeEventListener(walletEventListener); @@ -792,6 +792,7 @@ public void onDestroy() public void onLowMemory() { log.warn("low memory detected, stopping service"); + WalletApplication.scheduleStartBlockchainService(this); stopSelf(); }