1 <h2 id="usage">Usage</h2> 2 3 <p> 4 Using the API, you can prompt the user for permission to access the media 5 galleries. The permission dialog will contain common media locations for 6 the platform and will allow the user to add additional locations. From those 7 locations, only media files will be present in the file system objects. 8 </p> 9 10 <h2 id="manifest">Manifest</h2> 11 <p>The media galleries API has two axes of permission parameters; the locations 12 that can be accessed, and the types of access (read-only, copy-to, etc).</p> 13 14 <p>On the location axis, specifying no location-type permission parameters 15 means that 16 no media galleries are accessible until the user grants permission to 17 specific media galleries at runtime using the media gallery configuration 18 dialog. This dialog can be programmatically triggered. Alternatively, 19 specifying the "allAutoDetected" permission parameter grants access to all 20 auto-detected media galleries on the user's computer. However, this 21 permission displays an install time prompt indicating that the app 22 will have access to all of the user's media files.</p> 23 24 <p>On the access type axis, the "read" permission parameter grants the 25 app the right to read files. This permission does not trigger an install 26 time permission prompt because the user must still grant access to particular 27 galleries, either with the "allAutoDetected" permission parameter or at 28 runtime by using the media gallery management dialog. For example:</p> 29 30 <pre>{ 31 "name": "My app", 32 ... 33 "permissions": [ 34 <b>{ "mediaGalleries": ["read", "allAutoDetected"] }</b> 35 ], 36 ... 37 }</pre> 38 39 <p>The above permission will trigger an install time permission prompt 40 and let the app read from all auto-detected media galleries on the 41 user's computer. The user may add or remove galleries using the 42 media gallery management dialog, after which the app will be able 43 to read all the media files from galleries that the user has selected.</p> 44 45 <p>Another possible access type is "copyTo". Specifying only "copyTo" on the 46 access type axis will permit using accessible media galleries as a destination 47 for copyTo() operations. "copyTo" and "read" can both be specified to obtain 48 both types of permissions to accessible media galleries.</p> 49