I am currently working on a library project for Android which I plan on open sourcing. The library has an activity that I need to return a result for so the app that's utilising the library will need to call startActivityForResult
.
My question is, if the user has an activity within their app, which calls a second activity within their own app which also needs to return a result, and this activity needs to call the activity from my library, my libraries activity, and their own activity will be using the same onActivityResult callback. Is there a way to avoid my activities request code, not conflicting with one of their own request codes, is it just a case of assume their own request codes are 1, 2, 3 etc and I start my libraries activity request code from some arbitrary number like 1000.
Is this just the way it works or is there a better way to avoid my request code for my library conflicting with another apps activities request code?
I think the library should give a parameter to specify request code by developer themselves for startActivityForResult, so they could never be conflicted in the same activity or fragment they have been called from.