在 Flutter 应用中支持自定义文件扩展名(在 Flutter 中打开扩展名为 .abc 的文件) [英] Support custom file extension in a flutter app ( Open file with extension .abc in flutter )

查看:21
本文介绍了在 Flutter 应用中支持自定义文件扩展名(在 Flutter 中打开扩展名为 .abc 的文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我要导出在我的应用程序中创建的文件,扩展名为 .abc

So I am exporting a file created in my application with extension .abc

现在,如果用户在 whatsapp 或电报或任何其他平台上共享文件,并且当其他用户尝试打开文件时,打开方式"对话框应该会出现,我的应用程序会出现在列表中.

Now, if the user shares the file on whatsapp or telegram or any other platform and when other user tries to open the file, the "open with" dialog should appear with my application in the list.

我尝试了以下方法,但它不起作用,而且它仅适用于 Android,我正在寻找多平台解决方案.

I have tried following approach which does not work plus it is only for Android and I am looking for multi-platform solution to this.

是否可以将 Flutter 应用注册为 Android Intent Filter 并处理 Incoming Intents?

我能够使用上述方法编译应用程序,但无法使用我的应用程序名称填充打开方式"对话框

I was able to compile the app using above method but could not populate "Open with" dialog with my app's name

感谢您的宝贵时间.

编辑 1:

所以我已经成功地为 android 添加了此功能,但我仍在尝试为我的 iPhone 用户添加相同的功能.

So I have successfully added this functionality for android but I am still trying to add the same functionality for my iPhone users.

有人可以帮我处理 iOS 中的 swift 代码部分吗?我不熟悉 swift 语言,但我希望我的用户能够在两个平台上使用相同的功能.

Can someone please help me with swift code part in iOS ?? I am not familiar with swift language but I want my users to be able to use same functionality on both platforms.

推荐答案

我找到了iOS的解决方案:

I have found a solution for iOS:

您可以使用 Uni Links 包将通知发送到您的 Flutter 应用程序中.然后,您需要在 XCode 项目的 Info.plist 中手动添加文件类型.您可以在 这里找到解释.

You can use the Uni Links package to get the notifications into your Flutter app. You then need to manually add the file types in the Info.plist for the XCode project. You can find an explanation for example here.

这篇关于在 Flutter 应用中支持自定义文件扩展名(在 Flutter 中打开扩展名为 .abc 的文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