我可以使用未安装相同应用程序的NFC Android Beam编写将文件(可以是图像文件)发送到另一台设备的应用程序吗? [英] Can i write an app which sends file (can be an image file) to another device using NFC Android Beam that does't has the same app installed?

查看:125
本文介绍了我可以使用未安装相同应用程序的NFC Android Beam编写将文件(可以是图像文件)发送到另一台设备的应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过NFC Android Beam使用以下API发送文件

I can send file using below API via NFC Android Beam

mNfcAdapter.setBeamPushUrisCallback()

另一台设备还应该具有相同的应用程序来接收文件吗?
如果是,则发送此文件将不支持其他平台(例如Blackberry),即使它们是支持NFC的设备.请指教.

Do the other device should also have the same app to receive the file?
If Yes then sending this file would not support for other platform like Blackberry even though they are NFC capable device. Please advice.

推荐答案

文件传输实现不需要接收设备具有您的应用程序.如果您发送类似图片的内容,则当用户单击竞争通知(如果已安装)可以启动关联的应用程序时,将播放一个哑剧类型.

The file transfer implementation does not require the receiving device to have your application. If you send something like a picture, a mime-type will be broadcast when the user clicks the competition notification that 'can' launch an associated application if any are installed.

值得注意的是,您不能通过android Beam文件传输强制使用mime类型,因此您不能保证您的应用程序将是等待接收特定文件类型的唯一应用程序.我还想指出,根据我的经验,尝试发送不带扩展名的文件似乎是行不通的.在没有扩展名的情况下,Beam会尝试但不会连接进行发送.

It is worth noting that you can not force the mime type with android beam file transfers so you can not guarantee that your application will be the only one waiting to receive a specific file type. I would also like to note that in my experience it seems that attempting to send files without an extension will not work. Beam will attempt but never connect for sending in the case of no extension.

如果您在开发指南中检查了文件发送要求,您会发现不需要在两个设备上都安装应用程序.

If you check the file sending requirements in the dev guide you will see that having the application installed on both devices is not a requirement.

  • 用于大型文件的Android Beam文件传输仅在Android 4.1(API级别16)及更高版本中可用.
  • 要传输的文件必须位于外部存储中.要了解有关使用外部存储设备的更多信息,请阅读使用外部存储设备.
  • 您要传输的每个文件必须是世界可读的.您可以通过调用File.setReadable(true,false)方法来设置此权限.
  • 您必须为要传输的文件提供文件URI. Android Beam文件传输无法处理FileProvider.getUriForFile生成的内容URI.

发送文件参考: https://developer.android.com/training/beam-files/send -files.html

接收文件参考: https://developer.android.com/training/beam-files/receive -files.html

这篇关于我可以使用未安装相同应用程序的NFC Android Beam编写将文件(可以是图像文件)发送到另一台设备的应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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