List of usage examples for android.content Intent setComponent
public @NonNull Intent setComponent(@Nullable ComponentName component)
From source file:edu.dartmouth.cs.myrunsjf.GcmBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "onReceive"); // 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 ww .j a va 2s .co m*/ }
From source file:org.apache.cordova.startapp.startApp.java
/** * startApp// ww w . j av a 2 s . c om */ public void start(JSONArray args, CallbackContext callback) { // args.getString(0) - com name // args.getString(1) - activity // args.getString(2) - key // args.getString(3) - value try { Intent LaunchIntent = this.cordova.getActivity().getPackageManager() .getLaunchIntentForPackage(args.getString(0)); if (args.length() > 3) { ComponentName comp = new ComponentName(args.getString(0), args.getString(1)); LaunchIntent.setComponent(comp); LaunchIntent.putExtra(args.getString(2), args.getString(3)); } this.cordova.getActivity().startActivity(LaunchIntent); callback.success(); } catch (Exception e) { callback.error(e.toString()); } }
From source file:com.example.huanlu.myruns.gcm.GcmBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "onReceive()"); // 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 www .j a v a 2 s. co m*/ }
From source file:com.daon.identityx.samplefidoapp.SplashActivity.java
/*** * Retrieve the set of authenticators from the FIDO clients by using the FIDO discovery * * The list of authenticators is cached within this class so if authenticators can be * dynamically added or removed from the device, they will not be picked up after the * app is initialized.// ww w. j a va 2s . co m * */ protected void retrieveAvailableAuthenticatorAaids() { if (!aaidRetrievalAttempted) { LogUtils.logAaidRetrievalStart(); List<ResolveInfo> clientList = getUafClientList(); this.setCurrentFidoOperation(FidoOperation.Discover); Intent intent = getUafClientUtils().getDiscoverIntent(); if (clientList != null && clientList.size() > 0) { intent.setComponent(new ComponentName(clientList.get(uafClientIdx).activityInfo.packageName, clientList.get(uafClientIdx).activityInfo.name)); UafClientLogUtils.logUafDiscoverRequest(intent); UafClientLogUtils.logUafClientDetails(clientList.get(uafClientIdx)); startActivityForResult(intent, AndroidClientIntentParameters.requestCode); return; } else { // End now if there are no clients LogUtils.logDebug(LogUtils.TAG, (String) getText(R.string.no_fido_client_found)); LogUtils.logAaidRetrievalEnd(); aaidRetrievalAttempted = true; } } if (System.currentTimeMillis() < (start + SPLASH_DISPLAY)) { try { Thread.sleep(start + SPLASH_DISPLAY - System.currentTimeMillis()); } catch (InterruptedException ex) { // ignore and carry on } } finish(); try { Intent newIntent = new Intent(this, IntroActivity.class); startActivity(newIntent); } catch (Throwable ex) { displayError(ex.getMessage()); } }
From source file:com.example.AllSOS.GcmBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { // Explicitly specify that GcmIntentService will handle the intent. ComponentName comp = new ComponentName(context.getPackageName(), Activity.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 a 2s . c om*/ String message = intent.getStringExtra("message"); Toast toast = Toast.makeText(context, message, Toast.LENGTH_LONG); toast.show(); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.ic_launcher).setContentTitle("O meu Pedido").setContentText(message); Intent resultIntent = new Intent(context, SelectServiceActivity.class); // Because clicking the notification opens a new ("special") activity, there's // no need to create an artificial back stack. PendingIntent resultPendingIntent = PendingIntent.getActivity(context, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); int mNotificationId = 001; // Gets an instance of the NotificationManager service NotificationManager mNotifyMgr = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); // Builds the notification and issues it. mNotifyMgr.notify(mNotificationId, mBuilder.build()); }
From source file:hackathon.women.challengeme.GcmBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.i("received", "notify"); // 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 ww .java 2 s .c om }
From source file:com.irccloud.android.GCMBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { if (intent != null) { // 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))); }/*from www. j ava 2 s. co m*/ setResultCode(Activity.RESULT_OK); }
From source file:com.amzur.pilot.notifications.GcmBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.i("Listing", "received"); // Explicitly specify that GcmIntentService will handle the intent. ComponentName comp = new ComponentName(context.getPackageName(), MyGcmListenerService.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. java2 s. c o m }
From source file:london.vyne.pos.GcmBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "onReceive called"); // 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 . jav a2 s . co m }
From source file:br.com.epitrack.healthycup.gcm.GCMBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { // Explicitly specify that GcmIntentService will handle the intent. Log.i("SaudeNaCopa", "GcmBroadcastReceiver"); 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 a v a2 s . com }