Skip to content

Instantly share code, notes, and snippets.

View uc-sja's full-sized avatar
🏠
Working from home

Shikhar Jaiswal uc-sja

🏠
Working from home
View GitHub Profile
@uc-sja
uc-sja / Handling Requested File
Created July 12, 2022 04:52
filerequesthandler
/*
* When the Activity of the app that hosts files sets a result and calls
* finish(), this method is invoked. The returned Intent contains the
* content URI of a selected file. The result code indicates if the
* selection worked or not.
*/
public override fun onActivityResult(requestCode: Int, resultCode: Int, returnIntent: Intent) {
// If the selection didn't work
if (resultCode != Activity.RESULT_OK) {
// Exit without doing anything else
@uc-sja
uc-sja / ServerManifest
Created July 12, 2022 03:31
Androidmanifest of server app
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
...
<application>
...
<activity
android:name=".FileSelectActivity"
android:label="@File Selector" >
<intent-filter>
<action
android:name="android.intent.action.PICK"/>
@uc-sja
uc-sja / filepath
Last active June 30, 2022 03:15
Fileprovider
<?xml version="1.0" encoding="utf-8"?>
<paths>
// Represents files in the files/ subdirectory of your app's internal storage area.
// This subdirectory is the same as the value returned by Context.getFilesDir().
//file path will be storage/data/user/0/Android/data/{your app package}/files/.../
<files-path name="name" path="path" />
//Represents files in the root of the external storage area.