I am trying to load in a Google Play books image thumbnail from a URL using Fresco (I've also tried using Glide and Picasso) 1.10.0. I am able to load in another image (such as this https://i.imgur.com/6zDqjm8.jpg), but only the placeholder image shows when I use the Google Play Books thumbnail link (e.g. http://books.google.com/books/content?id=F1wgqlNi8AMC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api).
I've also tried adding ".jpeg" on to the end of the link (since in a web browser the image still shows) in the Uri.parse code, but it doesn't make a difference.
Do you know why this is and/or what I am doing wrong?
I have got the INTERNET permission in my manifest. I also have the Fresco namespace in my XML file.
My Fresco code (taken from Getting Started with Fresco guide):
Uri uri = Uri.parse("http://books.google.com/books/content?id=F1wgqlNi8AMC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api");
SimpleDraweeView draweeView = findViewById(R.id.my_image_view);
draweeView.setImageURI(uri);
XML code for the SimpleDraweeView:
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/my_image_view"
android:layout_width="130dp"
android:layout_height="130dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView"
fresco:placeholderImage="@drawable/search_white_24dp" />
JSON I'm working with (for more Google Play Books thumbnails): https://pastebin.com/hq4AFMRb
Please let me know if you need any more information (e.g. XML). I don't mind using a different third-party library (including Glide or Picasso) if that works.
Looks like, that unprotected traffic is no longer available for making requests to the Google Books servers (Pay attention at the piece of the Glide's log below):
08-09 22:31:06.428 7606-7606/com.sandbox.test W/Glide: Load failed for http://books.google.com/books/content?id=F1wgqlNi8AMC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api with size [2392x2392] class com.bumptech.glide.load.engine.GlideException: Failed to load resource There were 2 causes: java.io.IOException(Cleartext HTTP traffic to books.google.com not permitted) java.io.FileNotFoundException(No content provider: http://books.google.com/books/content?id=F1wgqlNi8AMC&printsec=frontcover&img=1&zoom=5&edge=curl&source=gbs_api) call GlideException#logRootCauses(String) for more detail Cause (1 of 2): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, REMOTE There was 1 cause:
So, you can just add the "S" letter to pictures url protocol from the API and make a request through HTTPS.
In my case, this did the trick.