MainActivity: handle receiving external videos

This commit is contained in:
dece 2021-03-17 18:58:44 +01:00
parent 01d01e315b
commit a7e7cd0794
2 changed files with 12 additions and 4 deletions

View file

@ -23,6 +23,11 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="video/*" />
</intent-filter>
</activity>
<provider

View file

@ -6,10 +6,7 @@ import android.content.ContentValues
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.AsyncTask
import android.os.Build
import android.os.Bundle
import android.os.Environment
import android.os.*
import android.provider.MediaStore
import android.util.Log
import android.view.Menu
@ -53,6 +50,12 @@ class MainActivity : AppCompatActivity() {
ensureWritePermission()
}
}
if (intent.action == Intent.ACTION_SEND) {
intent.getParcelableExtra<Parcelable>(Intent.EXTRA_STREAM)?.also {
processVideo(it as Uri)
}
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {