Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActivityResultLauncher Integration #17

Closed
omkar-tenkale opened this issue Apr 16, 2021 · 3 comments
Closed

ActivityResultLauncher Integration #17

omkar-tenkale opened this issue Apr 16, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@omkar-tenkale
Copy link

The current approach involves using onActivityResult()

But it's deprecated now
https://stackoverflow.com/questions/62671106/onactivityresult-method-is-deprecated-what-is-the-alternative

Can we get the SimpleStorage intent, eg

ActivityResultLauncher<Intent> launchSomeActivity = registerForActivityResult(
    new ActivityResultContracts.StartActivityForResult(),
    new ActivityResultCallback<ActivityResult>() {
             @Override
             public void onActivityResult(ActivityResult result) {
                storage.onActivityResult(result);
              }
     });

   public void openYourActivity() {
           Intent intent =storage.getFilePickerIntent();
           launchSomeActivity.launch(intent);
     }
@anggrayudi anggrayudi added the enhancement New feature or request label Apr 17, 2021
@shashifreeze
Copy link

@omkar-tenkale you are right.

@anggrayudi
Copy link
Owner

anggrayudi commented May 13, 2021

Version 0.6.0-SNAPSHOT has been released from branch release/0.6.0. Please test it whether this meets your expectation.
FYI, no need to call onActivityResult() in Fragment. Check it out: https://github.com/anggrayudi/SimpleStorage/blob/release/0.6.0/sample/src/main/java/com/anggrayudi/storage/sample/fragment/SampleFragment.kt

@omkar-tenkale
Copy link
Author

omkar-tenkale commented May 19, 2021

HI @anggrayudi

Thanks for the efforts

But sadly I no longer use the lib because I couldn't create a release build with this lib in my app's dependencies

I had to remove all the code and use SAF methods with hacks

Debug APK was generated but release apk generation would fail with errors related to kotlin and java exceptions i don't remember well now

My app didn't had any kotlin code and as this lib depends on many complex package that might have caused some troubles

Anyways, Thanks for your effort.I hope others will benefit if not me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants