@Override public NdefMessage createNdefMessage(NfcEvent event){
  Log.v(TAG,"createNdefMessage()");
  AbstractIdentity idToSend=panbox.getIdentity();
  Log.v(TAG,"identity null? " + idToSend);
  if (idToSend == null) {
    return null;
  }
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  AbstractIdentityManager idm=IdentityManagerAndroid.getInstance(context);
  idm.exportMyIdentity(idToSend,baos);
  try {
    baos.flush();
    baos.close();
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
  byte[] idFileData=baos.toByteArray();
  NdefRecord record=new NdefRecord(NdefRecord.TNF_MIME_MEDIA,MIME_TYPE.getBytes(Charset.forName("US-ASCII")),new byte[0],idFileData);
  NdefMessage msg=new NdefMessage(new NdefRecord[]{record});
  return msg;
}

@ Override public NdefMessage createNdefMessage ( NfcEvent event ) { Log . v ( TAG , "createNdefMessage()" ) ; AbstractIdentity idToSend = panbox . getIdentity ( ) ; Log . v ( TAG , "identity null? " + idToSend ) ; if ( idToSend == null ) { return null ; } ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; AbstractIdentityManager idm = IdentityManagerAndroid . getInstance ( context ) ; idm . exportMyIdentity ( idToSend , baos ) ; try { baos . flush ( ) ; baos . close ( ) ; } catch ( IOException e1 ) { e1 . printStackTrace ( ) ; } byte [ ] idFileData = baos . toByteArray ( ) ; NdefRecord record = new NdefRecord ( NdefRecord . TNF_MIME_MEDIA , MIME_TYPE . getBytes ( Charset . forName ( "US-ASCII" ) ) , new byte [ 0 ] , idFileData ) ; NdefMessage msg = new NdefMessage ( new NdefRecord [ ] { record } ) ; return msg ; }
callback message that will be called on nfc activity and creates an nfc message containing our identity to be send out
