首页 > 解决方案 > 来自本机反应的 Intent.ACTION_SEND

问题描述

我正在尝试通过 android 意图将 .pdf 发送到 MobiPrint。我在 Kotlin 中有一个示例,但问题是,我正在使用 React Native(在 Expo 内部)并且还不能正确翻译它。

这是 Kotlin 代码

val path: String? = _uri?.path
if(path != null) {
    val intent = Intent(Intent.ACTION_SEND)
    intent.setClassName(
        “com.mobiprintpro.retail.android“,
        “com.mobiprintpro.retail.android.ActivitySend“
    )
    intent.putExtra("companyCode", "")
    intent.putExtra(Intent.EXTRA_STREAM, _uri)
    intent.putExtra("fileUri", _uri.toString())
    intent.type = "application/pdf"
    intent.flags = Intent.FLAG_ACTIVITY_NO_HISTORY
    startActivity(intent)
}

Expo 确实有一个意图启动器:import * as IntentLauncher from 'expo-intent-launcher';,但它似乎不包括 Intent.ACTION_SEND。如果需要的话,我不反对退出世博会,但是我还没有在世博会之外找到 React Native 的解决方案。如果有人能指出我正确的方向,将不胜感激。

标签: androidreact-nativeandroid-intentexpo

解决方案


推荐阅读