I realize that there isn't currently any official or module Android NFC support in Titanium, however, I was wondering if anyone who is a bit more experienced on the Android side would know about the feasibility of launch a Titanium app via intents (preset in the manifest, presumably), and then passing the "Tag" param to the app.
This would, of course, forgo the ability to read and write tags while the app is in the foreground. In my crude understanding of Android services and intents support in Titanium, it would go something like Marshall Culpepper's example from January 2011 - http://developer.appcelerator.com/blog/2011/02/launching-activities-and-using-content-uris-in-android.html.
My silly belief is that you could do something like this:
listenForNfcLauncheButton.addEventListener("click", function(e) { var intent = Ti.Android.createIntent({ action: "android.nfc.action.TAG_DISCOVERED" }); var activity = Ti.Android.currentActivity; activity.startActivityForResult(intent, function(e) { Ti.API.info("launch app.js?") } }); });...however I realize that there are some hurdles around where you would associate your tag URI/type with the intent. Thanks for wading through my ignorance on this one.
See also:
http://developer.android.com/guide/topics/nfc/index.html http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Android.Activity-object.html http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Android.Activity.startActivityForResult-method.html
2 Answers
Cameron any luck in getting this to work?
My code is work on launch app from NFC. But I still can't get data from tag. Do you have any idea?
My post & code : http://developer.appcelerator.com/question/125688/get-extra-intent-data-to-read-data-from-nfc
Your Answer
Think you can help? Login to answer this question!