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

Any plans to support Android? #76

Open
Levi-Lesches opened this issue May 2, 2023 · 5 comments
Open

Any plans to support Android? #76

Levi-Lesches opened this issue May 2, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Levi-Lesches
Copy link

The Android docs say to explicitly request permission before trying to use Serial functionality. Unfortunately, this is not something that can be done in the Manifest but must be done using Java/Kotlin, like package:usb_serial does.

Are there any plans to support that here?

@magnus-lpa
Copy link

Is there any way to do it manually?

@Levi-Lesches
Copy link
Author

Levi-Lesches commented Jun 22, 2023

You would need to add a new method to the Android method channel, by adding an else-if right here:

override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
if (call.method == "getPlatformVersion") {
result.success("Android ${android.os.Build.VERSION.RELEASE}")
} else {
result.notImplemented()
}
}

and then call that method on the Dart side by following the instructions here

If you get that working, maybe consider submitting a PR?

@magnus-lpa
Copy link

@Levi-Lesches Thanks, I ended up using the usb_serial plugin instead. Just a note to others thinking of doing the same - that plugin also doesn't support the Android permission handling correctly with the current version on pub.dev, but with the latest commit (c20e1e6e171137db4b52413dac14333653f07905) from Github it does.

@guyluz11
Copy link

guyluz11 commented Dec 25, 2023

The Android docs say to explicitly request permission before trying to use Serial functionality. Unfortunately, this is not something that can be done in the Manifest but must be done using Java/Kotlin, like package:usb_serial does.

Are there any plans to support that here?

Did it worked for you?.
If so it will be nice if you can you add a pr for that and tag this issue.
usb_serial only supports Android and I prefer a package that can support multiple platforms like this one.

@Levi-Lesches
Copy link
Author

Turned out my use-case of serial on Android wasn't so strong so I dropped it for now, but I would like to see this implemented here as well.

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

When branches are created from issues, their pull requests are automatically linked.

4 participants