I do not need to get the content of the file, I just need ID only! If this is impossible then the impossibility should be the answer.
I get the content URI from android intent ACTION_GET_CONTENT
using flutter plugin file_picker.
It work perfectly, but I need to get the selected document ID (spreadsheet ID, specifically) in Google Drive.
The URI I got looks like:
content://com.google.android.apps.docs.storage/document/acc%3D1%3Bdoc%3Dencoded%3DBEskNs6jf7jS24J%2FMnNdnr7fDrih03xNetfcCUsggemjSmpiWBC5
After using URL decoded it turns out to be like:
content://com.google.android.apps.docs.storage/document/acc=1;doc=encoded=BEskNs6jf7jS24J/MnNdnr7fDrih03xNetfcCUsggemjSmpiWBC5
The link provided by Google Drive API v3: get FileID from Android content URI
Is it possible to get the document ID from this URI? I have tried base64 decode, not working.
Or any suggestion to get the ID? Maybe create a custom UI showing documents and let user select?
My application helps edit spreadsheet by user selected. Here is some code to reproduce:
// The package will use Intent in android
final result = await FilePicker.platform.pickFiles();
// Should check null
final file = result!.files.first;
// Content URI
print(file.identity);
// File name
print(file.name);