android - 通过 Intent 在 Snapchat 中共享视频文件
问题描述
是否可以使用意图将视频文件从 Android 应用程序共享到 Snapchat?当我尝试下面的代码时,Snapchat 已打开,但没有共享视频文件的选项。
val file = File(context.cacheDir, filePath)
val uri = FileProvider.getUriForFile(context, context.applicationContext.packageName + ".share", file)
val snapchatIntent = Intent(Intent.ACTION_SEND)
snapchatIntent.setType("video/*")
snapchatIntent.putExtra(Intent.EXTRA_STREAM, uri)
snapchatIntent.component = ComponentName("com.snapchat.android", "com.snapchat.android.LandingPageActivity")
startActivity(snapchatIntent)
我像这样添加了提供者
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.share"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
和文件路径:
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<cache-path name="image" path="/"/>
<cache-path name="video" path="/"/>
<external-path name="external_files" path="."/>
</paths>
解决方案
推荐阅读
- postgresql - postgress 循环问题 wehn 循环遍历数据表
- flutter - 当设备处于纵向模式并且应用程序仅支持纵向模式时如何检测横向?
- javascript - 如何解决特定端口中的 webpack 冲突(vue.js)
- r - 无法使用 kable 和 for 循环打印表格
- javascript - 如何在 JS 中使用 if-else 条件禁用字段
- java - 检查列表中的整数是否包含在整数列表的另一个列表中的Java方法
- beagleboneblack - Beaglebone Black:无法显示 u-boot 提示
- web - URL 中的版本查询以绕过浏览器缓存
- c# - C# 中的 SOLID 原则 - 如何实现更具体的接口
- postgresql - 在同一列上创建 2 个索引