Lines Matching full:file
1 page.title=Requesting a Shared File
12 <li><a href="#SendRequest">Send a Request for the File</a></li>
13 <li><a href="#OpenFile">Access the Requested File</a>
31 When an app wants to access a file shared by another app, the requesting app (the client)
34 The user picks a file, after which the server app returns the file's content URI to the
38 This lesson shows you how a client app requests a file from a server app, receives the file's
39 content URI from the server app, and opens the file using the content URI.
42 <h2 id="SendRequest">Send a Request for the File</h2>
44 To request a file from the server app, the client app calls
53 {@link android.app.Activity} described in <a href="share-file.html#SendURI"
54 >Sharing a File</a>:
72 * When the user requests a file, send an Intent to the
82 <h2 id="OpenFile">Access the Requested File</h2>
84 The server app sends the file's content URI back to the client app in an
87 the client app has the file's content URI, it can access the file by getting its
92 File security is preserved in this process because the content URI is the only piece of data
95 the file, and only for the permissions granted by the server app. The permissions are temporary,
96 so once the client app's task stack is finished, the file is no longer accessible outside the
108 * content URI of a selected file. The result code indicates if the
119 // Get the file's content URI from the incoming Intent
122 * Try to open the file for "read" access using the
123 * returned URI. If the file isn't found, write to the
129 * to get a ParcelFileDescriptor for the file.
134 Log.e("MainActivity", "File not found.");
137 // Get a regular file descriptor for the file
145 returns a {@link android.os.ParcelFileDescriptor} for the file. From this object, the client
146 app gets a {@link java.io.FileDescriptor} object, which it can then use to read the file.