
- Share file android android#
- Share file android code#
Share file android android#
For the android:authorities attribute, you must replace the value with the package name of your Android app.
Share file android code#
In the code snippet, the values specified for the android:authorities and android:resource attributes are just examples.
In the Application Tag Attributes box, copy and paste the following code snippet. Under the Manifest Properties, click the Tags tab. Click the Native tab, and then click Android sub-tab. Open the app, and click Project Settings. To specify the FileProvider in the Manifest Based on the specifications defined in the XML file, the FileProvider generates content URIs of file objects. The XML file with sharable directories is passed to the FileProvider for generating the content URI. Specifying the FileProvider in the Manifest PropertiesįileProvider is a mechanism provided by Android to generate content URIs of the files to be shared with other apps. xml is not specified along with the file name. The name of the XML file ( filepaths.xml) that you have created with the shared directories should be specified as the value to the attribute, android:resource in the FileProvider Manifest the example, replace the with the name of the XML file. When multiple directories are shared, define the name attribute separately for each directory shared by the path element. The name attribute indicates the path segment in the generated content URI for the files located in the shared directory. NOTE: Make sure that the subdirectories that you defined in the path attribute are already created at the root directory using the kony.io.File API. Otherwise, specify the subdirectory path. If you want to share files and directories in the root directory, specify the value of the pathattribute as "/". Within the child element tags, you must specify the attribute, path to define the directory path where the sharable files are located. The root path of the directory is the same as the value returned by kony.io.FileSystem.getCacheDirectoryPath().įor more information, see Specifying Available Files. : to specify the subdirectories in the internal cache directory. The root path of the directory is the same as the value returned by kony.io.FileSystem.getExternalStorageDirectoryPath(). : to specify the directories in the external storage. The directory is the same as the value returned by kony.io.FileSystem.getDataDirectoryPath(). : to specify the subdirectories within the files/ directory in your app’s internal storage. Use any of the following child elements inside the parent element to specify the directories that contain sharable files. If you want to share multiple directories, below is a sample: Below is a sample path defined in the XML file ( filepaths.xml). You can specify multiple directories in the parent element. In the XML file, add the tag as parent element, and then add the directories of the files you want to share as child elements inside the parent element. NOTE: If your Android app is for tablet, place the file at the workspace/resources/tablet/native/android/xml subdirectory. Place the XML file at the workspace/resources/mobile/native/android/xml subdirectory in your mobile app project directory. You can specify the shared directories using an XML file. So, to share files with other apps, you must explicitly specify sharable directories in your app. To share directories or files with other apps is under your control. Kony platform does not share any directory of an app by default due to security concerns. Specifying the Sharable Directories in the XML file
Create or copy the sharable files to the shared directory.Specify the FileProvider in the Manifest Properties.Specify the sharable directories in the XML file.To share a file from your app with other apps So, you need to make your app generate content URIs of files that you want to share with other apps. Generally, in Android, file sharing from one app with another app happens in the form of content URI. Sharing Files in Android with other Apps in the Device