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

support forcing transport type #2004

Closed
arlakay opened this issue Oct 20, 2023 · 4 comments
Closed

support forcing transport type #2004

arlakay opened this issue Oct 20, 2023 · 4 comments

Comments

@arlakay
Copy link

arlakay commented Oct 20, 2023

Request Statement

in native android we can forcing http connection over cellular data / wifi using okhttp3
this example snippet code
.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)

my question, is it dio have configuration to force connection over cellular/wifi?

Solution Brainstorm

No response

Tasks

Preview Give feedback
No tasks being tracked yet.
@arlakay arlakay added the s: feature This issue indicates a feature request label Oct 20, 2023
@kuhnroyal
Copy link
Member

kuhnroyal commented Oct 20, 2023

You can do that with the https://pub.dev/packages/native_dio_adapter for iOS but I am not sure about the Android side which uses https://pub.dev/packages/cronet_http

But plain dio on Dart side does not support this.

@ueman
Copy link
Contributor

ueman commented Oct 21, 2023

As said in the comment above, dio itself can't and won't support this usecase. It is possible with the native adapter, or you can manually check what connection is currently active and make requests accordingly.

@ueman ueman closed this as completed Oct 21, 2023
@arlakay
Copy link
Author

arlakay commented Oct 21, 2023

Hi @kuhnroyal , thanks for your information.
do you have example/reference for native dio adapter for ios, that forces cellular data?

I can't find any configuration that supports my issue above.
cronet_http doesn't have configuration-related force cellular data with cronet engine.
I don't think, native dio adapter also has this configuration for forcing cellular data.

At this time, I think the only solution on native side, using platform-specific channel

here is my reference on Android developer web.
https://developer.android.com/reference/android/net/NetworkRequest.Builder

@kuhnroyal
Copy link
Member

Yea, you can actually only disallow cellular access with cupertino_http but you can not force it, my bad.

@AlexV525 AlexV525 added i: out of support and removed s: feature This issue indicates a feature request labels Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants