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:Main.java

public static void showOperaBrowser(Context context, String visitUrl) {
    Intent intent = new Intent();
    intent.setClassName("com.opera.mini.android", "com.opera.mini.android.Browser");
    intent.setAction(Intent.ACTION_VIEW);
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setData(Uri.parse(visitUrl));
    context.startActivity(intent);// www .  j a v  a 2 s  .  c  om
}

From source file:Main.java

public static void sendBroadCast(Context context, String action, String key, int value) {
    Intent intent = new Intent();
    intent.setAction(action);//w  ww .ja  va  2s.c o m
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.putExtra(key, value);
    context.sendBroadcast(intent);
}

From source file:Main.java

public static void openAppSettings(Context context) {
    Intent myAppSettings = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
            Uri.parse("package:" + context.getPackageName()));
    myAppSettings.addCategory(Intent.CATEGORY_DEFAULT);
    myAppSettings.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(myAppSettings);
}

From source file:Main.java

public static AlertDialog initOrbot(Activity activity, CharSequence stringTitle, CharSequence stringMessage,
        CharSequence stringButtonYes, CharSequence stringButtonNo, CharSequence stringDesiredBarcodeFormats) {
    Intent intentScan = new Intent("org.torproject.android.START_TOR");
    intentScan.addCategory(Intent.CATEGORY_DEFAULT);

    try {//  w w  w .j a v a  2 s. c o  m
        activity.startActivityForResult(intentScan, REQUEST_CODE);
        return null;
    } catch (ActivityNotFoundException e) {
        return showDownloadDialog(activity, stringTitle, stringMessage, stringButtonYes, stringButtonNo);
    }
}

From source file:Main.java

public static Intent getOpenFileIntent(File file) {
    if (file == null || !file.exists() || !file.isFile()) {
        return null;
    }/*from w  ww .  j  a  v  a2s.co  m*/
    String extension = MimeTypeMap.getFileExtensionFromUrl(file.getAbsolutePath());
    String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
    if (extension == null || mimeType == null) {
        return null;
    }
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setDataAndType(Uri.fromFile(file), mimeType);
    return intent;
}

From source file:Main.java

/**
 * Helper method where either the application will open the {@link Settings#ACTION_APPLICATION_DETAILS_SETTINGS}
 * or {@link Settings#ACTION_MANAGE_APPLICATIONS_SETTINGS}
 *
 * @param context//  w  ww  .  ja v  a2s.c  om
 * @return
 */
public static Intent getLaunchSettingsIntent(Context context) {
    Intent intent;
    try {
        // Direct the user to the application detail page where they can change the permissions.
        intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.setData(Uri.parse("package:" + context.getPackageName()));
    } catch (ActivityNotFoundException e) {
        // Fails take then to the all applications screen.
        intent = new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);
        intent.addCategory(Intent.CATEGORY_DEFAULT);
    }
    return intent;
}

From source file:Main.java

public static void goLocationSettingPage(Context context) {
    Intent intent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    intent.addCategory(Intent.CATEGORY_DEFAULT);

    context.startActivity(intent);/*w  ww  .ja  v  a  2 s.  com*/
    // context.startActivity(new
    // Intent(android.provider.Settings.ACTION_LOCALE_SETTINGS));
}

From source file:Main.java

public static List<ResolveInfo> getShareTargets(Context ctx) {
    Intent intent = new Intent(Intent.ACTION_SEND, null);
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setType("text/plain");
    PackageManager pm = ctx.getPackageManager();
    return pm.queryIntentActivities(intent, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT);
}

From source file:Main.java

public static void startInstalledAppDetailsActivity(@Nullable final Activity context) {
    if (context == null) {
        return;//from www.j a v  a  2  s.  c om
    }
    final Intent i = new Intent();
    i.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    i.addCategory(Intent.CATEGORY_DEFAULT);
    i.setData(Uri.parse("package:" + context.getPackageName()));
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    context.startActivity(i);
}

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

public void broadcastIntentWithStateAndSerial(int status, String serial) {
    Intent localIntent = new Intent();
    localIntent.setAction(CommonConstants.BROADCAST_ACTION);
    localIntent.addCategory(Intent.CATEGORY_DEFAULT);
    localIntent.putExtra(CommonConstants.EXTENDED_DATA_STATUS, status);
    localIntent.putExtra(CommonConstants.EXTENDED_SERIAL_NBR, serial);
    mBroadcaster.sendBroadcast(localIntent);
}