Java tutorial
//package com.java2s; //License from project: Mozilla Public License import android.content.Context; import android.content.Intent; public class Main { public final static String ORBOT_PACKAGE_NAME = "org.torproject.android"; /** * A request to Orbot to transparently start Tor services */ public final static String ACTION_START = "org.torproject.android.intent.action.START"; /** * A {@link String} {@code packageName} for Orbot to direct its status reply * to, used in {@link #ACTION_START} {@link Intent}s sent to Orbot */ public final static String EXTRA_PACKAGE_NAME = "org.torproject.android.intent.extra.PACKAGE_NAME"; /** * Gets an {@link Intent} for starting Orbot. Orbot will reply with the * current status to the {@code packageName} of the app in the provided * {@link Context} (i.e. {@link Context#getPackageName()}. */ public static Intent getOrbotStartIntent(Context context) { Intent intent = new Intent(ACTION_START); intent.setPackage(ORBOT_PACKAGE_NAME); intent.putExtra(EXTRA_PACKAGE_NAME, context.getPackageName()); return intent; } /** * Gets a barebones {@link Intent} for starting Orbot. This is deprecated * in favor of {@link #getOrbotStartIntent(Context)}. */ @Deprecated public static Intent getOrbotStartIntent() { Intent intent = new Intent(ACTION_START); intent.setPackage(ORBOT_PACKAGE_NAME); return intent; } }