Skip to content

Commit

Permalink
Move the scheduling of service restart upstream from onDestroy().
Browse files Browse the repository at this point in the history
  • Loading branch information
santa4nt committed Feb 3, 2014
1 parent 9f7c8e4 commit b6636ee
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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))
Expand All @@ -734,8 +736,6 @@ public void onDestroy()
{
log.debug(".onDestroy()");

WalletApplication.scheduleStartBlockchainService(this);

unregisterReceiver(tickReceiver);

application.getWallet().removeEventListener(walletEventListener);
Expand Down Expand Up @@ -792,6 +792,7 @@ public void onDestroy()
public void onLowMemory()
{
log.warn("low memory detected, stopping service");
WalletApplication.scheduleStartBlockchainService(this);
stopSelf();
}

Expand Down

0 comments on commit b6636ee

Please sign in to comment.