java - Android Rename File using Google Drive REST API v3? -


how rename file using google drive rest api on android? have searched internet could, can't find how this.

i trying write sync method moves , renames cloud files if detects local copy has been moved or renamed:

void syncmetadataonly (com.google.api.services.drive.model.file cloud,                         java.io.file local) throws ioexception {      workspace.finf fileinfo = workspace.getfileinfo (this, local); // metadata object.      map<string, string> appproperties = cloud.getappproperties ();      // keep track of last rename , move in our private app properties:      long cloudlastrename = appproperties.containskey ("last-rename") ?                                     long.valueof (appproperties.get ("last-rename")) : 0;      long cloudlastmove = appproperties.containskey ("last-move") ?                                   long.valueof (appproperties.get ("last-move")) : 0;      boolean needupdate = false;      boolean needname = false;      boolean needmove = false;      if (fileinfo.lastrename > cloudlastrename) {          // file renamed locally since last sync.          needname = true;          needupdate = true;      } else fileinfo.title = cloud.getname ();      string oldrecognizedparent = null;      if (fileinfo.lastmove > cloudlastmove) {          // file moved different folder locally since last sync.          oldrecognizedparent = getfirstknownparentid (cloud); // may null, if not found.          needmove = true;          needupdate = true;      }      if (needupdate) {          cloud.setappproperties (appproperties);          drive.files.update update = mdriveservice.files ().update (fileinfo.driveresourceid, null);          if (needname) update.set /// how rename file?          if (needmove) {              if (oldrecognizedparent != null)                  update.setremoveparents (oldrecognizedparent);              update.setaddparents (fileinfo.driveparentid); // set new parent's id.          }         com.google.api.services.drive.model.file result = update.execute ();      }  }  

the closest answer have found this, have use raw http this?


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -