Home | History | Annotate | Download | only in nfc

Lines Matching refs:Activity

23 import android.app.Activity;
50 * Intent to start an activity when a tag with NDEF payload is discovered.
57 * most specific intent filters possible to avoid the activity chooser dialog, which can
68 * Intent to start an activity when a tag is discovered and activities are registered for the
71 * <p>To receive this intent an activity must include an intent filter
75 * &lt;activity android:name=".nfc.TechFilter" android:label="NFC/TechFilter"&gt;
84 * &lt;/activity&gt;
94 * activity is considered a match is any single <code>tech-list</code> matches the tag that was
126 * Intent to start an activity when a tag is discovered.
135 * Broadcast to only the activity that handles ACTION_TAG_DISCOVERED
260 * on top of your activity during this time, so do not try to request
542 * <p>Only one NDEF message can be pushed by the currently resumed activity.
550 * <p>At least one activity must be specified, and usually only one is necessary.
555 * @param activity an activity in which NDEF push should be enabled to share the provided
560 public void setNdefPushMessage(NdefMessage message, Activity activity,
561 Activity ... activities) {
562 if (activity == null) {
563 throw new NullPointerException("activity cannot be null");
565 mNfcActivityManager.setNdefPushMessage(activity, message);
566 for (Activity a : activities) {
581 * <p>Only one NDEF message can be pushed by the currently resumed activity.
589 * <p>At least one activity must be specified, and usually only one is necessary.
594 * @param activity an activity in which NDEF push should be enabled to share an NDEF message
599 public void setNdefPushMessageCallback(CreateNdefMessageCallback callback, Activity activity,
600 Activity ... activities) {
601 if (activity == null) {
602 throw new NullPointerException("activity cannot be null");
604 mNfcActivityManager.setNdefPushMessageCallback(activity, callback);
605 for (Activity a : activities) {
625 * @param activity an activity to enable the callback (at least one is required)
629 Activity activity, Activity ... activities) {
630 if (activity == null) {
631 throw new NullPointerException("activity cannot be null");
633 mNfcActivityManager.setOnNdefPushCompleteCallback(activity, callback);
634 for (Activity a : activities) {
643 * Enable foreground dispatch to the given Activity.
645 * <p>This will give give priority to the foreground activity when
658 * that acts a wild card and will cause the foreground activity to receive all tags via the
661 * <p>This method must be called from the main thread, and only when the activity is in the
663 * the completion of their {@link Activity#onPause} callback to disable foreground dispatch
668 * @param activity the Activity to dispatch to
673 * @throws IllegalStateException if the Activity is not currently in the foreground
675 public void enableForegroundDispatch(Activity activity, PendingIntent intent,
677 if (activity == null || intent == null) {
680 if (!activity.isResumed()) {
682 "when your activity is resumed");
689 ActivityThread.currentActivityThread().registerOnActivityPausedListener(activity,
698 * Disable foreground dispatch to the given activity.
700 * <p>After calling {@link #enableForegroundDispatch}, an activity
701 * must call this method before its {@link Activity#onPause} callback
708 * @param activity the Activity to disable dispatch to
709 * @throws IllegalStateException if the Activity has already been paused
711 public void disableForegroundDispatch(Activity activity) {
712 ActivityThread.currentActivityThread().unregisterOnActivityPausedListener(activity,
714 disableForegroundDispatchInternal(activity, false);
719 public void onPaused(Activity activity) {
720 disableForegroundDispatchInternal(activity, true);
724 void disableForegroundDispatchInternal(Activity activity, boolean force) {
727 if (!force && !activity.isResumed()) {
729 "while your activity is still resumed");
737 * Enable NDEF message push over NFC while this Activity is in the foreground.
739 * <p>You must explicitly call this method every time the activity is
741 * your activity completes {@link Activity#onPause}.
744 * instead: it automatically hooks into your activity life-cycle,
757 * @param activity foreground activity
759 * @throws IllegalStateException if the activity is not currently in the foreground
763 public void enableForegroundNdefPush(Activity activity, NdefMessage message) {
764 if (activity == null || message == null) {
767 enforceResumed(activity);
768 mNfcActivityManager.setNdefPushMessage(activity, message);
774 * <p>After calling {@link #enableForegroundNdefPush}, an activity
775 * must call this method before its {@link Activity#onPause} callback
779 * instead: it automatically hooks into your activity life-cycle,
786 * @param activity the Foreground activity
787 * @throws IllegalStateException if the Activity has already been paused
790 public void disableForegroundNdefPush(Activity activity) {
791 if (activity == null) {
794 enforceResumed(activity);
795 mNfcActivityManager.setNdefPushMessage(activity, null);
796 mNfcActivityManager.setNdefPushMessageCallback(activity, null);
797 mNfcActivityManager.setOnNdefPushCompleteCallback(activity, null);
845 public void enableForegroundNdefPush(Activity activity, final NdefPushCallback callback) {
846 if (activity == null || callback == null) {
849 enforceResumed(activity);
851 mNfcActivityManager.setNdefPushMessageCallback(activity, callbackWrapper);
852 mNfcActivityManager.setOnNdefPushCompleteCallback(activity, callbackWrapper);
920 void enforceResumed(Activity activity) {
921 if (!activity.isResumed()) {
922 throw new IllegalStateException("API cannot be called while activity is paused");