Android Question Download a Text File from Google Driver

khwarizmi

Active Member
Licensed User
Longtime User
Hi all

How can I download and read a text file uploaded in google driver?
I tried this code from this link, but I got the download page not the file itself:
B4X:
Dim j As HttpJob
    j.Initialize("", Me)
    j.Download("https://drive.google.com/file/d/1xANSUqJwM0gFTnWrVz3qYsEPiR36ZJ_7/view?usp=sharing")
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Dim out As OutputStream = File.OpenOutput(File.DirInternal, "menu.txt", False)
        File.Copy2(j.GetInputStream, out)
        out.Close
        Dim List1 As List
        List1 = File.ReadList(File.DirInternal,"menu.txt")
For i=0 To List1.Size-1
    Log(List1.Get(i))
Next
    End If
    j.Release
 

AnandGupta

Expert
Licensed User
Longtime User
Use direct download link for the file,
B4X:
https://drive.google.com/uc?export=download&id=1xANSUqJwM0gFTnWrVz3qYsEPiR36ZJ_7
 
Upvote 0

khwarizmi

Active Member
Licensed User
Longtime User
Thanks :)
Where to get the direct download link ?
 
Upvote 0
Top