Ask about NFC

  • Replies:1
Conrad Chan
  • Forum posts: 2

Jul 5, 2012, 3:37:30 AM via Website

Hi everyone, I am a beginner of developing android apps. Currently I am working on a project of developing an android app which can make use of the NFC technology. My need will open the user interface and retrieve the information from the NFC tag when it senses the tag, So here are the questions I would like to ask, please kindly give me some suggestions if you can, thank you.
1, If I want to set my app to be the default app to handle the NFC tag, how can I do so? Should I use AAR, but it can only be used for those newer android version.
2, As I mentioned, my app will open the user interface for user to choose an operation after it senses the tag, so I would like to ask, when should my app start its first activity, whether it should start it when the device starts then just call on Resume when it senses the tag or it should start when it senses the tag and destroy when finishes every single operation?
3, How can I send the data to the backend server in the html format, such that the PHP file is able to handle it?
Maybe some people may find my questions quite easy, please accept my apology, as I am really not familiar of android development.

Reply
Jeremiah
  • Forum posts: 775

Jul 5, 2012, 5:09:50 AM via Website

For question 1:

I think you need to use an Intent receiver which will send an intent to your app when an NFC tag is discovered by the hardware: see http://developer.android.com/guide/topics/connectivity/nfc/nfc.html#filtering-intents

2:
You can call whichever activity you need to handle the NFC information from the broadcast reciever you setup to receive the intent.

3.
You could do this with simple Http post and get, or the more complex way would to be use json. If you use JSON I would recommend GSON https://sites.google.com/site/gson/gson-user-guide
Here is a tutorial if you just want to use a simple http post: http://pcfandroid.wordpress.com/2011/07/14/http-post-with-asynctask-android-tutorial/

Reply