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

Can't see MoreExtras passed via ScanOptions inside registerForActivityResult #735

Open
raucascrokkia opened this issue Mar 11, 2023 · 3 comments

Comments

@raucascrokkia
Copy link

Description of the problem:

I just need to pass some extra values by ScanOption "addExtra" function, but then i can't see them in the originalIntent object, when registerForActivityResult function is called.

Which library version are you using?
4.3.0

Which phone/tablet are you using, and which Android version does it run? (e.g. Samsung Galaxy S5,
Android 5.0)

Emulating Pixel3a API 21

Does the same happen on other devices or an emulator?
Emulator

Can you reproduce the issue in the sample project included with the library?
Yes

In the case of an error do you have a stack trace or adb logs?
No error is thrown

@budo385
Copy link

budo385 commented Apr 18, 2023

+1

@Siddiq200
Copy link

Looking for the same thing.

@Siddiq200
Copy link

I found the data in intent.extras, I was adding an object, but the library is converting it to a string.

Here is how the library is handling extras:

private void attachMoreExtras(Intent intent) { for (Map.Entry<String, Object> entry : moreExtras.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); // Kind of hacky if (value instanceof Integer) { intent.putExtra(key, (Integer) value); } else if (value instanceof Long) { intent.putExtra(key, (Long) value); } else if (value instanceof Boolean) { intent.putExtra(key, (Boolean) value); } else if (value instanceof Double) { intent.putExtra(key, (Double) value); } else if (value instanceof Float) { intent.putExtra(key, (Float) value); } else if (value instanceof Bundle) { intent.putExtra(key, (Bundle) value); } else if (value instanceof int[]) { intent.putExtra(key, (int[]) value); } else if (value instanceof long[]) { intent.putExtra(key, (long[]) value); } else if (value instanceof boolean[]) { intent.putExtra(key, (boolean[]) value); } else if (value instanceof double[]) { intent.putExtra(key, (double[]) value); } else if (value instanceof float[]) { intent.putExtra(key, (float[]) value); } else if (value instanceof String[]) { intent.putExtra(key, (String[]) value); } else { intent.putExtra(key, value.toString()); } } }

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

No branches or pull requests

3 participants