Example usage for android.content Intent setPackage

List of usage examples for android.content Intent setPackage

Introduction

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

Prototype

public @NonNull Intent setPackage(@Nullable String packageName) 

Source Link

Document

(Usually optional) Set an explicit application package name that limits the components this Intent will resolve to.

Usage

From source file:de.petendi.ethereum.android.EthereumAndroid.java

public void submitTransaction(Activity parentActivity, int requestCode, String transactionString) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setPackage(EthereumAndroidFactory.PACKAGENAME);
    intent.setData(Uri.parse("eth:" + transactionString));
    parentActivity.startActivityForResult(intent, requestCode);
}

From source file:de.petendi.ethereum.android.EthereumAndroid.java

public void requestSignature(Activity parentActivity, int requestCode, String hexEncodedMessage) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setPackage(EthereumAndroidFactory.PACKAGENAME);
    intent.setData(Uri.parse("eth:sign/" + hexEncodedMessage));
    parentActivity.startActivityForResult(intent, requestCode);
}

From source file:no.digipost.android.gui.metadata.AppointmentView.java

private void openMaps(String address) {
    Uri gmmIntentUri = Uri.parse("geo:0,0?q=" + address);
    Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
    mapIntent.setPackage("com.google.android.apps.maps");
    startActivity(mapIntent);/*www .  j av  a 2s  .  c  o  m*/
}

From source file:mobisocial.musubi.social.QRInviteDialog.java

public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == IntentIntegrator.REQUEST_CODE) {
        if (resultCode == Activity.RESULT_OK) {
            IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
            try {
                Uri uri = Uri.parse(result.getContents());
                Intent i = new Intent(Intent.ACTION_VIEW, uri);
                i.setPackage(getActivity().getPackageName());
                startActivity(i);/* ww w .  j  a v a  2 s  .  co  m*/
            } catch (IllegalArgumentException e) {
            }
        }
    }
}

From source file:com.by_syk.lib.nanoiconpack.dialog.ApplyDialog.java

private void apply2Nova() {
    Intent intent = new Intent("com.teslacoilsw.launcher.APPLY_ICON_THEME");
    intent.setPackage("com.teslacoilsw.launcher");
    intent.putExtra("com.teslacoilsw.launcher.extra.ICON_THEME_TYPE", "GO");
    intent.putExtra("com.teslacoilsw.launcher.extra.ICON_THEME_PACKAGE", getContext().getPackageName());
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try {/*from  w  w  w  .j a v a  2  s .c om*/
        getContext().startActivity(intent);
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
    }
}

From source file:net.grayswander.rotationmanager.FullscreenWatcher.java

private void sendFullscreenStarted() {
    Intent serviceIntent = new Intent(RotationManagerService.class.getName());
    serviceIntent.setPackage("net.grayswander.rotationmanager");
    serviceIntent.putExtra("startedFullScreen", true);
    context.startService(serviceIntent);
}

From source file:net.grayswander.rotationmanager.FullscreenWatcher.java

private void sendFullscreenStopped() {
    Intent serviceIntent = new Intent(RotationManagerService.class.getName());
    serviceIntent.setPackage("net.grayswander.rotationmanager");
    serviceIntent.putExtra("stoppedFullScreen", true);
    context.startService(serviceIntent);
}

From source file:net.kourlas.voipms_sms.Billing.java

/**
 * Initializes an instance of the Billing class.
 *
 * @param applicationContext The application context.
 *//*  w  ww .jav  a  2s.co m*/
public Billing(Context applicationContext) {
    this.applicationContext = applicationContext;

    serviceConnection = new ServiceConnection() {
        @Override
        public void onServiceDisconnected(ComponentName name) {
            billingService = null;
        }

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            billingService = IInAppBillingService.Stub.asInterface(service);
        }
    };

    Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
    serviceIntent.setPackage("com.android.vending");
    applicationContext.bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE);
}

From source file:androidx.media.MediaSession2ImplBase.java

private static String getServiceName(Context context, String serviceAction, String id) {
    PackageManager manager = context.getPackageManager();
    Intent serviceIntent = new Intent(serviceAction);
    serviceIntent.setPackage(context.getPackageName());
    List<ResolveInfo> services = manager.queryIntentServices(serviceIntent, PackageManager.GET_META_DATA);
    String serviceName = null;//w  ww . j a  va  2  s.c  o  m
    if (services != null) {
        for (int i = 0; i < services.size(); i++) {
            String serviceId = SessionToken2.getSessionId(services.get(i));
            if (serviceId != null && TextUtils.equals(id, serviceId)) {
                if (services.get(i).serviceInfo == null) {
                    continue;
                }
                if (serviceName != null) {
                    throw new IllegalArgumentException(
                            "Ambiguous session type. Multiple" + " session services define the same id=" + id);
                }
                serviceName = services.get(i).serviceInfo.name;
            }
        }
    }
    return serviceName;
}

From source file:com.aengbee.android.leanback.ui.VideoDetailsActivity.java

public void intent2mxplayer(Uri videoUri, String dataType) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(videoUri, dataType);
    intent.setPackage("com.mxtech.videoplayer.pro");
    byte DECODER_SW = 2;
    intent.putExtra("decode_mode", DECODER_SW);
    startActivity(intent);//from  w  ww .j  a v  a2s  .  c  o  m
}