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.abbiya.proximity.proximity.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  w  w w. j a  va  2  s  .  c  o m
}

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

private void actWallpapers() {
    String pkg = getResources().getString(R.string.pkg);
    Intent wallpapers = new Intent(Intent.ACTION_MAIN);
    wallpapers.setComponent(new ComponentName(pkg, pkg + ".wallpaper"));

    try {//w  w w .  j  av  a 2  s . c o m
        startActivity(wallpapers);
    } catch (RuntimeException wall) {
        wall.printStackTrace();
    }
}

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

/** Called when the activity is first created. */
@Override/*from   w  w w  .  j a  v  a 2 s .  c om*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

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

    if (url.contains("twitter.com") && !url.contains("status") && !url.contains("direct_messages")
            && !url.contains("user_spam_reports") && !url.contains("account") && !url.contains("settings"))//Just if it is a link of a user profile
    {
        new TwitterUser().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.chale22.ico01.fragments.FragmentExtras.java

private void actRequest() {
    String pkg = getResources().getString(R.string.pkg);
    Intent iconrequest = new Intent(Intent.ACTION_MAIN);
    iconrequest.setComponent(new ComponentName(pkg, pkg + ".IconRequest"));

    try {//from   www.  j a  v a2  s  .  co  m
        startActivity(iconrequest);
    } catch (RuntimeException icons) {
        icons.printStackTrace();
    }
}

From source file:com.meiste.tempalarm.gcm.GcmBroadcastReceiver.java

@Override
public void onReceive(final Context context, final Intent intent) {
    // Explicitly specify that GcmIntentService will handle the intent.
    final 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  www .  ja v a2 s .co  m
}

From source file:com.campusconnect.gcm.GcmBroadcastReceiver.java

@Override
public final void onReceive(final Context context, final 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  w  w w. j av  a  2  s.  c o m*/
}

From source file:com.example.product.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);/* w  ww  .  jav  a 2s. c o m*/
}

From source file:com.qurater.pivotal.gcm.GcmBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    // Explicitly specify that GcmIntentService will handle the intent.
    ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentServiceV2.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 a2 s. com
}

From source file:co.mindquake.nester.pushNoti.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   w w  w.j a  va2  s  .  c  o  m

}

From source file:com.alexforprog.spareparts.GCM.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 w  w  w. ja va 2  s .c  om*/
}