I want to download images using HTTP3 and Glide.
I read that I can use Cronet to send HTTP3 requests in android and I can integrate Glide and Cronet in my app.
According to this doc, Glide will start using Cornet as soon as we add the following gradle dependency -
implementation "com.github.bumptech.glide:cronet-integration:4.14.2"
Below is my final app level gradle (dependencies only) -
// rest of the code
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'com.google.android.gms:play-services-cronet:18.0.1'
implementation 'com.github.bumptech.glide:glide:4.15.1'
implementation "com.github.bumptech.glide:cronet-integration:4.14.2"
}
And my MainActivity is -
package a.b.glide_cronet;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView imageView = (ImageView) findViewById(R.id.image_view);
Glide.with(this).load("https://<http3 supported server domain>/test/birthday1.gif").into(imageView);
}
}
When I ran my app, it downloaded the image using HTTP2 (checked from CDN logs) whereas if I open same URL in Chrome browser it uses HTTP3 (CDN server is configured to serve using HTTP3). I couldn't find any example/documentation online to explicitly configure Cronet to use HTTP3 with Glide.
Question - How to enable/use Cronet with Glide so that images can be downloaded using HTTP3?
Note - My device's android version is 13.
Thanks