abcore icon indicating copy to clipboard operation
abcore copied to clipboard

Foreground service is never stopped

Open gwicks56 opened this issue 5 years ago • 1 comments

When the switch (android:id="@+id/switchCore") is toggled on the foreground services is started, but when it is toggled off stopservice() is never called, which means although it disconnects and stops the sync, the notification is left in the notification status bar ( ABCore is Running), which is a bit confusing.

Unless there is a reason you need ABCore to continue to treat the app as a foreground app after the switch is toggled, call:

stopService(new Intent(MainActivity.this, ABCoreService.class));

in

 stopDaemonAndSetStatus()

Alternatively you can do it inside ABCoreService with intent extras and calling stopForeground(true) and then stopSelf()

gwicks56 avatar Sep 03 '19 08:09 gwicks56

Agree either of the option (first one seems more reasonable since we don't need the service running) - @udiWertheimer ?

I think part of the issue here is the asymmetry as well, we start core as a new process but to stop it we use the RPC and that for example has races, especially if you try to stop it immediately while is still verifying blocks ...

We need something like -rpcwait in bitcoin-cli before we issue rpc requests, likewise we also need to handle rpc being down failures since a bad bitcoin.conf could easily make it bail out

greenaddress avatar Sep 04 '19 12:09 greenaddress