benjarobbi / bitcoin-wallet.github.io

Automatically exported from code.google.com/p/bitcoin-wallet
0 stars 0 forks source link

Activity does not exit from In-App payment started by Intent from another app #207

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create an android app that uses the bitcoin-integration features;
2. Send a payment Intent to this app, e.g. using `requestForResult()`.
3. User enters amount, presses @id/send_coins_go button;
4. Transaction is sent, but `onActivityResult()` of original app is not called 
until user presses "back" button.

What is the desired output? What do you see instead?

Would like `SendCoinsActivity` to `finish()` (or otherwise exit) so that the 
app that sent the Intent will return to the foreground, have its 
`onActivityResult()` called, and thus know whether or not the transaction 
succeeded.

What version of Bitcoin Wallet are you using? On what Android version and
what phone? Don't just state 'most recent', this is not enough info.

Testnet3 bitcoin-wallet version 3.14-test
Android version 4.0.4 on an HTC Doubleshot

--
Adam Mackler

Original issue reported on code.google.com by adammack...@gmail.com on 4 Aug 2013 at 3:55

GoogleCodeExporter commented 9 years ago
Ok, I understand the problem. I'm used to press back anyways, but there are 
users that press "home" notoriously, not noticing that they just put apps into 
the background.

I think this could be solved by an "autofinish" parameter into the 
SendCoinsActivity. I'm not sure when it should finish: Immediately after 
sending, or after receiving back the tx from a number of other peers?

Original comment by andreas....@gmail.com on 5 Aug 2013 at 1:46

GoogleCodeExporter commented 9 years ago
As to when it should finish, that's a good question:

On the one hand, from a responsiveness point-of-view, it ought to finish as 
quickly as possible, provided that doing so does not impair the propagation of 
the transaction.  Making the user wait unnecessarily for anything is bad form.  
Furthermore, from a client-developer point-of-view, the comments to 
`requestForResult()` in the `BitcoinIntegration.java` file read, "A success 
indication is no guarantee," and warn not to rely on bitcoin-wallet as a 
guarantee of propagation, so a client-developer already seems to be on notice 
that bitcoin-wallet did not wait around to make certain the transaction has 
propagated.

On the other hand, the client-developer is using bitcoin-wallet to offload some 
of the burden of initiating a transaction, and maybe confirming successful 
propagation or displaying to the user an error message upon failure ought to be 
part of what is provided to the client-app.  If so, bitcoin-wallet ought to 
display an indeterminate ProgressBar while waiting to hear from peers in order 
that the user knows something is happening in the background.

Perhaps client-developers ought to be given a choice of when the 
SendCoinsActivity will exit?  The most important thing is that control be 
returned to the app that requested the payment and that the developer of that 
app knows what is guaranteed to have occurred prior to the moment when 
`onActivityResult()` has been invoked.  Responsiveness of the user-interface 
seems to be a close second priority, though perhaps I'm not aware of all the 
costs of that trade-off.

Original comment by adammack...@gmail.com on 5 Aug 2013 at 4:39