List of usage examples for android.content Intent EXTRA_REFERRER
String EXTRA_REFERRER
To view the source code for android.content Intent EXTRA_REFERRER.
Click Source Link
From source file:net.goldenspiral.fetlifeoss.ui.fragments.FetLifeFragment.java
protected void setShareIntent(String message) { final Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TITLE, getResources().getString(R.string.share_title)); sendIntent.putExtra(Intent.EXTRA_TEXT, message); sendIntent.putExtra(Intent.EXTRA_REFERRER, Uri.parse(getResources().getString(R.string.share_referrer))); sendIntent.setType("text/plain"); setShareIntent(sendIntent);//from w ww.j av a 2 s. co m }
From source file:com.irccloud.android.activity.PastebinViewerActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { finish();/*from w ww.ja va2 s. c o m*/ if (getWindowManager().getDefaultDisplay().getWidth() < TypedValue .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 800, getResources().getDisplayMetrics()) || isMultiWindow()) overridePendingTransition(R.anim.fade_in, R.anim.slide_out_right); return true; } else if (item.getItemId() == R.id.delete) { if (Uri.parse(url).getQueryParameter("own_paste").equals("1")) { AlertDialog.Builder builder = new AlertDialog.Builder(PastebinViewerActivity.this); builder.setTitle("Delete Snippet"); builder.setMessage("Are you sure you want to delete this snippet?"); builder.setPositiveButton("Delete", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { NetworkConnection.getInstance().delete_paste(Uri.parse(url).getQueryParameter("id")); finish(); Toast.makeText(PastebinViewerActivity.this, "Snippet deleted", Toast.LENGTH_SHORT).show(); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.cancel(); } }); AlertDialog d = builder.create(); d.setOwnerActivity(PastebinViewerActivity.this); d.show(); } } else if (item.getItemId() == R.id.action_linenumbers) { item.setChecked(!item.isChecked()); mWebView.loadUrl("javascript:window.PASTEVIEW.doToggleLines()"); } else if (item.getItemId() == R.id.action_browser) { if (!PreferenceManager .getDefaultSharedPreferences(IRCCloudApplication.getInstance().getApplicationContext()) .getBoolean("browser", false) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); builder.setToolbarColor(ColorScheme.getInstance().navBarColor); builder.addDefaultShareMenuItem(); builder.addMenuItem("Copy URL", PendingIntent.getBroadcast(this, 0, new Intent(this, ChromeCopyLinkBroadcastReceiver.class), PendingIntent.FLAG_UPDATE_CURRENT)); CustomTabsIntent intent = builder.build(); intent.intent.setData(Uri.parse(url.contains("?") ? url.substring(0, url.indexOf("?")) : url)); if (Build.VERSION.SDK_INT >= 22) intent.intent.putExtra(Intent.EXTRA_REFERRER, Uri.parse(Intent.URI_ANDROID_APP_SCHEME + "//" + getPackageName())); if (Build.VERSION.SDK_INT >= 16 && intent.startAnimationBundle != null) { startActivity(intent.intent, intent.startAnimationBundle); } else { startActivity(intent.intent); } } else { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url.contains("?") ? url.substring(0, url.indexOf("?")) : url)); startActivity(intent); } finish(); return true; } else if (item.getItemId() == R.id.action_copy) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService( CLIPBOARD_SERVICE); if (url.contains("?")) clipboard.setText(url.substring(0, url.indexOf("?"))); else clipboard.setText(url); } else { @SuppressLint("ServiceCast") android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService( CLIPBOARD_SERVICE); android.content.ClipData clip; if (url.contains("?")) clip = android.content.ClipData.newRawUri("IRCCloud Snippet URL", Uri.parse(url.substring(0, url.indexOf("?")))); else clip = android.content.ClipData.newRawUri("IRCCloud Snippet URL", Uri.parse(url)); clipboard.setPrimaryClip(clip); } Toast.makeText(PastebinViewerActivity.this, "Link copied to clipboard", Toast.LENGTH_SHORT).show(); } else if (item.getItemId() == R.id.action_share) { if (getIntent() != null && getIntent().getDataString() != null) { Intent intent = new Intent(Intent.ACTION_SEND, Uri.parse(url)); intent.setType("text/plain"); if (url.contains("?")) intent.putExtra(Intent.EXTRA_TEXT, url.substring(0, url.indexOf("?"))); else intent.putExtra(Intent.EXTRA_TEXT, url); intent.putExtra(ShareCompat.EXTRA_CALLING_PACKAGE, getPackageName()); intent.putExtra(ShareCompat.EXTRA_CALLING_ACTIVITY, getPackageManager().getLaunchIntentForPackage(getPackageName()).getComponent()); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(Intent.createChooser(intent, "Share Snippet")); Answers.getInstance().logShare(new ShareEvent().putContentType("Pastebin")); } } else if (item.getItemId() == R.id.action_edit) { mSpinner.setVisibility(View.VISIBLE); Intent i = new Intent(this, PastebinEditorActivity.class); i.putExtra("paste_id", Uri.parse(url).getQueryParameter("id")); startActivityForResult(i, 1); } return super.onOptionsItemSelected(item); }
From source file:com.android.packageinstaller.PackageInstallerActivity.java
@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); mPm = getPackageManager();//from w ww. jav a2 s .c o m mInstaller = mPm.getPackageInstaller(); mUserManager = (UserManager) getSystemService(Context.USER_SERVICE); final Intent intent = getIntent(); mOriginatingUid = getOriginatingUid(intent); final Uri packageUri; if (PackageInstaller.ACTION_CONFIRM_PERMISSIONS.equals(intent.getAction())) { final int sessionId = intent.getIntExtra(PackageInstaller.EXTRA_SESSION_ID, -1); final PackageInstaller.SessionInfo info = mInstaller.getSessionInfo(sessionId); if (info == null || !info.sealed || info.resolvedBaseCodePath == null) { Log.w(TAG, "Session " + mSessionId + " in funky state; ignoring"); finish(); return; } mSessionId = sessionId; packageUri = Uri.fromFile(new File(info.resolvedBaseCodePath)); mOriginatingURI = null; mReferrerURI = null; } else { mSessionId = -1; packageUri = intent.getData(); mOriginatingURI = intent.getParcelableExtra(Intent.EXTRA_ORIGINATING_URI); mReferrerURI = intent.getParcelableExtra(Intent.EXTRA_REFERRER); } // if there's nothing to do, quietly slip into the ether if (packageUri == null) { Log.w(TAG, "Unspecified source"); setPmResult(PackageManager.INSTALL_FAILED_INVALID_URI); finish(); return; } if (DeviceUtils.isWear(this)) { showDialogInner(DLG_NOT_SUPPORTED_ON_WEAR); return; } //set view setContentView(R.layout.install_start); mInstallConfirm = findViewById(R.id.install_confirm_panel); mInstallConfirm.setVisibility(View.INVISIBLE); mOk = (Button) findViewById(R.id.ok_button); mCancel = (Button) findViewById(R.id.cancel_button); mOk.setOnClickListener(this); mCancel.setOnClickListener(this); // Block the install attempt on the Unknown Sources setting if necessary. final boolean requestFromUnknownSource = isInstallRequestFromUnknownSource(intent); if (!requestFromUnknownSource) { processPackageUri(packageUri); return; } // If the admin prohibits it, or we're running in a managed profile, just show error // and exit. Otherwise show an option to take the user to Settings to change the setting. final boolean isManagedProfile = mUserManager.isManagedProfile(); if (!isUnknownSourcesAllowedByAdmin()) { startActivity(new Intent(Settings.ACTION_SHOW_ADMIN_SUPPORT_DETAILS)); clearCachedApkIfNeededAndFinish(); } else if (!isUnknownSourcesEnabled() && isManagedProfile) { showDialogInner(DLG_ADMIN_RESTRICTS_UNKNOWN_SOURCES); } else if (!isUnknownSourcesEnabled()) { // Ask user to enable setting first showDialogInner(DLG_UNKNOWN_SOURCES); } else { processPackageUri(packageUri); } }
From source file:onion.chat.MainActivity.java
void inviteFriend() { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); String url = ""; intent.putExtra(Intent.EXTRA_REFERRER, url); intent.putExtra("customAppUri", url); String msg = String.format(getString(R.string.invitation_text), url, tor.getID(), Uri.encode(db.getName())); Log.i("Message", msg.replace('\n', ' ')); intent.putExtra(Intent.EXTRA_TEXT, msg); intent.setType("text/plain"); startActivity(intent);/*from w w w .j av a2 s. c o m*/ }
From source file:com.android.packageinstaller.PackageInstallerActivity.java
private void startInstall() { // Start subactivity to actually install the application Intent newIntent = new Intent(); newIntent.putExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO, mPkgInfo.applicationInfo); newIntent.setData(mPackageURI);/*from w w w .ja v a 2 s. c o m*/ newIntent.setClass(this, InstallAppProgress.class); String installerPackageName = getIntent().getStringExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME); if (mOriginatingURI != null) { newIntent.putExtra(Intent.EXTRA_ORIGINATING_URI, mOriginatingURI); } if (mReferrerURI != null) { newIntent.putExtra(Intent.EXTRA_REFERRER, mReferrerURI); } if (mOriginatingUid != VerificationParams.NO_UID) { newIntent.putExtra(Intent.EXTRA_ORIGINATING_UID, mOriginatingUid); } if (installerPackageName != null) { newIntent.putExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME, installerPackageName); } if (getIntent().getBooleanExtra(Intent.EXTRA_RETURN_RESULT, false)) { newIntent.putExtra(Intent.EXTRA_RETURN_RESULT, true); newIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); } if (localLOGV) Log.i(TAG, "downloaded app uri=" + mPackageURI); startActivity(newIntent); finish(); }