diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 8e4fc32..7d60a9f 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -31,6 +31,7 @@ + = context.packageManager.queryIntentActivities(chooserIntent, PackageManager.MATCH_DEFAULT_ONLY) for (resolveInfo in resInfoList) { val packageName: String = resolveInfo.activityInfo.packageName @@ -111,4 +113,22 @@ class Share { result.success(true) } } +} + +class ShareReceiver : BroadcastReceiver() { + override fun onReceive(context: Context?, intent: Intent?) { + if (intent == null) { + return + } + + val res = intent.extras.get(Intent.EXTRA_CHOSEN_COMPONENT) as? ComponentName ?: return + when (res.className) { + "org.chromium.arc.intent_helper.SendTextToClipboardActivity" -> { + val file = intent.extras[Intent.EXTRA_TEXT] as? File ?: return + val clipboard = context?.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager + + clipboard.primaryClip = ClipData.newPlainText("", file.readText()) + } + } + } } \ No newline at end of file