GOOGLE DRIVE API (Android Studio Project-Displaying Images From a particular folder from google drive to Recycler view)
1.Create A new Project in Android Studio
and API key refer below Link
https://developers.google.com/drive/android/get-started?authuser=1
2.Enable Drive API ,for your Project from Below link
https://console.developers.google.com/apis/library/drive.googleapis.com
3.Use this below link ton get demo JSON responce
https://developers.google.com/apis-explorer/?hl=en_GB#p/drive/v3/
4.Use this String As a JSON URL Replace the Folder ID id Key with your own
https://www.googleapis.com/drive/v3/files?q='{folder_ID}'+in+parents&key={Your_key_here}
5.once you have Key just check this URL in Postman you will get All files JSON
6. I am using Retrofit2 to for Parsing JSON
{
"kind": "drive#fileList",
"incompleteSearch": false,
"files": [
{
"kind": "drive#file",
"id": "19AFwnkh67eiAIclxAb55LMVtze7JHHUG",
"name": "mohanlal-600.jpg",
"mimeType": "image/jpeg"
},
{
"kind": "drive#file",
"id": "1hYGI-c7V9eHUPl9F_CEhRNQoVjiX6rp2",
"name": "dileep.jpg",
"mimeType": "image/jpeg"
},
{
"kind": "drive#file",
"id": "1n0YGtzk5WNAFBPF9mQLx5II-Uhh6hv9V",
"name": "42141199b151313b1fefc3ba6049544b--nivin-pauly-premam-film-industry.jpg",
"mimeType": "image/jpeg"
},
{
"kind": "drive#file",
"id": "1Y2pIBN5WYqv3dXOpARrFpuPOyRzjsyXc",
"name": "nivin 3.jpg",
"mimeType": "image/jpeg"
},
{
"kind": "drive#file",
"id": "18J9L5HrLUBXBX2NpTIiiHULZtsUTxT9q",
"name": "vikram_25416_13.jpg",
"mimeType": "image/jpeg"
},
{
"kind": "drive#file",
"id": "1fpg1kU20dCYAKFjs6SFvm2xk3t09qYyL",............>>>>>>>>>>Image Id
"name": "be77dcd01c4de4c342b6f5f002afaf90.jpg",
"mimeType": "image/jpeg"
}
]
}
https://drive.google.com/uc?export=view&id={USE_the_IMAGE_ID}
{ "id": "1fpg1kU20dCYAKFjs6SFvm2xk3t09qYyL",............>>>>>>>>>>Image Id}
FINAL OUTPUT
DOWNLOAD FULL Android Studio SOURCE CODE FROM HERE!
Comments
Post a Comment