title: How to send a string using NFC from a windows phone 8 to an android device
body: <p>haven't had any luck using google for this so I thought i'd ask.</p>
  
  <p>Does anyone have any experience / know how to send a simple string i.e "hello" from a Windows Phone 8 device to an Android Device?</p>
  
  <p>so far we have been able to do android -> android and  android -> windows phone 8 but we haven't been able to find out how to do from windows phone 8 to android.</p>
  
  <p>Has anyone seen a guide online or know how to do such a thing?</p>
  
  <p>The first step I guess would be to find out how to make the application on windows phone 8 realize its near an android NFC device .. and then it would be to figure out how to make the application on the android phone receive the message.</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>* Answer *</strong></p>
  
  <p>Alright so here are some answers/tips</p>
  
  <p>I ended up sending the NFC messages as external type because sending application/my.mimetype kept giving me a "sorry your phone cant recorgnize this type of file" on the windows phone even though the message was getting through.</p>
  
  <pre><code>@Override
  public NdefMessage createNdefMessage(NfcEvent event) {
  
      NdefMessage ndefMessage = new NdefMessage(( 
              new NdefRecord[] {createMimeRecord("packageName:externalType",docId.getBytes())}));
  
      return ndefMessage;
  }
  
  public NdefRecord createMimeRecord(String mimeType, byte[] payload) {
      byte[] mimeBytes = mimeType.getBytes(Charset.forName("US-ASCII"));
      NdefRecord mimeRecord = new NdefRecord(NdefRecord.TNF_EXTERNAL_TYPE, mimeBytes, new byte[0], payload);
      return mimeRecord;
  }
  </code></pre>
  
  <p>all you have to do in android is to follow the android example from the SDK samples (android-16/17 - AndroidBeamDemo) which is explained extremely thoroughly here - <a href="http://www.tappednfc.com/wp-content/uploads/TAPPED-NFCDeveloperGuide-Part1.pdf" rel="nofollow">http://www.tappednfc.com/wp-content/uploads/TAPPED-NFCDeveloperGuide-Part1.pdf</a></p>
  
  <p>but instead of using application mimetype use the above external type and in your manifest put the following instead of the mimetype in the intent filter:</p>
  
  <pre><code>                &lt;data
                  android:host="ext"
                  android:pathPrefix="/cco.drugformulary:externalType"
                  android:scheme="vnd.android.nfc" /&gt;
  </code></pre>
  
  <p>regarding reading and sending the message from the windows phone you can use what the accepted answer guy said to do and it should work but for the type put cco.drugformulary:externalType as from above (your project name of course though).</p>
  
  <p>If you are running into any problems feel free to ask me</p>