can NFC tags readers, especially on Android, open a webpage stored on the tag after being scanned?
I don't want to store a URL, I want to store a webpage in plain text and have that render after it is scanned. Is this supported?
<html><body>No signal? Bookmark this page!<img src="http://bit.ly/example"/>Test Image</img></body></html>
The above example is only 106 bytes, so can fit on most NFC tags, would this open in a webpage or can there be certain instructions to render it as a webpage?
If you set the MIME type of the tag to text/html, it is possible that this will be rendered in browsers set up to read NFC tags containing that MIME type. Whether there are any such browsers, I cannot say. The AOSP Browser app does not support this -- the only NFC tags it supports are ones with http or https schemes for URLs, based on the current contents of its manifest.
Yes you can store a web page on an NFC tag - in fact you could store anything. That does not mean that it is a good idea. If you do not decide on the tags to be used, html is a bad idea. Rather store an URL and get the data online. Or store the data in a more compact format.
EDITED ADDITIONAL INFO:
The Android Developer site at this link:
https://developer.android.com/guide/topics/connectivity/nfc/nfc
contains a wealth of information which, upon reading, explains why this particular approach is challenging, but also inspires a while heap of other alternative ideas, methods, ways and means... I strongly recommend checking it out!!!
********** End Of Edit ************
ORIGINAL ANSWER:
I have experimented with the very same, and created a custom NDEF message of MIME type text/html, with a fully coded HTML document as text in the data field of said MIME type ( & all standard tags such as & & so on). I have not had any luck with having the page rendered in a browser window. Usually, on scanning the NFC chip, it just returns a new-tag response showing my MIME "text/html" prefix, and completely omits the display of even the associated HTML encoding!
It's very frustrating..
However - in going to try again, as I understand that a recent release of Chrome Browser has a flag for experimental NFC features that can be activated.
In the Chrome Browser, navigate to chrome://chrome-urls and choose the flags link (or just go straight to chrome://flags ), then in the search bar type NFC. When the two or so options are presented, change the flags from default to enabled.
Now, I know that this then allows websites to interact with data on NFC tags, and allows you to script the content fields as variables, etc etc etc, but I DON'T know if it will solve our "render MIME type text/html record as web page directly" problem.
I will test it out and let you know...
I had a similar thought to you and was investigating this idea. However android by default do not have an app that can recognize such tag by default... not even android chrome.
But what I did end up doing to explore this was to create an NFC tag project that can generate a tag with a mime record of text/html or text/html+gzip (FYI: text/html+gzip technically is not an officially registered mime record type, however I think it still keeps to the normal semantic of other mime record that combines a format + compression). It's located at https://github.com/mofosyne/js-ndef-html-tag to generate a tag.
As for viewing it, I've created an experimental android app where I have also placed an intent hook for both text/html or text/html+gzip so that any NFC tag with such content will automatically open up https://github.com/mofosyne/NFCMessageBoard and display the tag's html content.
However ideally you would push android to add native support for viewing html tags directly.
Until then, the official answer is no you cannot.
Related
Alright, let me explain my dilemma:
So I figured out a way to write PNG data to my NFC card using an app called "NFC Tools" (package name is com.wakdev.wdnfc) and Termux. I used Termux to copy the raw PNG data to my clipboard, then pasted it in the app, and set the data type to image/png. (Note the image size is a mere 265 bytes, being a 1-bit colormap at a resolution of 64x64, while the card can carry up to 1KB.) It wrote to the card without issue, but when I tried to read it, I got moved to a window named "New tag collected", and below it read "image/png". Now, I believe it has something to do with the Nfc Service itself, probably a lack of an implementation. I can understand why they'd leave it out, I mean, come on - who's going to be doing this regularly? Anyhow, I would really appreciate help with this, thank you in advance!
So Android's NFC service looks for an App that has registered to receive this type of mime Type from NFC (Lots of the more NFC Forum standard ones are handled by the web browser, system settings App, email client, etc) but putting an image on a NFC is very rare, so the system NFC App has a fallback popup message that just describes the card in text format the best it can.
You can write your own app and register the "image/png" and it should start that. See the docs on how to do that.
I am developing an Android Bot application which will take input from the user, check for a matching string in the AIML file and give corresponding output.
I know Android programming and also I have AIML files ready. The only problem I am facing is to fetch the output from the AIML files.
I have gone through some answers but I could not figure out a solution. I would be happy if you could explain it in detail.
I am using Android Studio for the development.
I used this tutorial to help me get started with my basic application that accepts my input, scans for the AIML files, and gives corresponding response.
The only issue with this tutorial is that it will just accept your input, scan the AIML file and search for matching text in the <pattern> tag and respond with whatever is present in the corresponding <template> tag.
If you have <oob> tags in your AIML files which perform special tasks like opening applications, searching on internet etc., you will have to write your own code which will do following tasks:
Scan the bot's response for presence of <oob> tag.
Remove the <oob> tag and contents between <oob> and <\oob> tags.
Perform whatever task is mentioned in those tags.
After several searches online, I couldn't find a place that could tell me every existent MIME type for different types of media in Android applications.
Here are the ones I know that exist and work:
For Text
"text/plain"
For Image
"image/jpeg"
"image/bmp"
"image/gif"
"image/jpg"
"image/png"
For Video
"video/wav"
"video/mp4"
These are the ones I have and know that work, I am lacking several for video and sound type files. Does anyone know a place where every Android MIME type is described or have you guys ever used another MIME type for these different types of media?
EDIT:
I am using this in an application that monitors SMS and MMS, and in the MMS, the type manages the content inside it. The code I have runs for every version above 8.
I did some search these days.
maybe you shoud read these links.
MediaStore supported MIME type is here: http://androidxref.com/4.4.4_r1/xref/frameworks/base/media/java/android/media/MediaFile.java#174
And there is also a API URLConnection.getFileNameMap()
And its inner side is here: http://androidxref.com/4.4.4_r1/xref/libcore/luni/src/main/java/libcore/net/MimeUtils.java
I couldn't find a place that could tell me every existent mime type for different types of media in android applications
There are over a million applications on the Play Store, plus others elsewhere (e.g., pre-installed on devices, Amazon AppStore for Android). A given device will have some combination of these apps. A given user will have access to some subset of the apps on the device, if the user is running in an Android 4.3+ restricted profile on a tablet.
Hence, there is no way to know, at compile time, what MIME types a given Android device can support for things like ACTION_VIEW activity requests. The OS itself supports no such MIME types -- they are all provided by applications.
Here are the ones I know that exist and work:
Some devices may have apps pre-installed that support those MIME types. text/plain is the least likely of your set to be supported "out of the box".
You can use existing mapping in Android (java version)
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(ext.toLowerCase());
I know I'm late to the party, but I found a full list of mime types here:
https://android.googlesource.com/platform/external/mime-support/+/9817b71a54a2ee8b691c1dfa937c0f9b16b3473c/mime.types
Which MIME types does Android support out of the box?
Since that's your immediate question, let's answer that first (though it's not exactly the right question for your MMS usecase).
To know the MIME types supported by Android itself (not considering additional apps), you can use this process:
Consult the list Supported media formats from the official Android documentation.
For each media format and each of its possible container formats, find the associated MIME types from the official IANA Media Types list.
Since there are some unregistered MIME types in use in practice, including by Android, additionally consult the list of MIME types known to the Android platform to convert the supported media formats. For example, the Matroska video container format (.mkv files) appears only in that list, not in the IANA list.
Which MIME types might you encounter in MMS?
tell me every existent mime type for different types of media in android applications. […] I am using this in an application that monitors SMS and MMS and in the MMS type manages the content inside it.
For your case, the MMS standard will tell you what MIME types can be used for its content. And it seems that, like e-mail, MMS does not restrict what MIME types its content can be. For example, one supplier of MMS solutions tells that it will simply pass content with unknown MIME types to the network carrier:
If the format is not listed below that means it still gets accepted on the API, but […] it may get delivered to the carrier or may not depending on the size of the content. (source)
Since applications can define their own MIME types, including types starting with prs. and x. that cannot be registered at IANA, you cannot know beforehand which MIME types you will encounter.
So for practical purposes, it is the safest approach if your application can deal with all MIME types supported by the Android platform by default – see above for the list. And then handle everything else (added by apps) in a generic manner.
As the title says - is there something in iOS that lets you say 'this file is allowed to be accessed by other apps' - preferably only readable, but read/write would be good enough.
Basically I am trying to place a file outside the sandbox so other apps can read it - preferably via the openURL that points to a local file rather than an http address.
Thanks
Edit:
I just received an answer from Apple Tech support and they told me that this is currently impossible (just after iOS 6 released)
I don't think it's possible to do it the way you describe. Last I checked, apps can only write inside their sandbox dir and cannot read inside other apps' sandboxes (though IIRC there used to be a few other writable directories).
What, exactly, is the end result you are trying to achieve?
If you know the app you want to read the data, you can use a custom URL scheme.
If you have a file of a certain type (extension/content-type, I think), you can use UIDocumentInteractionController to let the user pick an app to open it in.
If you just want to share some data with any app, the closest I can think of is a custom UIPasteboard. OpenUDID does this for a slightly dubious purpose.
I have just start reading and writing nfc tags using google nexus one . I have gone through several site like this. They have mostly given for a single string writing. Is that possible to write more data . For example in my case i have to write person id , place and timings .Is there any example like this ? Thanks in advance
You can put whatever information you want - there are no limits for that. The only limitation is a space available on particular tag type which is different for different tag types. For the tag compatibility check the documentation, e.g. Nokia supports all NFC forun tags 1-4 + Mifare classic, while Nexus S might have some limitations here (http://developer.android.com/sdk/android-2.3.3.html).
You are free to use whatever data format you like to save on the NFC tag - but there are certain standards pushed by NFC Forum - just search internet for for NDEF/RTD terms.
The most widely used NFC tag is currently MIFARE Ultralight, but Broadcom BCM20203 NFC Tag might be option as well, but I am not sure if it is distributed or not.
BR
STeN
www.mautilus.com
I have created an Eclipse plugin for creating NDEF types of NFC payloads you might be interested in.
Also see the NDEF Tools for Java project for an Android boilerplate project for detecting, reading and writing NFC tags.