@Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); switch (item.getItemId()) { case R.id.menu_share: intent.setClassName(this, ShareActivity.class.getName()); startActivity(intent); break; case R.id.menu_history: intent.setClassName(this, HistoryActivity.class.getName()); startActivityForResult(intent, HISTORY_REQUEST_CODE); break; case R.id.menu_settings: intent.setClassName(this, PreferencesActivity.class.getName()); startActivity(intent); break; case R.id.menu_help: intent.setClassName(this, HelpActivity.class.getName()); startActivity(intent); break; default: return super.onOptionsItemSelected(item); } return true; }
/** --------------------------------------------------------- */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) { moveToLeft(); } else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { moveToRight(); } else if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) { Intent intent; switch (mSelectedPosition % Utilities.ACTION_COUNT) { case Utilities.ACTION_START_ALL_APP_VIEW: mMainLayout.showAllApps(true); break; case Utilities.ACTION_START_FILEMANAGER: intent = new Intent(); intent.setClassName(Utilities.FILEMANAGER_PACKAGE, Utilities.FILEMANAGER_NAME); intent.putExtra("media_type", Utilities.FILEMANAGER_TYPE_ALL); mMainLayout.mLauncher.startActivitySafely(intent, TAG); break; case Utilities.ACTION_START_WEBBROWSER: intent = new Intent(); intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity"); mMainLayout.mLauncher.startActivitySafely(intent, TAG); break; case Utilities.ACTION_START_FAVORITES_APPS: mMainLayout.showFavoritesApps(true); break; case Utilities.ACTION_START_SETTINGS: intent = new Intent(); intent.setClassName("com.android.settings", "com.android.settings.Settings"); mMainLayout.mLauncher.startActivitySafely(intent, TAG); break; } } return super.onKeyDown(keyCode, event); }
@Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); switch (item.getItemId()) { case SHARE_ID: intent.setClassName(this, ShareActivity.class.getName()); startActivity(intent); break; case HISTORY_ID: AlertDialog historyAlert = historyManager.buildAlert(); historyAlert.show(); break; case SETTINGS_ID: intent.setClassName(this, PreferencesActivity.class.getName()); startActivity(intent); break; case HELP_ID: intent.setClassName(this, HelpActivity.class.getName()); startActivity(intent); break; case ABOUT_ID: AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.title_about) + versionName); builder.setMessage(getString(R.string.msg_about) + "\n\n" + getString(R.string.zxing_url)); builder.setIcon(R.drawable.launcher_icon); builder.setPositiveButton(R.string.button_open_browser, aboutListener); builder.setNegativeButton(R.string.button_cancel, null); builder.show(); break; default: return super.onOptionsItemSelected(item); } return true; }
@Override public int onStartCommand(Intent intent, int flags, int startId) { SharedPreferences settings = getSharedPreferences("myLock", 0); boolean boot = settings.getBoolean("boot", false); // retrieve user's start at boot pref boolean secure = settings.getBoolean("secure", false); if (!boot) { stopSelf(); // destroy the process because user doesn't have start at boot enabled return 1; } // FIXME next we should actually check our prefs file for the flag that pattern was suppressed // then restore pattern in real system prefs, for security. // SO will need to implement this setting at service start where the pattern suppression occurs. // boolean custom = settings.getBoolean("welcome", false);//retrieve user's mode pref Intent i = new Intent(); // if (!custom) i.setClassName("i4nc4mp.myLockAdvanced", // "i4nc4mp.myLockAdvanced.NoLockService"); // else i.setClassName("i4nc4mp.myLockAdvanced", "i4nc4mp.myLockAdvanced.CustomLockService"); if (!secure) i.setClassName("i4nc4mp.myLockAdvanced", "i4nc4mp.myLockAdvanced.UserPresentService"); // the service will wait for user to complete the first lockscreen - this protects phone from a // restart security circumvention else i.setClassName("i4nc4mp.myLockAdvanced", "i4nc4mp.myLockAdvanced.SecureLockService"); startService(i); stopSelf(); return 1; }
public void alarmFacebookUserComming(Message callbackMessage) { Log.d(TAG, "alarmFacebookUserComming"); Message msg = handler.obtainMessage(FACEBOOK_FRIENDS_GET); if (callbackMessage != null) { msg.getData().putParcelable(CALLBACK, callbackMessage); msg.getData().putLong("hisuid", callbackMessage.getData().getLong("hisuid", -1)); } handler.sendMessageDelayed(msg, 1 * 1000); long nexttime = System.currentTimeMillis() + getFriendsTimeout() * 1000L; if (SNSService.TEST_LOOP) { nexttime = System.currentTimeMillis() + 90 * 1000; } AlarmManager alarmMgr = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(); i.setClassName("com.ast.free", "com.ast.free.service.SNSService"); i.setAction("com.ast.free.intent.action.FACEBOOK_USER"); PendingIntent userpi = PendingIntent.getService( mContext.getApplicationContext(), 0, i, PendingIntent.FLAG_CANCEL_CURRENT); alarmMgr.set(AlarmManager.RTC_WAKEUP, nexttime, userpi); }
public void onTrigger(View v, int target) { if (target == 0) { // right Action = Unlock mCallback.goToUnlockScreen(); } else if (target == 1) { // up Action == Mms Intent mmsIntent = new Intent(Intent.ACTION_MAIN); mmsIntent.setClassName("com.android.mms", "com.android.mms.ui.ConversationList"); mmsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(mmsIntent); mCallback.goToUnlockScreen(); } else if (target == 2) { // left Action = Phone Intent phoneIntent = new Intent(Intent.ACTION_MAIN); phoneIntent.setClassName( "com.android.contacts", "com.android.contacts.activities.DialtactsActivity"); phoneIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(phoneIntent); mCallback.goToUnlockScreen(); } else if (target == 3) { if (!mCameraDisabled) { // Start the Camera Intent intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent); mCallback.goToUnlockScreen(); } else { toggleRingMode(); mUnlockWidgetMethods.updateResources(); mCallback.pokeWakelock(); } } }
public void locationFailure(final Context context, boolean active_fresh) { RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.weather_widget); updateViews(context, views); ComponentName provider = new ComponentName(context, WeatherWidget.class); AppWidgetManager.getInstance(context).updateAppWidget(provider, views); if (active_fresh) { Intent i = new Intent(); i.setClassName( "com.morncloud.weatherwidget", "com.morncloud.weatherwidget.activity.WidgetDialogActivity"); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(i); } else { String localCity = DatabaseHelper.getLocalCity(context); if (TextUtils.isEmpty(localCity)) { Intent i = new Intent(); i.setClassName( "com.morncloud.weatherwidget", "com.morncloud.weatherwidget.activity.WidgetDialogActivity"); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } } }
/** Export an ADF from Tango space to app space. */ private void exportAdf(String uuid) { Intent exportIntent = new Intent(); exportIntent.setClassName(INTENT_CLASS_PACKAGE, INTENT_IMPORT_EXPORT_CLASSNAME); if (exportIntent.resolveActivity(getApplicationContext().getPackageManager()) == null) { exportIntent = new Intent(); exportIntent.setClassName(INTENT_DEPRECATED_CLASS_PACKAGE, INTENT_IMPORT_EXPORT_CLASSNAME); } exportIntent.putExtra(EXTRA_KEY_SOURCE_UUID, uuid); exportIntent.putExtra(EXTRA_KEY_DESTINATION_FILE, mAppSpaceAdfFolder); startActivityForResult(exportIntent, TANGO_INTENT_ACTIVITY_CODE); }
/** Import an ADF from app space to Tango space. */ private void importAdf(String uuid) { String filepath = mAppSpaceAdfFolder + File.separator + uuid; Intent importIntent = new Intent(); importIntent.setClassName(INTENT_CLASS_PACKAGE, INTENT_IMPORT_EXPORT_CLASSNAME); if (importIntent.resolveActivity(getApplicationContext().getPackageManager()) == null) { importIntent = new Intent(); importIntent.setClassName(INTENT_DEPRECATED_CLASS_PACKAGE, INTENT_IMPORT_EXPORT_CLASSNAME); } importIntent.putExtra(EXTRA_KEY_SOURCE_FILE, filepath); startActivityForResult(importIntent, TANGO_INTENT_ACTIVITY_CODE); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); WebappInfo webappInfo = WebappInfo.create(intent); String webappId = webappInfo.id(); String webappUrl = webappInfo.uri().toString(); int webappSource = webappInfo.source(); if (webappId != null && webappUrl != null) { String webappMacString = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_MAC); byte[] webappMac = webappMacString == null ? null : Base64.decode(webappMacString, Base64.DEFAULT); Intent launchIntent = null; if (webappMac != null && WebappAuthenticator.isUrlValid(this, webappUrl, webappMac)) { LaunchMetrics.recordHomeScreenLaunchIntoStandaloneActivity(webappUrl, webappSource); String activityName = WebappActivity.class.getName(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { // Specifically assign the app to a particular WebappActivity instance. int activityIndex = ActivityAssigner.instance(this).assign(webappId); activityName += String.valueOf(activityIndex); } // Create an intent to launch the Webapp in an unmapped WebappActivity. launchIntent = new Intent(); launchIntent.setClassName(this, activityName); webappInfo.setWebappIntentExtras(launchIntent); // On L+, firing intents with the exact same data should relaunch a particular // Activity. launchIntent.setAction(Intent.ACTION_VIEW); launchIntent.setData(Uri.parse(WebappActivity.WEBAPP_SCHEME + "://" + webappId)); } else { Log.e(TAG, "Shortcut (" + webappUrl + ") opened in Chrome."); // The shortcut data doesn't match the current encoding. Change the intent action // launch the URL with a VIEW Intent in the regular browser. launchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(webappUrl)); launchIntent.setClassName(getPackageName(), ChromeLauncherActivity.class.getName()); launchIntent.putExtra(ShortcutHelper.REUSE_URL_MATCHING_TAB_ELSE_NEW_TAB, true); launchIntent.putExtra(ShortcutHelper.EXTRA_SOURCE, webappSource); } launchIntent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK | ApiCompatibilityUtils.getActivityNewDocumentFlag()); startActivity(launchIntent); } ApiCompatibilityUtils.finishAndRemoveTask(this); }
public void rescheduleNotificationSync(boolean force) { AlarmManager alarmMgr = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); long nexttime; long current_time = System.currentTimeMillis(); long last_sync_time = orm.getNotificationLastTime(); long donespan = (current_time - last_sync_time); long left_time = Long.valueOf(orm.getNotificationInterval()) * sync_period - donespan; if (donespan < 0 || left_time <= 0) { long waittime = 1; for (int i = 0; i < nErrorCount && i < 10; i++) { waittime = waittime * 2; } nexttime = System.currentTimeMillis() + 1 * 60 * 1000 * waittime; } else { nexttime = System.currentTimeMillis() + left_time; } if (force == true) { nexttime = System.currentTimeMillis() + 1 * 60 * 1000; } if (SNSService.TEST_LOOP) { nexttime = System.currentTimeMillis() + 1 * 60 * 1000; } Intent i = new Intent(); i.setClassName("oms.sns.facebook", SERVICE); i.setAction(ACTION); PendingIntent phonebookpi = PendingIntent.getService( mContext.getApplicationContext(), 0, i, PendingIntent.FLAG_CANCEL_CURRENT); alarmMgr.set(AlarmManager.RTC_WAKEUP, nexttime, phonebookpi); }
/** * @param context * @param lang * @param date * @param appWidgetId If your App Widget setup process can take several seconds (perhaps while * performing web requests) and you require that your process continues, consider starting a * Service in the onUpdate() method. */ private static void setList( RemoteViews rv, Context context, String lang, Date date, int appWidgetId) { SimpleDateFormat sdf = new SimpleDateFormat("MMdd"); String dateS = sdf.format(date); // Set up the intent that starts the CategoryListRemoteViewsFactory service, which will // provide the views for this collection. Intent adapter = new Intent(context, CategoryListRemoteViewsFactory.class); // adapter.putExtra(CategoryListRemoteViewsFactory.EXTRA_WIDGET_ID, appWidgetId); adapter.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); // TODO??? adapter.putExtra(CategoryListRemoteViewsFactory.EXTRA_WIDGET_LANG, lang); adapter.putExtra(CategoryListRemoteViewsFactory.EXTRA_WIDGET_DATE, dateS); adapter.setData(Uri.parse(adapter.toUri(Intent.URI_INTENT_SCHEME))); Log.d(TAG, "setRemoteAdapter"); rv.setRemoteAdapter(R.id.listView, adapter); rv.setEmptyView(R.id.listView, R.id.emptyView); // This section makes it possible for items to have individualized behavior. // It does this by setting up a pending intent template. Individuals items of a collection // cannot set up their own pending intents. Instead, the collection as a whole sets // up a pending intent template, and the individual items set a fillInIntent // to create unique behavior on an item-by-item basis. Intent appIntent = new Intent(); appIntent.setClassName(CONTENT_PROVIDER_PACKAGE, "ru.vodnouho.android.yourday.HomeActivity"); // Set the action for the intent. // When the user touches a particular view, it will have the effect of // broadcasting TOAST_ACTION. appIntent.setAction(Intent.ACTION_VIEW); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, appIntent, 0); rv.setPendingIntentTemplate(R.id.listView, pendingIntent); }
private boolean callWeChat() { Uri contentUrl = Uri.parse(ConfigUtil.getString(Keys.URL_WECHAT)); Intent intent = new Intent(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_BROWSABLE); intent.setData(contentUrl); PackageManager pm = getPackageManager(); List<ResolveInfo> resInfo = pm.queryIntentActivities(intent, 0); Collections.sort(resInfo, new ResolveInfo.DisplayNameComparator(pm)); List<Intent> targetedIntents = new ArrayList<Intent>(); for (ResolveInfo info : resInfo) { Intent targeted = new Intent(Intent.ACTION_VIEW); ActivityInfo activityInfo = info.activityInfo; if (activityInfo.packageName.equals("com.tencent.mm")) { targeted.setData(contentUrl); targeted.setPackage(activityInfo.packageName); targeted.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); targetedIntents.add(targeted); } } if (targetedIntents.isEmpty()) { return false; } Intent chooser = Intent.createChooser(targetedIntents.remove(0), getString(R.string.title_choose_wechat)); chooser.setClassName("android", "com.android.internal.app.ResolverActivity"); chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedIntents.toArray(new Parcelable[] {})); try { startActivity(chooser); } catch (ActivityNotFoundException e) { return false; } return true; }
@Override public void onReceive(Context context, Intent intent) { Intent intentStartService = new Intent(); intentStartService.setClassName( CommonValue.PACKAGE_NAME_MAIN, CommonValue.PACKAGE_NAME_COMMON + ".MMCClientService"); context.startService(intentStartService); }
public void sendIntentIfRequested() { if (mPackage == null) { return; } Intent intent; if (mIsPublicApi) { intent = new Intent(DownloadManager.ACTION_DOWNLOAD_COMPLETE); intent.setPackage(mPackage); intent.putExtra(DownloadManager.EXTRA_DOWNLOAD_ID, mId); } else { // legacy behavior if (mClass == null) { return; } intent = new Intent(Downloads.ACTION_DOWNLOAD_COMPLETED); intent.setClassName(mPackage, mClass); if (mExtras != null) { intent.putExtra(Downloads.COLUMN_NOTIFICATION_EXTRAS, mExtras); } // We only subscribe the content: URI, for security reasons. Otherwise, malicious // applications would have an easier time spoofing download results by // sending spoofed intents. intent.setData(getMyDownloadsUri()); } mSystemFacade.sendBroadcast(intent); }
public void click2(View view) { // cmp=com.google.android.gallery3d/com.android.gallery3d.app.GalleryActivity Intent intent = new Intent(); intent.setClassName( "com.google.android.gallery3d", "com.android.gallery3d.app.GalleryActivity"); startActivity(intent); }
// launchIntent(): Launches Google Maps directly in navigation mode. private void launchIntent() { // Assigns the EditText reference to the address input. EditText address_1 = (EditText) findViewById(R.id.address_input_1); String location = new String(); // Retrieves the address from the user's input. try { location = address_1.getText().toString(); location = location.replace(" ", "+"); } // NullPointerException handler. catch (NullPointerException e) { // A Toast message appears, notifying the user about the error. toastyPopUp("ERROR: NULLPOINTEREXCEPTION ENCOUNTERED WHILE RETRIEVING ADDRESS INPUT."); } // Launches the customized Google Maps intent directly in navigation mode. Intent i = new Intent( android.content.Intent.ACTION_VIEW, Uri.parse("google.navigation:q=" + location)); i.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"); startActivity(i); }
@Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_PICK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.setClassName(ShareActivity.this, AppPickerActivity.class.getName()); startActivityForResult(intent, PICK_APP); }
/** * Internal method to handle single sign-on backend for authorize(). * * @param activity The Android Activity that will parent the ProxyAuth Activity. * @param applicationId The Facebook application identifier. * @param permissions A list of permissions required for this application. If you do not require * any permissions, pass an empty String array. * @param activityCode Activity code to uniquely identify the result Intent in the callback. */ private boolean startSingleSignOn( Activity activity, String applicationId, String[] permissions, int activityCode) { boolean didSucceed = true; Intent intent = new Intent(); intent.setClassName("com.facebook.katana", "com.facebook.katana.ProxyAuth"); intent.putExtra("client_id", applicationId); if (permissions.length > 0) { intent.putExtra("scope", TextUtils.join(",", permissions)); } // Verify that the application whose package name is // com.facebook.katana.ProxyAuth // has the expected FB app signature. if (!validateAppSignatureForIntent(activity, intent)) { return false; } mAuthActivity = activity; mAuthPermissions = permissions; mAuthActivityCode = activityCode; try { activity.startActivityForResult(intent, activityCode); } catch (ActivityNotFoundException e) { didSucceed = false; } return didSucceed; }
public static boolean a( Context context, AdLauncherIntentInfoParcel adlauncherintentinfoparcel, n n1) { if (adlauncherintentinfoparcel == null) { b.a(5); return false; } Intent intent = new Intent(); if (TextUtils.isEmpty(adlauncherintentinfoparcel.c)) { b.a(5); return false; } if (!TextUtils.isEmpty(adlauncherintentinfoparcel.d)) { intent.setDataAndType(Uri.parse(adlauncherintentinfoparcel.c), adlauncherintentinfoparcel.d); } else { intent.setData(Uri.parse(adlauncherintentinfoparcel.c)); } intent.setAction("android.intent.action.VIEW"); if (!TextUtils.isEmpty(adlauncherintentinfoparcel.e)) { intent.setPackage(adlauncherintentinfoparcel.e); } if (!TextUtils.isEmpty(adlauncherintentinfoparcel.f)) { String as[] = adlauncherintentinfoparcel.f.split("/", 2); if (as.length < 2) { (new StringBuilder("Could not parse component name from open GMSG: ")) .append(adlauncherintentinfoparcel.f); b.a(5); return false; } intent.setClassName(as[0], as[1]); } adlauncherintentinfoparcel = adlauncherintentinfoparcel.g; if (!TextUtils.isEmpty(adlauncherintentinfoparcel)) { int i; try { i = Integer.parseInt(adlauncherintentinfoparcel); } // Misplaced declaration of an exception variable catch (AdLauncherIntentInfoParcel adlauncherintentinfoparcel) { b.a(5); i = 0; } intent.addFlags(i); } try { (new StringBuilder("Launching an intent: ")).append(intent.toURI()); b.a(2); context.startActivity(intent); } // Misplaced declaration of an exception variable catch (Context context) { context.getMessage(); b.a(5); return false; } if (n1 == null) { break MISSING_BLOCK_LABEL_231; } n1.l(); return true; }
protected void onPostExecute(Void result) { Uri uri = Uri.parse("dvb:" + Config.DVB_TV_PROGRAMME + ""); Intent intent = new Intent(); intent.setData(uri); intent.setClassName("com.pbi.dvb", "com.pbi.dvb.SplashActivity"); startActivity(intent); }
/** * This method create a intent for posting a tweet on twitter by using the twitter app. * * @param tweetMessage message which should be posted */ public static void tweetWithApp(String tweetMessage) { if (tweetMessage != null) { Intent tweetIntent = new Intent(Intent.ACTION_SEND); tweetIntent.putExtra(Intent.EXTRA_TEXT, tweetMessage); tweetIntent.setType("text/plain"); tweetIntent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); PackageManager packManager = CreateContextForResource.getContext().getPackageManager(); List<ResolveInfo> resolvedInfoList = packManager.queryIntentActivities(tweetIntent, PackageManager.MATCH_DEFAULT_ONLY); boolean resolved = false; for (ResolveInfo resolveInfo : resolvedInfoList) { if (resolveInfo.activityInfo.packageName.startsWith("com.twitter.android")) { tweetIntent.setClassName( resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name); resolved = true; break; } } if (resolved) { CreateContextForResource.getContext().startActivity(tweetIntent); } else { Toast.makeText( CreateContextForResource.getContext(), CreateContextForResource.getStringFromID(R.string.twitter_not_found), Toast.LENGTH_LONG) .show(); } } }
/** * Returns an intent that can be used to launch Gmail and send an email with the specified file * from this application's cache attached. * * @param context - Context - the context to use. * @param email - String - the 'to' email address. * @param subject - String - the email subject. * @param body - String - the email body. * @param fileName - String - the name of the file in this application's cache to attach to the * email. * @return An Intent that can be used to launch the Gmail composer with the specified file * attached. */ public static Intent getSendEmailIntent( Context context, String email, String subject, String body, String fileName) { final Intent emailIntent = new Intent(Intent.ACTION_SEND); // Explicitly only use Gmail to send emailIntent.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmail"); emailIntent.setType("plain/text"); // Add the recipients emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {email}); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body); // Add the attachment by specifying a reference to our custom // ContentProvider // and the specific file of interest emailIntent.putExtra( Intent.EXTRA_STREAM, Uri.parse("content://" + CachedFileProvider.AUTHORITY + "/" + fileName)); return emailIntent; }
private boolean startSingleSignOn( Activity activity, String applicationId, String permissions, int activityCode) { boolean didSucceed = true; Intent intent = new Intent(); intent.setClassName("com.facebook.katana", "com.facebook.katana.ProxyAuth"); intent.putExtra("client_id", applicationId); if (permissions != null) { intent.putExtra("scope", permissions); } if (!validateAppSignatureForIntent(activity, intent)) { return false; } try { activity.startActivityForResult(intent, activityCode); } catch (ActivityNotFoundException e) { didSucceed = false; } return didSucceed; }
protected void setupShortcut(Venue venue) { // First, set up the shortcut intent. For this example, we simply create // an intent that // will bring us directly back to this activity. A more typical // implementation would use a // data Uri in order to display a more specific result, or a custom // action in order to // launch a specific operation. Intent shortcutIntent = new Intent(Intent.ACTION_MAIN); shortcutIntent.setClassName(this, VenueActivity.class.getName()); shortcutIntent.putExtra(Foursquared.EXTRA_VENUE_ID, venue.getId()); // Then, set up the container intent (the response to the caller) Intent intent = new Intent(); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, venue.getName()); Parcelable iconResource = Intent.ShortcutIconResource.fromContext(this, R.drawable.venue_shortcut_icon); intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource); // Now, return the result to the launcher setResult(RESULT_OK, intent); }
final void openGoogleShopper(String query) { // Construct Intent to launch Shopper Intent intent = new Intent(Intent.ACTION_SEARCH); intent.setClassName(GOOGLE_SHOPPER_PACKAGE, GOOGLE_SHOPPER_ACTIVITY); intent.putExtra(SearchManager.QUERY, query); // Is it available? PackageManager pm = activity.getPackageManager(); Collection<?> availableApps = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); if (availableApps != null && !availableApps.isEmpty()) { // If something can handle it, start it activity.startActivity(intent); } else { // Otherwise offer to install it from Market. AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.msg_google_shopper_missing); builder.setMessage(R.string.msg_install_google_shopper); builder.setIcon(R.drawable.shopper_icon); builder.setPositiveButton(R.string.button_ok, shopperMarketListener); builder.setNegativeButton(R.string.button_cancel, null); builder.show(); } }
private void pokeGpsExploit(final HardwareCallback callback, final int index) { Timeout.clearTimeout(gpsEventTimeout); // exploit a bug in the power manager widget final Intent poke = new Intent(); poke.setClassName( "com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider"); //$NON-NLS-1$//$NON-NLS-2$ poke.addCategory(Intent.CATEGORY_ALTERNATIVE); poke.setData(Uri.parse("3")); // $NON-NLS-1$ mContext.sendBroadcast(poke); // sit & wait for event, otherwise trigger backup safety time-out gpsEventTimeout = Timeout.setTimeout( new Runnable() { public void run() { gpsEventTimeout = -1; unbindGps(); callback.hardwareFailedToEnable( index, HardwareCallback.REASON_GPS_TOGGLE_EXPLOIT_ATTEMPT); } }, 5000); }
private void setUpMap() { if (showRoute == false) { mMap.addMarker( new MarkerOptions() .position(CAFETERIA) .title("Cafeteria") .snippet("Hochschule Karlsruhe")); mMap.moveCamera(CameraUpdateFactory.newLatLng(CAFETERIA)); mMap.animateCamera(CameraUpdateFactory.zoomTo(17.00f)); } else if (showRoute == true) { String uri = "http://maps.google.com/maps?saddr=" + standortLatitude + "," + standortLongitude + "&daddr=" + 49.01578 + "," + 8.39137; Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)); intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"); startActivity(intent); } }
public void rescheduleFacebookUser(boolean force) { AlarmManager alarmMgr = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); long nexttime; long current_time = System.currentTimeMillis(); long last_update_time = orm.getLastUpdateFriendTime(); long donespan = (current_time - last_update_time); long left_time = getFriendsTimeout() * 1000L - donespan; if (donespan < 0 || left_time <= 0) { long waittime = 1; for (int i = 0; i < nErrorCount && i < 10; i++) { waittime = waittime * 2; } nexttime = System.currentTimeMillis() + 10 * 1000 * waittime; } else { nexttime = System.currentTimeMillis() + left_time; } if (force == true) { nexttime = System.currentTimeMillis() + 10 * 1000; } if (SNSService.TEST_LOOP) { nexttime = System.currentTimeMillis() + 90 * 1000; } Intent i = new Intent(); i.setClassName("com.ast.free", "com.ast.free.service.SNSService"); i.setAction("com.ast.free.intent.action.FACEBOOK_USER"); PendingIntent userpi = PendingIntent.getService( mContext.getApplicationContext(), 0, i, PendingIntent.FLAG_CANCEL_CURRENT); alarmMgr.set(AlarmManager.RTC_WAKEUP, nexttime, userpi); }
public void execute() { CamLog.d(FaceDetector.TAG, "ChangeToCamcorder"); try { this.mGet.perfLockAcquire(); } catch (NoSuchMethodError e) { } this.mGet.removeScheduledAllCommand(); if (this.mGet.getApplicationMode() == 0) { this.mGet.cancelAutoFocus(); } Intent intent = new Intent("android.media.action.VIDEO_CAMERA"); intent.putExtra("keepLastValue", true); intent.putExtra( "isFirst", this.mGet.getActivity().getIntent().getBooleanExtra("isFirst", true)); intent.putExtra("orientation", this.mGet.getOrientation()); intent.putExtra("mainCameraDimension", this.mGet.getMainCameraDimension()); intent.putExtra(CameraConstants.INTENT_EXTRA_SHOW_LOADING, true); intent.addFlags(67108864); intent.addFlags(65536); intent.setClassName(this.mGet.getActivity().getPackageName(), Camcorder.class.getName()); this.mGet.setIsSendBroadcastIntent(false); CameraConstants.IS_CHANGE_MODE_STATUS = true; intent.putExtra(CameraConstants.SECURE_CAMERA, Common.isSecureCamera()); CameraHolder.instance().keep(); this.mGet.setChangeMode(); CheckStatusManager.setTelephonyStateCheckSkip(true); this.mGet.getActivity().startActivity(intent); this.mGet.activityFinish(); this.mGet.getActivity().overridePendingTransition(0, 0); Common.checkEnteringTime(false); }