List of usage examples for android.content Intent CATEGORY_LAUNCHER
String CATEGORY_LAUNCHER
To view the source code for android.content Intent CATEGORY_LAUNCHER.
Click Source Link
From source file:net.ustyugov.jtalk.Notify.java
public static void connectingNotify(String account) { JTalkService service = JTalkService.getInstance(); Intent i = new Intent(service, RosterActivity.class); i.setAction(Intent.ACTION_MAIN);//w w w .ja va 2s.c o m i.addCategory(Intent.CATEGORY_LAUNCHER); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent contentIntent = PendingIntent.getActivity(service, 0, i, 0); String str = service.getString(R.string.Connecting); service.setGlobalState(str + ": " + account); service.sendBroadcast(new Intent(Constants.UPDATE)); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(service); mBuilder.setLargeIcon(BitmapFactory.decodeResource(service.getResources(), R.drawable.ic_launcher)); mBuilder.setSmallIcon(R.drawable.stat_offline); mBuilder.setContentTitle(str); mBuilder.setContentText(account); mBuilder.setContentIntent(contentIntent); mBuilder.setPriority(NotificationCompat.PRIORITY_DEFAULT); mBuilder.setProgress(0, 0, true); NotificationManager mng = (NotificationManager) service.getSystemService(Context.NOTIFICATION_SERVICE); mng.notify(NOTIFICATION, mBuilder.build()); }
From source file:com.appmanager.parimal.activity.MainActivity.java
private void loadApps() { manager = this.getPackageManager(); apps = new ArrayList<AppDetail>(); Intent i = new Intent(Intent.ACTION_MAIN, null); i.addCategory(Intent.CATEGORY_LAUNCHER); AppEntryDBHelper mDbHelper = new AppEntryDBHelper(getApplicationContext()); SQLiteDatabase db = mDbHelper.getWritableDatabase(); List<ResolveInfo> availableActivities = manager.queryIntentActivities(i, 0); for (ResolveInfo ri : availableActivities) { if (!ri.activityInfo.packageName.matches("com.appmanager.parimal")) { AppDetail app = new AppDetail(); app.setLabel(ri.loadLabel(manager)); app.setName(ri.activityInfo.packageName); app.setIcon(ri.activityInfo.loadIcon(manager)); apps.add(app);/*from w w w .j a va2s .c o m*/ ContentValues values = new ContentValues(); values.put(AppsReaderContract.AppEntry.COLUMN_APP_NAME, ri.loadLabel(manager).toString()); values.put(AppsReaderContract.AppEntry.COLUMN_APP_PACKAGE, ri.activityInfo.packageName); values.put(AppsReaderContract.AppEntry.COLUMN_APP_CATEGORY, "Uncategorized"); values.put(AppsReaderContract.AppEntry.COLUMN_APP_PIN, "0000"); values.put(AppsReaderContract.AppEntry.COLUMN_APP_PIN_USE, "false"); values.put(AppsReaderContract.AppEntry.COLUMN_APP_USAGE, "0"); long newRowId; newRowId = db.insert(AppsReaderContract.AppEntry.TABLE_NAME, null, values); } } db.close(); }
From source file:com.manumanu.alarmexample2.AlarmNotification.java
private void addNotification(Alarm alarm) { NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); Notification notification;/* w w w. jav a 2 s. c om*/ PendingIntent activity; Intent intent; Log.i(TAG, "AlarmNotification.addNotification(" + alarm.getId() + ", '" + alarm.getTitle() + "', '" + mDateTime.formatDetails(alarm) + "')"); intent = new Intent(this.getApplicationContext(), AlarmMe.class); intent.setAction(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); activity = PendingIntent.getActivity(this, (int) alarm.getId(), intent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder builder = new NotificationCompat.Builder(this); notification = builder.setContentIntent(activity).setSmallIcon(R.drawable.ic_notification) .setAutoCancel(true).setContentTitle("Missed alarm: " + alarm.getTitle()) .setContentText(mDateTime.formatDetails(alarm)).build(); notificationManager.notify((int) alarm.getId(), notification); }
From source file:com.dm.material.dashboard.candybar.adapters.IntentAdapter.java
private void sendRequest(ComponentName name) { try {/*from w w w.j a v a 2 s. com*/ Intent intent = new Intent(Intent.ACTION_SEND); intent = addIntentExtra(intent); intent.setComponent(name); intent.addCategory(Intent.CATEGORY_LAUNCHER); mContext.startActivity(intent); } catch (IllegalArgumentException e) { try { Intent intent = new Intent(Intent.ACTION_SEND); intent = addIntentExtra(intent); mContext.startActivity( Intent.createChooser(intent, mContext.getResources().getString(R.string.email_client))); } catch (ActivityNotFoundException e1) { LogUtil.e(Log.getStackTraceString(e1)); } } }
From source file:com.detroitteatime.autocarfinder.Main.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mainLayout = (LinearLayout) this.getLayoutInflater().inflate(R.layout.main, null); setContentView(mainLayout);//w ww .j av a 2 s. c o m // Possible work around for market launches. See // http://code.google.com/p/android/issues/detail?id=2373 // for more details. Essentially, the market launches the main activity // on top of other activities. // we never want this to happen. Instead, we check if we are the root // and if not, we finish. if (!isTaskRoot()) { final Intent intent = getIntent(); final String intentAction = intent.getAction(); if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && intentAction != null && intentAction.equals(Intent.ACTION_MAIN)) { // Log.w("My Code", // "Main Activity is not the root. Finishing Main Activity instead of launching."); finish(); return; } } // set up buttons start = (Button) findViewById(R.id.start); manual = (Button) findViewById(R.id.manual); // progress = (ProgressBar) findViewById(R.id.progressBar1); start.setOnClickListener(this); start.getBackground().setColorFilter(Color.parseColor(COLOR), PorterDuff.Mode.MULTIPLY); manual.setOnClickListener(this); manual.getBackground().setColorFilter(Color.parseColor(COLOR), PorterDuff.Mode.MULTIPLY); monitor = (FrameLayout) findViewById(R.id.frameLayout1); data1 = this.getSharedPreferences("storage", 0); editor1 = data1.edit(); // firstTime = data1.getBoolean("first_time", true); editor1.putBoolean("first_time", false); editor1.commit(); pi = PendingIntent.getActivity(this, 0, new Intent(this, Main.class), 0); data1 = getSharedPreferences("storage", 0); editor1 = data1.edit(); // set a global layout listener which will be called when the layout // pass is completed and the view is drawn FragmentManager myFragmentManager = getSupportFragmentManager(); mySupportMapFragment = (SupportMapFragment) myFragmentManager.findFragmentById(R.id.map); if (MapsInitializer.initialize(this) != ConnectionResult.SUCCESS) { Toast.makeText(this, "Map failed to initialize.", Toast.LENGTH_SHORT).show(); } map = mySupportMapFragment.getMap(); manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); // Define the criteria how to select the locatioin provider -> use // default criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setAltitudeRequired(false); criteria.setBearingRequired(false); provider = manager.getBestProvider(criteria, false); manager.requestLocationUpdates(provider, 1000, 1, this); navigate = (Button) findViewById(R.id.navigate); navigate.setOnClickListener(this); type = (Button) findViewById(R.id.satellite); type.setOnClickListener(this); }
From source file:com.github.chenxiaolong.dualbootpatcher.switcher.SwitcherService.java
private void setForegroundNotification() { Intent startupIntent = new Intent(this, MainActivity.class); startupIntent.setAction(Intent.ACTION_MAIN); startupIntent.addCategory(Intent.CATEGORY_LAUNCHER); PendingIntent startupPendingIntent = PendingIntent.getActivity(this, 0, startupIntent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder builder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher).setContentIntent(startupPendingIntent) .setContentTitle(getString(R.string.switcher_service_background_service)) .setPriority(Notification.PRIORITY_MIN); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { builder.setCategory(Notification.CATEGORY_SERVICE); }// w w w . j a v a2s . co m startForeground(NOTIFICATION_ID, builder.build()); }
From source file:org.hansel.myAlert.ReminderService.java
private void showNotifciation() { Intent i = new Intent(this, ManageRemindersActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); i.addCategory(Intent.CATEGORY_LAUNCHER); PendingIntent pi = PendingIntent.getActivity(this, 0, i, 0); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher).setContentTitle("Todo esta Bien?") .setContentText("Toca aqui para reportarte?").setContentIntent(pi); Notification notif = mBuilder.build(); NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); notificationManager.notify(NOTIFICATION_ID, notif); //startForeground(1237, notif); }
From source file:com.phonemetra.account.util.AccountUtils.java
private static Intent getWifiSetupIntent(Context context) { Intent intent = new Intent(); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setComponent(new ComponentName(Account.WIFI_COMPONENT_PKG, Account.WIFI_COMPONENT_CLASS)); intent.putExtra(Account.EXTRA_FIRST_RUN, true); intent.putExtra(Account.EXTRA_ALLOW_SKIP, false); intent.putExtra(Account.EXTRA_SHOW_BUTTON_BAR, true); intent.putExtra(Account.EXTRA_ONLY_ACCESS_POINTS, true); intent.putExtra(Account.EXTRA_AUTO_FINISH, true); return intent; }
From source file:com.amaze.carbonfilemanager.activities.PreferencesActivity.java
@Override public void onBackPressed() { if (selectedItem != START_PREFERENCE && changed) restartPC(this); else if (selectedItem != START_PREFERENCE) { selectItem(START_PREFERENCE);// w w w . j a va2 s.c o m } else { Intent in = new Intent(PreferencesActivity.this, MainActivity.class); in.setAction(Intent.ACTION_MAIN); in.setAction(Intent.CATEGORY_LAUNCHER); this.startActivity(in); this.finish(); } }
From source file:edu.stanford.mobisocial.dungbeetle.feed.objects.AppObj.java
public static Intent getLaunchIntent(Context context, DbObj obj) { JSONObject content = obj.getJson();// ww w .j a v a 2 s .co m if (content.has(ANDROID_PACKAGE_NAME)) { Uri appFeed = obj.getContainingFeed().getUri(); String action = content.optString(ANDROID_ACTION); String pkgName = content.optString(ANDROID_PACKAGE_NAME); String className = content.optString(ANDROID_CLASS_NAME); Intent launch = new Intent(action); launch.setClassName(pkgName, className); launch.addCategory(Intent.CATEGORY_LAUNCHER); // TODO: feed for related objs, not parent feed launch.putExtra(AppState.EXTRA_FEED_URI, appFeed); launch.putExtra(AppState.EXTRA_OBJ_HASH, obj.getHash()); // TODO: Remove launch.putExtra("obj", content.toString()); List<ResolveInfo> resolved = context.getPackageManager().queryIntentActivities(launch, 0); if (resolved.size() > 0) { return launch; } Intent market = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + pkgName)); return market; } else if (content.has(WEB_URL)) { Intent app = new Intent(Intent.ACTION_VIEW, Uri.parse(content.optString(WEB_URL))); app.setClass(context, AppFinderActivity.class); app.putExtra(Musubi.EXTRA_FEED_URI, Feed.uriForName(obj.getFeedName())); return app; } return null; }