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.app.chasebank.push.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  v a  2 s. co m*/
}

From source file:com.example.shivadeviah.enhancedgooglemaps.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.j av a  2s  .  com
    Log.i("ANAPLAX", "BroadCast Receiver");
}

From source file:com.example.cloudmessaging.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.  ja  v  a  2 s  . com*/
    System.out.print("RECIEVED MESSAGE!");
}

From source file:com.prod.intelligent7.engineautostart.EASBroadcastReceiver.java

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

From source file:com.tongs.user.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.j  a v a2  s.c om

}

From source file:io.relayr.tellmewhen.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);/*www  .  j  av  a  2s  .  c  o  m*/
}

From source file:com.eoldsolutions.quinielavirtualandroid.presentation.notification.NotificationBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    // Explicitly specify that GcmIntentService will handle the intent.
    ComponentName comp = new ComponentName(context.getPackageName(), NotificationIntentService.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  . java  2s .c  o m*/
}

From source file:com.lightstreamer.demo.android.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  v a2 s . c o m
}

From source file:com.commonsware.android.advservice.callbackbinding.client.DownloadFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setRetainInstance(true);//w w w .  j a  v a 2s  . c om

    appContext = (Application) getActivity().getApplicationContext();

    Intent implicit = new Intent(IDownload.class.getName());
    List<ResolveInfo> matches = getActivity().getPackageManager().queryIntentServices(implicit, 0);

    if (matches.size() == 0) {
        Toast.makeText(getActivity(), "Cannot find a matching service!", Toast.LENGTH_LONG).show();
    } else if (matches.size() > 1) {
        Toast.makeText(getActivity(), "Found multiple matching services!", Toast.LENGTH_LONG).show();
    } else {
        Intent explicit = new Intent(implicit);
        ServiceInfo svcInfo = matches.get(0).serviceInfo;
        ComponentName cn = new ComponentName(svcInfo.applicationInfo.packageName, svcInfo.name);

        explicit.setComponent(cn);
        appContext.bindService(explicit, this, Context.BIND_AUTO_CREATE);
    }
}

From source file:com.pubkit.gcm.PubKitGcmBroadcastReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    // Explicitly specify that GcmIntentService will handle the intent.
    ComponentName comp = new ComponentName(context.getPackageName(), PubKitGcmIntentService.class.getName());

    // Start the service, keeping the device awake while it is launching.
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);/*w  ww.ja v  a2  s  .  c  om*/
}