相关疑难解决方法(0)

找不到具有授权者的元数据

我已经在我的Android应用程序中集成了Snapchat的Creative Kit。处理之后,我从服务器收到了字节数组形式的图像,将其保存到磁盘,然后将文件发送到Snapchat的Creative Kit,如下所示。

 private fun downloadImage(
    fileName: String,
    imageByteArray: ByteArray?): Uri? {
    val state = Environment.getExternalStorageState()

    if (Environment.MEDIA_MOUNTED == state) {
        val downloadDir = File(
            Environment.getExternalStorageDirectory(), context?.getString(R.string.app_name)
        )

        if (!downloadDir.isDirectory) {
            downloadDir.mkdirs()
        }

        val file = File(downloadDir, fileName)
        var ostream: FileOutputStream? = null
        try {
            ostream = FileOutputStream(file)
            ostream.write(imageByteArray)
            ostream.flush()
            ostream.close()
            }
        } catch (e: IOException) {
            e.printStackTrace()
        }

    val snapCreativeKitApi = SnapCreative.getApi(context!!)
    val snapMediaFactory = SnapCreative.getMediaFactory(context!!)
    lateinit var snapPhotoFile: SnapPhotoFile
    try {
        snapPhotoFile = snapMediaFactory.getSnapPhotoFromFile(file)
    } catch (e: SnapMediaSizeException) …
Run Code Online (Sandbox Code Playgroud)

android android-fileprovider snapchat

5
推荐指数
6
解决办法
4140
查看次数

标签 统计

android ×1

android-fileprovider ×1

snapchat ×1