A pending intent is required to enable foreground NDEF dispatch for NFC - Android Network

Android examples for Network:NFC Ndef

Description

A pending intent is required to enable foreground NDEF dispatch for NFC

Demo Code


//package com.java2s;

import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;

public class Main {
    /**//from   ww  w .ja va2 s .  co  m
     * A pending intent is required to enable foreground NDEF dispatch
     * 
     * @param context
     * @return
     */
    public static PendingIntent getPendingIntent(Activity context) {
        return PendingIntent.getActivity(context, 0, new Intent(context,
                context.getClass())
                .addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
    }
}

Related Tutorials