[android-developers] read nfc card in the different activity

2011-11-01 Thread xiaoailsa
Hi,all!
I hava a problem with phone read and write  NFC card . Read
different card ,i must ues different acitivity.But i want to a
acitivity can read different card .What can i do??
   The more serious is:  Read the same card , i need insert card in
the different activaty repeatedly .I wanted to keep the data inside
card, when jump to another activity, i don't need to insert card.
Part of my program:

1. When read and write Mifare Ultralight card ,i use these ;
mTechLists = new String[][] { new String[]
{ MifareUltralight.class.getName()} };
...
Tag tagFromIntent =
intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
MifareUltralight tag=MifareUltralight.get(tagFromIntent);

2. When read ndef message,i use Ndef api ,like these:
mTechLists = new String[][]{new String[]{Ndef.class.getName()}};

Tag tagFromIntent =
intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
Ndef tag = Ndef.get(tagFromIntent);

Thanks your answers!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] How to display NDEF message ?

2011-10-21 Thread xiaoailsa
Hi:
I want to write ndef message in the mifare ultralight card , and
communicate with NFC phone. For example:first i write http://
www.google.com in to the card, than the phone contact with the card ,
the application will desplay http://www.google.comand open the
internet.
   Now, i can write the ndef message into the mifare ultralight
card,but i don't know how to display ndef message on the phone.
some code:
NdefMessage mess=tag.getNdefMessage();
byte[] t1=mess.toByteArray();
String b1=Hex.byteArrayToHex(t1);
response.setText(b1);  

b1 message is: (byte) 0xd1, (byte) 0x02, (byte) 0x0f, (byte) 0x53,
(byte) 0x70, (byte) 0xd1, (byte) 0x01, (byte) 0x0b, (byte) 0x55,
(byte) 0x01, (byte) 0x67, (byte) 0x6f, (byte) 0x6f, (byte) 0x67,
(byte) 0x6c, (byte) 0x65, (byte) 0x2e, (byte) 0x63, (byte) 0x6f,
(byte) 0x6d.How do i convert it to http://www.google.com;??



Thank you !

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] With P2P mode, what can i do?

2011-10-12 Thread xiaoailsa
We have known that  Phone and Reader can transfer data in the P2P
mode .But i have a problem with it:
In the P2P mode, whether to support the mobile phones and card reader
transfer files, pictures, audio and other formats? How to do it? Can
someboby tell me?
Thank you with your answers!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: NFC phone operated Mifare Classic

2011-09-21 Thread xiaoailsa
Hi,have anyone know how to increment \decrement\restore in the mifare
classic??
I'm very worry about this program.Could you help me ?


On 9月20日, 下午2时03分, xiaoailsa zsbitxiao...@163.com wrote:
 Hi,everyone!
 I have learn nfc phone how to read different card. For the Mifare
 Classic, i have a problem for value block.
 For the MifareClassic api , i can read and write with nfc phone. But i
 can't decrement,increment,restore, transfer.
 The api is :decrement(int blockIndex, int value) Decrement a value
 block, storing the result in the temporary block on the tag. How
 should I do in the program?
 I know value block have a fixed data format in the specification.Had
 the api take blockindex converted into value block automatically??Who
 can provide a code for my reference?

 Thank 's your help!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] NFC phone operated Mifare Classic

2011-09-20 Thread xiaoailsa
Hi,everyone!
I have learn nfc phone how to read different card. For the Mifare
Classic, i have a problem for value block.
For the MifareClassic api , i can read and write with nfc phone. But i
can't decrement,increment,restore, transfer.
The api is :decrement(int blockIndex, int value) Decrement a value
block, storing the result in the temporary block on the tag. How
should I do in the program?
I know value block have a fixed data format in the specification.Had
the api take blockindex converted into value block automatically??Who
can provide a code for my reference?

Thank 's your help!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Read NfcA card

2011-09-14 Thread xiaoailsa
Hi,Michael!Thanks your hints!

I have try read smart card,this is my program:

Tag tagFromIntent = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
IsoDep tag = IsoDep.get(tagFromIntent);
try{
tag.connect();
tag.setTimeout(20);
byte[] commandAPDU= new byte[]{
(byte)0x00, (byte)0xA4, (byte)0x04, (byte)0x00, (byte)7,
(byte)0xAB, (byte)0xE5, (byte)0xBC, (byte)0x08, (byte)0x85,
(byte)0x01, (byte)0x00};
byte[] responseAPDU = tag.transceive(commandAPDU);
String m1=Hex.byteArrayToHex(responseAPDU);
mText.setText(m1);


But the result is wrong. It is :6A82. IS it meaning the file can't
found?
As a response i get 9000 if the applet was right. I can't find the
problem.


The command APDU come from Type 4 Tag Operation Technical
Specification. It says :
select:00 A4 04 00 07h D2768501000h
   00 A4 04 00 02h E103h
ReadBinary :00 B0 00 07
Update write:00h D6h Offset Length Lc  Data to be written in the NDEF
file

Have some wrongs in this commands ? What should I change my program?
Where the command APDU come from?

Thanks your any hints!

On 9月10日, 下午2时27分, Michael Roland mi.rol...@gmail.com wrote:
 Hallo,

  I  need to read and write ISO 14443-4 smart card .

 In this case you won't need NfcA at all. You only need theIsoDepclass.
 In general you shouldn't care whether yourIsoDepcard uses NfcA or NfcB
 as low-level technology.

  I had used
  mTechLists = new String[][] { new String[]
  { NfcA.class.getName() } }
  NfcA tag=NfcA.get(tagFromIntent).How to useIsoDep?

 Just replace NfcA withIsoDep.

  Next, What I should do? Can give me some hints?

 You can then connect to theIsoDepobject:
 tag.connect();

 Then you can transmit ISO 7816-4 APDU commands with the transceive() method:

 byte[] responseAPDU = tag.transceive(commandAPDU);

 br,
 Michael

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Read NfcA card

2011-09-09 Thread xiaoailsa
Hello,everyboby!
I  hava learn how to read nfc card.When i read the typeA
card ,i have some problem.
In the protcet, i ues these:
Tag tagFromIntent =
intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
 NfcA tag=NfcA.get(tagFromIntent);
   and i can get the ATQA,SAK,but i don't know how to use
transceive(byte[] data),and how i can read the card??
If you know that, please give me some tips and help, please?
Thank you very much!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Read NfcA card

2011-09-09 Thread xiaoailsa
Hi,Michael!Thanks your answer.
I  need to read and write ISO 14443-4 smart card .I had used
mTechLists = new String[][] { new String[]
{ NfcA.class.getName() } }
NfcA tag=NfcA.get(tagFromIntent).How to use IsoDep? The problem with
me for a long time.
Next, What I should do? Can give me some hints?
Thank you very much!




On 9月9日, 下午3时18分, Michael Roland mi.rol...@gmail.com wrote:
 Hallo,

   NfcA tag=NfcA.get(tagFromIntent);
 and i can get the ATQA,SAK,but i don't know how to use
  transceive(byte[] data),and how i canreadthe card??

 There is no simple answer to that question. FIrst you need to know
 what card/tag technology you have. (E.g. Topaz/Jewel, MIFARE
 Ultralight, MIFARE CLassic, MIFARE DESfire, ISO 14443-4
 smartcard, ...) If you are not sure about what technology your card
 is, usually, you should be able to derive this information from the
 ATQA/SAK values.

 br,
 Michael

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Nfc phone read the type A card.

2011-09-08 Thread xiaoailsa

I want to use two classes:IsoDep and NfcA .But how to use at
thesametime?
         →mTechLists = new String[][] { new String[]
 {IsoDep.class.getName()} };
           //mTechLists = new String[][] { new String[]
 {NfcA.class.getName()} };
         →public void onResume() {
             super.onResume();
              mAdapter.enableForegroundDispatch(this,
mPendingIntent,mFilters, mTechLists);}
   
