Example usage for android.content Intent EXTRA_INSTALLER_PACKAGE_NAME

List of usage examples for android.content Intent EXTRA_INSTALLER_PACKAGE_NAME

Introduction

In this page you can find the example usage for android.content Intent EXTRA_INSTALLER_PACKAGE_NAME.

Prototype

String EXTRA_INSTALLER_PACKAGE_NAME

To view the source code for android.content Intent EXTRA_INSTALLER_PACKAGE_NAME.

Click Source Link

Document

Used as a string extra field with #ACTION_INSTALL_PACKAGE to install a package.

Usage

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);//  www.j av a 2 s . c  om
    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();
}