NfcAdapter disableForegroundNdefPush - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for NfcAdapter disableForegroundNdefPush method.

This code example shows how to use the following methods:disableForegroundDispatch, disableForegroundNdefPush
 
    @Override 
    protected void onPause() { 
        super.onPause(); 
        if (mAdapter != null) {
            mAdapter.disableForegroundDispatch(this);
            mAdapter.disableForegroundNdefPush(this);
        } 
    } 
 
    private void resolveIntent(Intent intent) {
        String action = intent.getAction();
        if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)
                || NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)
                || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
            Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
            NdefMessage[] msgs;
            if (rawMsgs != null) {
                msgs = new NdefMessage[rawMsgs.length];
                for (int i = 0; i < rawMsgs.length; i++) {
6
CodeRank
This code example shows how to use the following methods:disableForegroundNdefPush
    NdefMessage msg = new NdefMessage(new NdefRecord[] { textRecord });
    nfcAdapter.enableForegroundNdefPush(activity, msg);
  } 
 
  public static void disableNFCAdapter(Activity activity, NfcAdapter nfcAdapter){
    nfcAdapter.disableForegroundNdefPush(activity);
  } 
 
  public static NdefRecord createTextRecord(String payload, boolean encodeInUtf8) {
    byte[] langBytes = Locale.getDefault().getLanguage().getBytes(Charset.forName("US-ASCII"));
    Charset utfEncoding = encodeInUtf8 ? Charset.forName("UTF-8") : Charset.forName("UTF-16");
    byte[] textBytes = payload.getBytes(utfEncoding);
    int utfBit = encodeInUtf8 ? 0 : (1 << 7);
    char status = (char) (utfBit + langBytes.length);
    byte[] data = new byte[1 + langBytes.length + textBytes.length];
    data[0] = (byte) status;
    System.arraycopy(langBytes, 0, data, 1, langBytes.length);
    System.arraycopy(textBytes, 0, data, 1 + langBytes.length, textBytes.length);
    NdefRecord record = new NdefRecord(NdefRecord.TNF_WELL_KNOWN,
        NdefRecord.RTD_TEXT, new byte[0], data);
5
CodeRank
This code example shows how to use the following methods:disableForegroundNdefPush
    } 
 
    @Override 
    protected void onPause() { 
        super.onPause(); 
        mNfcAdapter.disableForegroundNdefPush(this);
    } 
 
    @Override 
    public Dialog onCreateDialog(int id, Bundle args) {
        switch (id) {
            case NFC_NOT_ENABLED_DIALOG_ID:
                return NfcDialogs.createNotEnabledDialog(this);
 
            default: 
                return super.onCreateDialog(id, args);
        } 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:disableForegroundNdefPush
 
  @Override 
  protected void onPause() { 
    super.onPause(); 
    mResumed = false;
    mNfcAdapter.disableForegroundNdefPush(this);
  } 
 
  @Override 
  protected void onNewIntent(Intent intent) {
    // NDEF exchange mode 
    if (!mWriteMode && NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) {
      onDataRead(intent);
    } 
 
    // Tag writing mode 
    if (mWriteMode && NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) {
      onDataWrite(intent);
    } 
  } 
4
CodeRank
This code example shows how to use the following methods:disableForegroundNdefPush
 
	@Override 
	protected void onPause() { 
		super.onPause(); 
		mResumed = false; 
		mNfcAdapter.disableForegroundNdefPush(this); 
	} 
 
	@Override 
	protected void onNewIntent(Intent intent) { 
		// NDEF exchange mode 
		if (!mWriteMode 
				&& (NfcAdapter.ACTION_NDEF_DISCOVERED 
						.equals(intent.getAction()) 
						|| NfcAdapter.ACTION_TECH_DISCOVERED.equals(intent 
								.getAction()) || NfcAdapter.ACTION_TAG_DISCOVERED 
							.equals(intent.getAction()))) { 
			NdefMessage[] msgs = getNdefMessages(intent); 
			setTitle(TAG + "/" + "NDEF exchange mode !!"); 
 
4
CodeRank
This code example shows how to use the following methods:disableForegroundDispatch, disableForegroundNdefPush
		mNfcAdapter.enableForegroundDispatch(this, mNfcPendingIntent,
				mNdefExchangeFilters, null);
	} 
 
	private void disableNdefExchangeMode() { 
		mNfcAdapter.disableForegroundNdefPush(this);
		mNfcAdapter.disableForegroundDispatch(this);
	} 
 
	private void enableTagWriteMode() { 
		mWriteMode = true;
		IntentFilter tagDetected = new IntentFilter(
				NfcAdapter.ACTION_TAG_DISCOVERED);
		mWriteTagFilters = new IntentFilter[] { tagDetected };
		mNfcAdapter.enableForegroundDispatch(this, mNfcPendingIntent,
				mWriteTagFilters, null);
	} 
 
	private void disableTagWriteMode() { 
		mWriteMode = false;
4
CodeRank
This code example shows how to use the following methods:disableForegroundDispatch, disableForegroundNdefPush
     
    @Override 
    protected void onPause() { 
        // TODO Auto-generated method stub 
        super.onPause(); 
        mNfcAdapter.disableForegroundNdefPush(this);
        mNfcAdapter.disableForegroundDispatch(this);
    } 
 
    @Override 
    protected void onNewIntent(Intent intent) {
        intentHandler(intent);
        setIntent(intent);
         
        super.onNewIntent(intent);
    } 
 
    @Override 
    protected void onResume() { 
        // TODO Auto-generated method stub  
4
CodeRank
This code example shows how to use the following methods:disableForegroundNdefPush
 
	    @Override 
	    protected void onPause() { 
	        super.onPause(); 
	        mResumed = false;
	        mNfcAdapter.disableForegroundNdefPush(this);
	    } 
 
	    @Override 
	    //step1 
	    protected void onNewIntent(Intent intent) {
	        // NDEF exchange mode 
            NdefMessage[] msgs = getNdefMessages(intent);
            //this figures out what to pull from the other device 
            promptForContent(msgs[0]);
	    	 
	        if (!mWriteMode && NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) {
//	            NdefMessage[] msgs = getNdefMessages(intent); 
	            //this figures out what to pull from the other device 
//	            promptForContent(msgs[0]); 
4
CodeRank
This code example shows how to use the following methods:disableForegroundNdefPush
	@Override 
	protected void onPause() { 
		super.onPause(); 
		mResumed = false;
 
		mNfcAdapter.disableForegroundNdefPush(this);
	} 
 
	@Override 
	protected void onNewIntent(Intent intent) {
		// NDEF exchange mode 
		if (!mWriteMode && NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) {
			NdefMessage[] msgs = getNdefMessages(intent);
			promptForContent(msgs[0]);
		} 
 
		// Tag writing mode 
		if (mWriteMode && NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) {
			Tag detectedTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
			writeTag(getNoteAsNdef(), detectedTag);
4
CodeRank
This code example shows how to use the following methods:disableForegroundNdefPush
 
    @Override 
    protected void onPause() { 
        super.onPause(); 
        mResumed = false;
        mNfcAdapter.disableForegroundNdefPush(this);
    } 
 
    @Override 
    protected void onNewIntent(Intent intent) {
        // NDEF exchange mode 
        if (!mWriteMode && NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) {
            NdefMessage[] msgs = getNdefMessages(intent);
            promptForContent(msgs[0]);
        } 
 
        // Tag writing mode 
       /* if (mWriteMode && NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) { 
            Tag detectedTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); 
            writeTag(getNoteAsNdef(), detectedTag); 
4
CodeRank
disableForegroundNdefPush Method Overview
This method was deprecated in API level 14. use setNdefPushMessage(NdefMessage, Activity, Activity...) instead
See Code Examples for other Android NfcAdapter Methods: