-
Notifications
You must be signed in to change notification settings - Fork 72
If the screen has been closed before the second Activity back, then the first Activity will not receive a callback #27
Comments
I add some code onResultActivity like this,it seems solved my problem
|
That's very weird. Have you some dev config activated in your device? This has been tested before, actually I tested again right now and it seems to work fine. Are you using the sample project? If not, I recommend to you to test this problem taking as stating point that project. |
Different mobile phone test results are the same I write a demo this is the log
FirstActivity did not receive the message : 'call: get result from second activity' |
@VictorAlbertos thanks for this library...it's clearly made our code cleaner and way more readable. However, we seem to be running into a similar issue as @kexuebiao. And more surprisingly, in our case, it is happening consistently on a particular device and not on all devices. The fix suggested by @kexuebiao above seems to fix the issue that particular device also. Would you be willing to consider accepting such a change in your code? Or do you have any suggestions on what we can try to get around the issue we are running into? |
After debugging more, here's what I found. It looks like there's an assumption in the RxActivityResult code that the liveActivity will get set when onDestroyed is called for the HolderActivity. Unfortunately, on at least one particular device, this is not happening. I added logs in ActivitiesLifecycleCallbacks class, and here's the sequence that I found. 09:59:13.867 Created: com.myapp.MyActivity Because of this, when onHolderActivity is destroyed, if the onResult.response is invoked before the parent activity is resumed then there is no live activity. This is why the code added above seems to solve the problem since it effectively waits for the new activity to resume. Is there something wrong in my understanding here? |
However, the code above doesn't work when using RxPaparazzo if we turn on "Don't keep activities" option in Android. In that case, when the image selection view opens, HolderActivity gets destroyed and the above response code starts running. Once image is selected and HolderActivity resumes and then gets destroyed again, another instance of that response code starts running. Depending on which one actually runs first, sometimes the code works and sometimes it doesn't. My current workaround is to change the Observable.interval to an Observable.timer that just adds a delay to handle the issue that I noted above. But this is clearly a hack :( There ought to be better solutions than this hack. |
For today android got new way working with results. https://developer.android.com/training/basics/intents/result Anyone of implementations RxResult I found has this bug and it's critacal error. |
##Summary
If the screen has been closed before the second Activity back, then the first Activity will not receive a callback
Preconditions
#### Steps to reproduce actual result 1.
Actual result
#### Expected result
The text was updated successfully, but these errors were encountered: