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:me.longman.apps.helloworld.events.receivers.GCMBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    // Explicitly specify that GcmIntentService will handle the intent.
    ComponentName comp = new ComponentName(context.getPackageName(), GCMService.class.getName());
    // Start the service, keeping the device awake while it is launching.
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);//w  ww .j  av  a 2 s.  c  o m
}

From source file:com.nicolacimmino.expensestracker.tracker.data_sync.GcmBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {

    // This is the name of GcmIntentService.
    ComponentName componentName = new ComponentName(context.getPackageName(), GcmIntentService.class.getName());

    // This starts the service keeping the device awake till it's done.
    startWakefulService(context, (intent.setComponent(componentName)));

    setResultCode(Activity.RESULT_OK);/* w ww . j  a va  2  s . co m*/
}

From source file:com.CBook.CB.cloudbook.GCMBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    Bundle bundle = intent.getExtras();//w w w  .ja va 2 s.  c o  m

    for (String key : bundle.keySet()) {
        Object value = bundle.get(key);
    }

    ComponentName comp = new ComponentName(context.getPackageName(), GCMIntentService.class.getName());
    startWakefulService(context, intent.setComponent(comp));
    setResultCode(Activity.RESULT_OK);

}

From source file:org.linphone.gcm.GCMReceiver.java

@Override
public void onReceive(Context context, Intent intent) {

    // Explicitly specify that GcmIntentService will handle the intent.
    ComponentName comp = new ComponentName(context.getPackageName(), GCMService.class.getName());
    // Start the service, keeping the device awake while it is launching.
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);/* w w w.  j av a  2 s  .c  o m*/
}

From source file:com.projects.utils.GcmBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    // Explicitly specify that GcmIntentService will handle the intent.
    ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName());
    // Start the service, keeping the device awake while it is launching.
    startWakefulService(context, (intent.setComponent(comp)));

    setResultCode(Activity.RESULT_OK);//  ww  w .  ja  v a 2 s . co m

}

From source file:com.mono.applink.Foursquare.java

/** Called when the activity is first created. */
@Override/* www .  jav  a2  s.  c  om*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final String url = getIntent().getData().toString();

    if (url.contains("user"))//user with id
    {
        new FoursquareUser().execute();
    } else if (url.contains("venue")) {
        new FoursquareVenue().execute();
    } else {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage("Sorry, but this type of link is not currently supported");
        builder.setOnCancelListener(new OnCancelListener() {
            public void onCancel(DialogInterface dialog) {
                finish();
            }
        });
        builder.setPositiveButton("Open in Browser", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                Intent i = new Intent();
                i.setAction("android.intent.action.VIEW");
                i.addCategory("android.intent.category.BROWSABLE");
                i.setComponent(new ComponentName("com.android.browser", "com.android.browser.BrowserActivity"));
                i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                i.setData(Uri.parse(url));
                startActivity(i);
                finish();
            }
        });
        AlertDialog alert = builder.create();
        alert.show();
    }

}

From source file:com.bubblegum.traceratops.app.ui.activities.MainActivity.java

private void confirmTrustAgent(String packageName) {
    String trustPackageName = packageName.concat(".trust");
    String confirmActivityName = "com.bubblegum.traceratops.trust.ui.ConfirmationActivity";
    ComponentName trustComponent = new ComponentName(trustPackageName, confirmActivityName);
    Intent confirmIntent = new Intent();
    confirmIntent.setComponent(trustComponent);
    startActivity(confirmIntent);/*from  w  w w  . j  a v a  2s . com*/
}

From source file:com.CFP.messiah.GcmBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    // Explicitly specify that GcmIntentService will handle the intent.
    ComponentName comp = new ComponentName(context.getPackageName(), GIntentService.class.getName());
    // Start the service, keeping the device awake while it is launching.
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);/*w  w  w  .ja  v a2s.co  m*/
}

From source file:com.chale22.ico01.fragments.FragmentExtras.java

private void actIcons() {
    String pkg = getResources().getString(R.string.pkg);
    Intent iconfrag = new Intent(Intent.ACTION_MAIN);
    iconfrag.setComponent(new ComponentName(pkg, pkg + ".IconActivity"));

    try {/*from   w  w  w . j  a va2 s  . c  om*/
        startActivity(iconfrag);
    } catch (RuntimeException icons) {
        icons.printStackTrace();
    }
}

From source file:addresspager.test_google_cloud_messaging.GcmBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    // Explicitly specify that GcmIntentService will handle the intent.
    ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName());
    // Start the service, keeping the device awake while it is launching.
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);/*from   ww  w  .  j  a  v  a 2 s .co m*/
}