List of usage examples for android.content Intent setPackage
public @NonNull Intent setPackage(@Nullable String packageName)
From source file:aerizostudios.com.cropshop.MainActivity.java
public void share_whatsapp(View v) { try {// w w w . j a v a 2 s.c o m Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.setPackage("com.whatsapp"); i.putExtra(Intent.EXTRA_SUBJECT, "CROP SHOP"); String sAux = "\nHey friends, Check out this COOL APP - CropShop - No Crop for Whatsapp and" + " Instagram. This app helps you post images on Whatsapp and Instagram without any need " + "of cropping them. It also adds Blur Effect to the Photos like Iphone and also" + " Instagram filters." + "This app allows you to share the photos" + " directly to Instagram,Facebook and Whatsapp from the App.\n" + "Download this app from the play store.\n"; sAux = sAux + "https://play.google.com/store/apps/details?id=aerizostudios.com.cropshop \n\n"; i.putExtra(Intent.EXTRA_TEXT, sAux); startActivity(i); } catch (Exception e) { Intent check = new Intent(Intent.ACTION_VIEW); check.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); check.setData(Uri.parse("market://details?id=" + "com.whatsapp")); startActivity(check); } }
From source file:it.gulch.linuxday.android.fragments.MapFragment.java
private void launchDirections() { // Build intent to start Google Maps directions String uri = String.format(Locale.US, "http://maps.google.com/maps?f=d&daddr=%1$f,%2$f(%3$s)&dirflg=r", DESTINATION_LATITUDE, DESTINATION_LONGITUDE, DESTINATION_NAME); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); // If Google Maps app is found, don't allow to choose other apps to handle this intent List<ResolveInfo> resolveInfos = getActivity().getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); if (resolveInfos != null) { for (ResolveInfo info : resolveInfos) { if (GOOGLE_MAPS_PACKAGE_NAME.equals(info.activityInfo.packageName)) { intent.setPackage(GOOGLE_MAPS_PACKAGE_NAME); break; }/* www .j a v a 2s. c o m*/ } } startActivity(intent); }
From source file:it.scoppelletti.mobilepower.app.AbstractActivity.java
/** * Visualizza le note di rilascio./*from www .jav a 2s . c o m*/ * * <P>Le classi derivate posso eseguire questo metodo all’interno * della propria versione prevalente del metodo * {@code onAsyncInitializer}.</P> * * @param resId Identificatore del vettore di stringhe che rappresenta le * note di release. * @see #onAsyncInitializer * @see #onNextAsyncInitializer * @see it.scoppelletti.mobilepower.ui.app.ReleaseNoteActivity */ protected final void showReleaseNotes(int resId) { String notes; Intent intent; notes = buildReleaseNotes(resId); if (StringUtils.isBlank(notes)) { onNextAsyncInitializer(); return; } intent = new Intent(ReleaseNoteActivity.ACTION_RELEASENOTES); intent.setPackage(getPackageName()); intent.putExtra(ReleaseNoteActivity.EXTRA_RELEASENOTES, notes); startActivityForResult(intent, ActivitySupport.REQ_RELEASENOTES); }
From source file:com.android.nfc.beam.BeamTransferManager.java
private void sendBluetoothCancelIntentAndUpdateState() { Intent cancelIntent = new Intent(ACTION_STOP_BLUETOOTH_TRANSFER); cancelIntent.setPackage(BLUETOOTH_PACKAGE); cancelIntent.putExtra(BeamStatusReceiver.EXTRA_TRANSFER_ID, mBluetoothTransferId); mContext.sendBroadcast(cancelIntent); updateStateAndNotification(STATE_CANCELLED); }
From source file:com.kanedias.vanilla.lyrics.LyricsShowActivity.java
/** * Handle incoming intent that may possible be ping, other plugin request or user-interactive plugin request * @return true if intent was handled internally, false if activity startup is required *///from ww w . j a v a 2 s .c o m private boolean handleLaunchPlugin() { if (TextUtils.equals(getIntent().getAction(), ACTION_WAKE_PLUGIN)) { // just show that we're okay Log.i(LOG_TAG, "Plugin enabled!"); finish(); return true; } if (pluginInstalled(this, PLUGIN_TAG_EDIT_PKG) && !getIntent().hasExtra(EXTRA_PARAM_P2P)) { // it's user-requested, try to retrieve lyrics from the tag first Intent readLyrics = new Intent(ACTION_LAUNCH_PLUGIN); readLyrics.setPackage(PLUGIN_TAG_EDIT_PKG); readLyrics.putExtra(EXTRA_PARAM_URI, (Uri) getIntent().getParcelableExtra(EXTRA_PARAM_URI)); readLyrics.putExtra(EXTRA_PARAM_PLUGIN_APP, getApplicationInfo()); readLyrics.putExtra(EXTRA_PARAM_P2P, P2P_READ_TAG); readLyrics.putExtra(EXTRA_PARAM_P2P_KEY, new String[] { "LYRICS" }); // tag name readLyrics.putExtras(getIntent()); startActivity(readLyrics); finish(); // end this activity instance, it will be re-created by incoming intent from Tag Editor return true; } return false; }
From source file:com.trigger_context.conf.Action_Post_Tweet.java
public Intent findTwitterClient() { final String[] twitterApps = { "com.twitter.android", // official - 10 // 000 "com.twidroid", // twidroid - 5 000 "com.handmark.tweetcaster", // Tweetcaster - 5 000 "com.thedeck.android" }; // TweetDeck - 5 000 ; Intent tweetIntent = new Intent(); tweetIntent.setType("text/plain"); final PackageManager packageManager = getPackageManager(); List<ResolveInfo> list = packageManager.queryIntentActivities(tweetIntent, PackageManager.MATCH_DEFAULT_ONLY); for (String twitterApp : twitterApps) { for (ResolveInfo resolveInfo : list) { String p = resolveInfo.activityInfo.packageName; if (p != null && p.startsWith(twitterApp)) { tweetIntent.setPackage(p); return tweetIntent; }/* www . j a va2 s .c om*/ } } return null; }
From source file:ir.aarani.bazaar.billing.BillingProcessor.java
private void bindPlayServices() { try {//from ww w . j ava 2s .c o m Intent iapIntent = new Intent("ir.cafebazaar.pardakht.InAppBillingService.BIND"); iapIntent.setPackage("com.farsitel.bazaar"); getContext().bindService(iapIntent, serviceConnection, Context.BIND_AUTO_CREATE); } catch (Exception e) { Log.e(LOG_TAG, "error in bindPlayServices", e); } }
From source file:org.hopestarter.wallet.WalletApplication.java
public void replaceWallet(final Wallet newWallet) { resetBlockchain();/* w w w . j a v a2 s. c om*/ mWallet.shutdownAutosaveAndWait(); mWallet = newWallet; mConfig.maybeIncrementBestChainHeightEver(newWallet.getLastBlockSeenHeight()); afterLoadWallet(); final Intent broadcast = new Intent(ACTION_WALLET_REFERENCE_CHANGED); broadcast.setPackage(getPackageName()); LocalBroadcastManager.getInstance(this).sendBroadcast(broadcast); }
From source file:com.jea.gisandroidapplication.controller.activity.MapActivity.java
/** * Starts Google Navigation//from w w w . j a v a2 s . c om * @param x Longitutde of the Click * @param y Latitute of the Click */ public void startGoolgeNav(double x, double y) { Uri gmmIntentUri = Uri.parse("google.navigation:q=" + y + "," + x); Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); mapIntent.setPackage("com.google.android.apps.maps"); startActivity(mapIntent); }
From source file:org.app.enjoy.musicplayer.FileExplorerActivity.java
protected void initPopupWindow(final List<MusicData> list) { // TODO: 15/10/9 //?activity_pop_left.xml final View popipWindow_view = getLayoutInflater().inflate(R.layout.music_list, null, false); //Popupwindow 200LayoutParams.MATCH_PARENT popupWindow = new PopupWindow(popipWindow_view, ViewGroup.LayoutParams.MATCH_PARENT - 150, ViewGroup.LayoutParams.MATCH_PARENT - 150, true); ///*from w w w. j a v a 2s .c o m*/ // popupWindow.setAnimationStyle(R.style.AnimationFade); // popipWindow_view.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (popipWindow_view != null && popipWindow_view.isShown()) { popupWindow.dismiss(); popupWindow = null; } return false; } }); popupWindow.setBackgroundDrawable(new ColorDrawable(0)); ListView listView = (ListView) popipWindow_view.findViewById(R.id.local_music_list); MusicListAdapter musicListAdapter = new MusicListAdapter(FileExplorerActivity.this, listView); musicListAdapter.setDatas(list); listView.setAdapter(musicListAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(); Bundle bundle = new Bundle(); bundle.putSerializable(Contsant.MUSIC_LIST_KEY, (Serializable) list); bundle.putInt(Contsant.POSITION_KEY, position); intent.putExtras(bundle); intent.setAction("com.app.media.MUSIC_SERVICE"); intent.putExtra("op", Contsant.PlayStatus.PLAY);// ??? intent.setPackage(getPackageName()); startService(intent); } }); }