Example usage for android.content Intent CATEGORY_DEFAULT

List of usage examples for android.content Intent CATEGORY_DEFAULT

Introduction

In this page you can find the example usage for android.content Intent CATEGORY_DEFAULT.

Prototype

String CATEGORY_DEFAULT

To view the source code for android.content Intent CATEGORY_DEFAULT.

Click Source Link

Document

Set if the activity should be an option for the default action (center press) to perform on a piece of data.

Usage

From source file:com.example.android.threadsample.BroadcastNotifier.java

/**
 *
 * Uses LocalBroadcastManager to send an {@link Intent} containing {@code status}. The
 * {@link Intent} has the action {@code BROADCAST_ACTION} and the category {@code DEFAULT}.
 *
 * @param status {@link Integer} denoting a work request status
 *///from  w  w  w .  j a  v a  2s.co m
public void broadcastIntentWithState(int status) {

    Intent localIntent = new Intent();

    // The Intent contains the custom broadcast action for this app
    localIntent.setAction(Constants.BROADCAST_ACTION);

    // Puts the status into the Intent
    localIntent.putExtra(Constants.EXTENDED_DATA_STATUS, status);
    localIntent.addCategory(Intent.CATEGORY_DEFAULT);

    // Broadcasts the Intent
    mBroadcaster.sendBroadcast(localIntent);

}

From source file:org.wso2.emm.agent.services.NotificationService.java

public static NotificationService getInstance(Context context) {
    if (notificationService == null) {
        synchronized (NotificationService.class) {
            if (notificationService == null) {
                notificationService = new NotificationService(context);
                context.registerReceiver(notificationService, new IntentFilter(Intent.CATEGORY_DEFAULT));
            }/*from  ww w .j a  v  a2  s .co  m*/
        }
    }
    return notificationService;
}

From source file:com.zhi.android.modules.splash.SplashActivity.java

@Override
@SuppressWarnings({ "CheckReturnValue", "unchecked" })
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mTimerObservable = Observable.timer(1000, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread());

    mTimerObservable.subscribe(aLong -> {
        mTimerObservable = null;//from   www  .j av a 2 s. c o  m

        final Intent intent = getIntent();
        final Intent nextIntent;
        if (intent != null && intent.hasExtra(BuildConfig.NEXT_INTENT)) {
            nextIntent = intent.getParcelableExtra(BuildConfig.NEXT_INTENT);
        } else {
            nextIntent = new Intent(Intent.ACTION_MAIN);
        }
        nextIntent.addCategory(Intent.CATEGORY_DEFAULT);
        ActivityCompat.startActivity(SplashActivity.this, nextIntent,
                ActivityOptionsCompat.makeSceneTransitionAnimation(SplashActivity.this).toBundle());
        supportFinishAfterTransition();
    });
}

From source file:bg.mentormate.academy.reservations.activities.BroadcastNotifier.java

/**
 *
 * Uses LocalBroadcastManager to send an {@link android.content.Intent} containing {@code status}. The
 * {@link android.content.Intent} has the action {@code BROADCAST_ACTION} and the category {@code DEFAULT}.
 *
 * @param status {@link Integer} denoting a work request status
 *///  w w  w . j  av a  2s .c  om
public void broadcastIntentWithState(int status) {

    Intent localIntent = new Intent();

    // The Intent contains the custom broadcast action for this app
    localIntent.setAction(DBConstants.BROADCAST_ACTION);

    // Puts the status into the Intent
    localIntent.putExtra(DBConstants.EXTENDED_DATA_STATUS, status);
    localIntent.addCategory(Intent.CATEGORY_DEFAULT);

    // Broadcasts the Intent
    mBroadcaster.sendBroadcast(localIntent);

}

From source file:com.example.android.wifidirect.BroadcastNotifier.java

/**
 *
 * Uses LocalBroadcastManager to send an {@link Intent} containing {@code status}. The
 * {@link Intent} has the action {@code BROADCAST_ACTION} and the category {@code DEFAULT}.
 *
 * @param status {@link Integer} denoting a work request status
 *//*from   ww w.  j a v  a 2  s  .  co  m*/
public void broadcastIntentWithMessage(String msg) {

    //\todo - KH probably want to change this to take a string logData instead of int status
    Intent localIntent = new Intent();

    // The Intent contains the custom broadcast action for this app
    localIntent.setAction(Constants.BROADCAST_ACTION);

    // Puts the status into the Intent
    localIntent.putExtra(Constants.EXTENDED_DATA_STATUS, -1);
    // Puts log data into the Intent
    localIntent.putExtra(Constants.EXTENDED_STATUS_LOG, msg);
    localIntent.addCategory(Intent.CATEGORY_DEFAULT);

    // Broadcasts the Intent
    mBroadcaster.sendBroadcast(localIntent);

}

From source file:com.google.zxing.client.android.plugin.BarcodeScanner.java

/**
 * Starts an intent to scan and decode a barcode.
 * @param mode  PRODUCT_MODE | ONE_D_MODE | QR_CODE_MODE | DATA_MATRIX_MODE 
 *///w  ww.  j  a  va 2s.c om
public void scan(String mode) {
    Intent intentScan = new Intent();
    intentScan.setClass(this.cordova.getActivity(), CaptureActivity.class);
    intentScan.addCategory(Intent.CATEGORY_DEFAULT);
    if (!mode.equals("")) {
        intentScan.putExtra(Intents.Scan.MODE, mode);
    }

    this.cordova.startActivityForResult((CordovaPlugin) this, intentScan, REQUEST_CODE);
}

From source file:cn.androidy.network.download.BroadcastNotifier.java

public void notifyProgress(int progress) {

    Intent localIntent = new Intent();

    // The Intent contains the custom broadcast action for this app
    localIntent.setAction(Constants.BROADCAST_ACTION);

    localIntent.putExtra(Constants.EXTENDED_DATA_STATUS, progress);

    localIntent.addCategory(Intent.CATEGORY_DEFAULT);

    // Broadcasts the Intent
    mBroadcaster.sendBroadcast(localIntent);

}

From source file:com.krayzk9s.imgurholo.tools.ImageUtils.java

public static void gotoUser(android.support.v4.app.Fragment fragment, JSONParcelable imageData) {
    try {// ww  w.  jav a  2s. com
        Intent intent = new Intent();
        intent.putExtra("username", imageData.getJSONObject().getString("account_url"));
        intent.setAction(ImgurHoloActivity.ACCOUNT_INTENT);
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        fragment.startActivity(intent);
    } catch (JSONException e) {
        Log.e("Error!", e.toString());
    }
}

From source file:com.thingsee.tracker.REST.BroadCastNotifier.java

public void broadcastIntentToExit() {
    Intent localIntent = new Intent();
    localIntent.setAction(CommonConstants.BROADCAST_ACTION);
    localIntent.addCategory(Intent.CATEGORY_DEFAULT);
    localIntent.putExtra(CommonConstants.EXTENDED_DATA_STATUS, CommonConstants.BROADCAST_STATUS_EXIT);
    mBroadcaster.sendBroadcast(localIntent);
}

From source file:com.jingle.zxing.plugin.BarcodeScanner.java

/**
 * Starts an intent to scan and decode a barcode.
 */// ww  w. jav  a2s .  c om
public void scan(String mode) {
    Intent intentScan = new Intent();
    intentScan.setClass(this.cordova.getActivity(), CaptureActivity.class);
    intentScan.addCategory(Intent.CATEGORY_DEFAULT);
    intentScan.putExtra(MODE, mode);

    this.cordova.startActivityForResult((CordovaPlugin) this, intentScan, REQUEST_CODE);
}