Example usage for android.content Intent setComponent

List of usage examples for android.content Intent setComponent

Introduction

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

Prototype

public @NonNull Intent setComponent(@Nullable ComponentName component) 

Source Link

Document

(Usually optional) Explicitly set the component to handle the intent.

Usage

From source file:com.secbro.qark.exportedcomponent.exportedactivity.IntentSenderActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_exploit_exported_result);

    mResultText = (TextView) findViewById(R.id.activity_exploit_exported_result_text);

    intentKeys = new ArrayList<String>();

    if (getIntent() != null) {
        exportedActivityId = getIntent().getStringExtra(ExportedActivityListFragment.EXPORTED_ACTIVITY_ID);
        exportedActivityName = getIntent().getStringExtra(ExportedActivityListFragment.EXPORTED_ACTIVITY_NAME);

        if (getResources().getIdentifier(exportedActivityId, "array", this.getPackageName()) != 0) {
            intentKeys.addAll(Arrays.asList(getResources().getStringArray(
                    getResources().getIdentifier(exportedActivityId, "array", this.getPackageName()))));
        }//  w w w. j  a v  a2s.com
    }

    if (!intentKeys.isEmpty()) {
        //If the exported activity needs intent params to be passed, then pass in the params from UI.
        Bundle keys = new Bundle();
        keys.putString(ExportedActivityListFragment.EXPORTED_ACTIVITY_NAME, exportedActivityName);
        keys.putString(ExportedActivityListFragment.EXPORTED_ACTIVITY_ID, exportedActivityId);
        keys.putStringArrayList(INTENT_KEYS, intentKeys);

        IntentParamsFragment exploitExportedActivityParamsFragment = new IntentParamsFragment();
        exploitExportedActivityParamsFragment.setArguments(keys);

        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.container, exploitExportedActivityParamsFragment).commit();
        }
    } else {
        Log.d("INFO", "Exported activity needs no params");
        //Start activity
        Intent intent = new Intent();
        intent.setComponent(
                new ComponentName(getResources().getString(R.string.packageName), exportedActivityName));
        startActivityForResult(intent, REQUEST_CODE);
    }
}

From source file:in.ceeq.receivers.CloudMessagesReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    ComponentName component = new ComponentName(context.getPackageName(), CommandService.class.getName());
    startWakefulService(context, (intent.setComponent(component)));
    setResultCode(Activity.RESULT_OK);/*from  w  ww . ja  v  a2  s.c  o m*/
}

From source file:com.banana.banana.GcmBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName());
    startWakefulService(context, (intent.setComponent(comp)));
    //setResultCode(Activity.RESULT_OK);

}

From source file:net.iamyellow.gcmjs.GCMBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    ComponentName comp = new ComponentName(context.getPackageName(), GCMIntentService.class.getName());

    startWakefulService(context, (intent.setComponent(comp)));
}

From source file:br.ufg.inf.muralufg.utils.gcm.GcmBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName());
    startWakefulService(context, intent.setComponent(comp));
    setResultCode(Activity.RESULT_OK);/*from w  ww  .ja v a  2  s  . c om*/
}

From source file:es.ubiqua.citaio.GcmBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName());
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);/*from w ww .  java  2 s.c  o  m*/
}

From source file:com.lf.example.gcm.GCMBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    ComponentName comp = new ComponentName(context.getPackageName(), GCMIntentService.class.getName());
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);//w w  w  . j a v  a2  s. c  om
}

From source file:eu.nubomedia.nubomedia_kurento_health_communicator_android.kc_and_communicator.gcm.MyGCMBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    ComponentName comp = new ComponentName(context.getPackageName(), MyGCMIntentService.class.getName());

    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);//w  w w.  j av  a  2 s.c o m
}

From source file:hku.fyp14017.blencode.ui.dialogs.NewLookDialog.java

private void setupPaintroidButton(View parentView) {
    View paintroidButton = parentView.findViewById(hku.fyp14017.blencode.R.id.dialog_new_look_paintroid);

    final Intent intent = new Intent("android.intent.action.MAIN");
    intent.setComponent(new ComponentName(Constants.POCKET_PAINT_PACKAGE_NAME,
            Constants.POCKET_PAINT_INTENT_ACTIVITY_NAME));

    paintroidButton.setOnClickListener(new View.OnClickListener() {
        @Override// w  w  w  .j av  a  2s. c  o  m
        public void onClick(View view) {
            if (LookController.getInstance().checkIfPocketPaintIsInstalled(intent, getActivity())) {
                fragment.addLookDrawNewImage();
                NewLookDialog.this.dismiss();
            }
        }
    });
}

From source file:love.juhe.androidmonkey.MonkeyActivityEvent.java

/**
 * @return Intent for the new activity/*  w  ww. j av a2 s  .  com*/
 */
private Intent getEvent() {
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_LAUNCHER);
    intent.setComponent(mApp);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}