Could someboby help me??Thank you!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] How to read two types card at the same time?

2011-09-07 Thread xiaoailsa
Hi,everyone!
I have a problem in read card for the android 2.3.4 phone. Who can
help me ?Thank you very much !

   The using the foreground dispatch system say: set up an array of
tag technologies that your application wants to handle. Call the
Object.class.getName() method to obtain the class of the technology
that you want to support:
techListsArray = new String[][] { new String[]
{ NfcF.class.getName() } };

I need to read two types card at the same time, how do ?
techListsArray = new String[][] { new String[]
{ NfcA.class.getName() } };
   //  techListsArray = new String[][] { new String[]
{ IsoDep.class.getName() } };


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Nfc phone read the type A card.

2011-09-06 Thread xiaoailsa
Hi all:
 I have some questions about read the card(type A).I hope someone
can communicate with me and help me.Thank you very much.
Q1: I want to use two classes:IsoDep and NfcA to read a type A
card.But how to use at the same time?
→mTechLists = new String[][] { new String[]
{IsoDep.class.getName()} };
   //mTechLists = new String[][] { new String[]
{NfcA.class.getName()} };
→public void onResume() {
 super.onResume();
 mAdapter.enableForegroundDispatch(this, mPendingIntent,
mFilters, mTechLists);}
Q2: In the IsoDep class, transceive (byte[ ] data) means send
raw IsoDep data to the tag and receive the response. How to send data?
Q3:  →public byte[] getHistoricalBytes ()
 The historical bytes can be used to help identify a tag. They
are present only on IsoDep tags that are based on NfcA RF technology.
If this tag is not NfcA then null is returned.
 What 's the meaning?

  Thank you !

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: how to learn Andoird

2011-09-06 Thread xiaoailsa
Book is your best teacher . Write some codes by youself.

On 9月6日, 下午3时52分, felix guofuchu...@gmail.com wrote:
 i am a newbie. i want to learn andoird. who can share some experience.
 thanks.
 Are there any good books and videos?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Nfc phone read the type A card.

2011-09-06 Thread xiaoailsa
Yes.Because i want to read and write typeA card.
The NfcA have deal with ATQA and SAK; and the IsoDep have deal with
setTimeout and so on.
But i don't know how they transceive (data),then can read the card
success.



On 9月6日, 下午3时52分, xie calvin xiecal...@gmail.com wrote:
 I guss that you Android NFC does not allow use 2 nfc tech to connect a
 tag at  the same time.  Why do you use them like so?  what is the user
 scenario?

 2011/9/6 xiaoailsa zsbitxiao...@163.com:





  Hi all:
  I have some questions aboutreadthecard(type A).I hope someone
  can communicate with me and help me.Thank you very much.
 Q1: I want to use two classes:IsoDep and NfcA toreada type A
 card.But how to use at the same time?
 →mTechLists = new String[][] { new String[]
  {IsoDep.class.getName()} };
//mTechLists = new String[][] { new String[]
  {NfcA.class.getName()} };
 →public void onResume() {
  super.onResume();
  mAdapter.enableForegroundDispatch(this, mPendingIntent,
  mFilters, mTechLists);}
 Q2: In the IsoDep class, transceive (byte[ ] data) means send
  raw IsoDep data to the tag and receive the response. How to send data?
 Q3:  →public byte[] getHistoricalBytes ()
  The historical bytes can be used to help identify a tag. They
  are present only on IsoDep tags that are based on NfcA RF technology.
  If this tag is not NfcA then null is returned.
  What 's the meaning?

   Thank you !

  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

 --

 Best regards

 calvin xie- 隐藏被引用文字 -

 - 显示引用的文字 -

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en