List of usage examples for android.content Intent CATEGORY_HOME
String CATEGORY_HOME
To view the source code for android.content Intent CATEGORY_HOME.
Click Source Link
From source file:Main.java
public static String getCurLauncher(Context context) { if (context == null) { return null; }//from ww w . j a va2 s . co m try { Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_HOME); ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(mainIntent, 0); if (resolveInfo != null) { return resolveInfo.activityInfo.packageName; } } catch (Exception e) { e.printStackTrace(); } return null; }
From source file:Main.java
public static String getLauncherPackageName(Context context) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY); return resolveInfo.activityInfo.packageName; }
From source file:Main.java
public static boolean onKeyBackGoHome(Activity activity, int keyCode, KeyEvent event) { if (!(keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0)) { return false; // continue }/*www. jav a 2s . c o m*/ activity.startActivity(new Intent().setAction(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME)); return true; }
From source file:com.fanfou.app.opensource.util.IntentHelper.java
public static Intent getLauncherIntent() { final Intent intent = new Intent(Intent.ACTION_MAIN); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addCategory(Intent.CATEGORY_HOME); return intent; }
From source file:org.apache.cordova.home.Home.java
@Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { if ("goHome".equals(action)) { try {/* w w w . java 2 s . c o m*/ Intent i = new Intent(Intent.ACTION_MAIN); i.addCategory(Intent.CATEGORY_HOME); this.cordova.getActivity().startActivity(i); } catch (Exception e) { Log.e(LOG_TAG, "Exception occurred: ".concat(e.getMessage())); return false; } callbackContext.success(); return true; } Log.e(LOG_TAG, "Called invalid action: " + action); return false; }
From source file:me.tassoevan.cordova.GoHomePlugin.java
private boolean doGoHomeAction(JSONArray args, CallbackContext callbackContext) { try {/*from w w w . ja v a 2s.c om*/ Intent i = new Intent(Intent.ACTION_MAIN); i.addCategory(Intent.CATEGORY_HOME); this.cordova.getActivity().startActivity(i); callbackContext.success(); return true; } catch (Exception e) { this.logError("Exception occurred: ".concat(e.getMessage())); callbackContext.error("Exception occurred: ".concat(e.getMessage())); return false; } }
From source file:org.mozilla.focus.shortcut.HomeScreen.java
/** * Switch to the the default home screen activity (launcher). *///from ww w. j a va 2 s.co m private static void goToHomeScreen(Context context) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:jahirfiquitiva.iconshowcase.utilities.utils.Utils.java
public static String getDefaultLauncherPackage(@NonNull Context context) { final Intent intent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME); final ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY); return resolveInfo.activityInfo.packageName; }
From source file:com.nhn.android.archetype.base.AABaseApplicationOrg.java
public static void applicationAllKill() { final ActivityManager am = (ActivityManager) _internalInstance.getSystemService(Activity.ACTIVITY_SERVICE); // stop running service inside current process. List<RunningServiceInfo> serviceList = am.getRunningServices(100); for (RunningServiceInfo service : serviceList) { if (service.pid == android.os.Process.myPid()) { Intent stop = new Intent(); stop.setComponent(service.service); _internalInstance.stopService(stop); }//from w w w . j ava 2s. co m } // move current task to background. Intent launchHome = new Intent(Intent.ACTION_MAIN); launchHome.addCategory(Intent.CATEGORY_DEFAULT); launchHome.addCategory(Intent.CATEGORY_HOME); _internalInstance.startActivity(launchHome); // post delay runnable(waiting for home application launching) new Handler().postDelayed(new Runnable() { public void run() { am.killBackgroundProcesses(_internalInstance.getPackageName()); } }, 2000); }
From source file:com.gigathinking.simpleapplock.ResetUnlockMethod.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_reset); getActionBar().setDisplayHomeAsUpEnabled(true); mDialog = new ProgressDialog(this, ProgressDialog.STYLE_SPINNER); mDialog.setIndeterminate(true);//from w w w. ja v a 2 s . co m prefs = PreferenceManager.getDefaultSharedPreferences(this); mResetReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { prefs.edit().putString(AppLockApplication.LOCKTYPE, AppLockApplication.LOCKTYPE_PIN).commit(); prefs.edit() .putString(AppLockApplication.PASSWORD, intent.getStringExtra(AppLockApplication.PASSWORD)) .commit(); Toast.makeText(context, getString(R.string.pin_reset), Toast.LENGTH_LONG).show(); startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); //startActivity(new Intent(ResetUnlockMethod.this,UnlockWithPIN.class).putExtra("test","test")); finish(); } }; LocalBroadcastManager.getInstance(this).registerReceiver(mResetReceiver, new IntentFilter(AppLockApplication.RESET_UNLOCK)); if (!PreferenceManager.getDefaultSharedPreferences(this).getBoolean(getString(R.string.register_complete), false)) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(getString(R.string.reset_register_device)); builder.setTitle(getString(R.string.info)); builder.setPositiveButton(getString(R.string.register), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { new Register().execute(); if (mDialog != null) { mDialog.setMessage(getString(R.string.register_ongoing)); mDialog.show(); } dialog.dismiss(); } }); builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } }); builder.create().show(); } else { if (mDialog != null) { mDialog.setMessage(getString(R.string.connect_to_server)); mDialog.show(); } new DoRequestReset().execute(); } }