use resource strings and apis rather than quoted strings for nfc constants

This commit is contained in:
Eric House 2013-11-13 06:51:36 -08:00
parent 735e42cd90
commit d119033333
3 changed files with 5 additions and 5 deletions

View file

@ -80,7 +80,7 @@
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/org.eehouse.android.xw4" />
<data android:mimeType="@string/xwords_nfc_mime" />
</intent-filter>
</activity>

View file

@ -115,7 +115,7 @@
<!-- other -->
<string name="default_host">eehouse.org</string>
<string name="xwords_nfc_mime">application/org.eehouse.android.xw4</string>
<string name="invite_host">eehouse.org</string>
<string name="invite_prefix">/and/</string>
<string name="invite_mime">application/x-xwordsinvite</string>

View file

@ -49,14 +49,14 @@ public class NFCUtils {
public static void buildAndPush( Activity activity, String data )
{
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter( activity );
String mimeType = activity.getString( R.string.xwords_nfc_mime );
NdefMessage msg = new NdefMessage( new NdefRecord[] {
new NdefRecord(NdefRecord.TNF_MIME_MEDIA,
"application/org.eehouse.android.xw4"
new NdefRecord(NdefRecord.TNF_MIME_MEDIA, mimeType
.getBytes(Charset.forName("US-ASCII")),
new byte[0],
data.getBytes(Charset.forName("US-ASCII")))
,NdefRecord.
createApplicationRecord("org.eehouse.android.xw4")
createApplicationRecord( activity.getPackageName() )
});
nfcAdapter.setNdefPushMessage( msg, activity );
}