Just starting out? Need help? Post your questions and find answers here.
ehbarba
 
Posts: 24
Joined: Thu Mar 29, 2018 2:20 am

Need help to use UseGoogleDrive() function

by ehbarba Sat May 05, 2018 9:35 pm

Hi everyone

I will appreciate some help to use UseGoogleDrive() function, I can't make it work, nor the GoogleDriveEditor sample, nor with my own Ids...

Is UseGoogleDrive() working at all?

Greetings

Ezequiel
falsam
 
Posts: 258
Joined: Mon May 05, 2014 9:49 pm
Location: France

Re: Need help to use UseGoogleDrive() function

by falsam Sat May 05, 2018 11:33 pm

I don't use this feature but I did run a test ;)

1 - Go to the Google API Console. https://console.developers.google.com/
2 - Create (or select) a project. Example : My Google Drive
3 - In the displayed list of available APIs, click the link for the Drive API and click Enable API.
4 - When ready ...
5 - Click Credential link
6 - Create an ID clients OAuth 2.0
7 - Create an API Key with HTTP referent website

My test only allows you to view files linked to your account IDs.

The indicator does not work if the debug option is enabled. (Weird behavior)
Code: Select all
; 1 - Go to the Google API Console. https://console.developers.google.com/
; 2 - Create (or select) a project. Example : My Google Drive
; 3 - In the displayed list of available APIs, click the link for the Drive API and click Enable API.
; 4 - When ready ...
; 5 - Click Credential link
; 6 - Create an ID clients OAuth 2.0 
; 7 - Create an API Key with HTTP referent website

Global GoogleFileID$

Procedure GoogleDriveReady()
  SetGadgetText(0, "Google drive is ready")
  DisableGadget(1, #False) 
EndProcedure

Procedure RequesterSuccess() 
  While NextSelectedFile()
    GoogleFileID$ = SelectedFileID()
    ;Your code
  Wend
EndProcedure

Procedure ButtonEvent()
  OpenFileRequester("", @RequesterSuccess(), #PB_Requester_GoogleDrive)
EndProcedure

;My google id : 938941994242-v7en6e0kuokmmir09edalkorkeqjm3ke.apps.googleusercontent.com (Remove .apps.googleusercontent.com)
Define ClientID.s = "938941994242-v7en6e0kuokmmir09edalkorkeqjm3ke"
Define APIKey.s   = "AIzaSyCj-rxh8PQdHIyTzPl8hzuQ_nwxT32nsis"

UseGoogleDrive(ClientID, APIKey, @GoogleDriveReady())

If OpenWindow(0, 10, 10, 400, 100, "Google Drive")
  ButtonGadget(1, 10, 10, 170, 25, "Open file...")
  DisableGadget(1, #True)
  TextGadget(0, 10, 70, 380, 22, "")
  BindGadgetEvent(1, @ButtonEvent())
EndIf

:arrow: Demo : http://falsam.com/sbtest/drive.html

➽ Windows 10 - JDK 1.8 - SB 2.20 - Android 5.5
http://falsam.com

Sorry for my poor english
ehbarba
 
Posts: 24
Joined: Thu Mar 29, 2018 2:20 am

Re: Need help to use UseGoogleDrive() function

by ehbarba Sun May 06, 2018 3:15 am

Hi falsam

Thank you very much for taking the time to respond to this post.

I tried your demo (previously disabling the debugging option) but the google window shows the same error again. What could be happening?

Image
Return to Coding Questions

Who is online

Users browsing this forum: No registered users and 3 guests