title: How to use appProperties in Google Drive api v3?
body: <p>How to set the app properties of a file using Google Drive v3 in java?</p>
  
  <p>The reference says: "files.update with {'appProperties':{'key':'value'}}", but I don't understand how to apply that to my java code.</p>
  
  <p>I've tried things like</p>
  
  <pre><code>file = service.files().create(body).setFields("id").execute();
  Map&lt;String, String&gt; properties = new HashMap&lt;&gt;();
  properties.put(DEVICE_ID_KEY, deviceId);
  file.setAppProperties(properties);
  service.files().update(file.getId(), file).setFields("appProperties").execute();
  </code></pre>
  
  <p>but then I get an error that  "The resource body includes fields which are not directly writable." </p>
  
  <p>And to get the data:</p>
  
  <pre><code>File fileProperty = service.files().get(sFileId).setFields("appProperties").execute();
  </code></pre>
  
  <p>So how to set and get the properties for the file?
  Thanks! :)</p>
  
  <p><strong>Edit</strong>
  I tried</p>
  
  <pre><code>file = service.files().create(body).setFields("id").execute();
  Map&lt;String, String&gt; properties = new HashMap&lt;&gt;();
  properties.put(DEVICE_ID_KEY, deviceId);
  file.setAppProperties(properties);
  service.files().update(file.getId(), file).execute();
  </code></pre>
  
  <p>but I still get the same error message.</p>