List of usage examples for android.content Intent setComponent
public @NonNull Intent setComponent(@Nullable ComponentName component)
From source file:de.teamklinge.mymusicteacher.gcm.GcmBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.i("MMT", "onReceive startet!"); // Auf GcmIntenService-Klasse hinweisen, die den Intent bearbeitet ComponentName comp = new ComponentName(context.getPackageName(), GcmIntentService.class.getName()); // Service starten, Gert wird "wach" gehalten startWakefulService(context, (intent.setComponent(comp))); setResultCode(Activity.RESULT_OK);//from ww w. j a v a 2 s .c o m }
From source file:com.android.google.gcm.GCMBaseBroadcastReceiver.java
@Override public final void onReceive(Context context, Intent intent) { // Explicitly specify that GcmIntentService will handle the intent. ComponentName comp = new ComponentName(context.getPackageName(), getIntentServiceHandlerClass().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:edu.pdx.cecs.orcycle.Controller.java
private void transitionToLocationServices(Fragment f) { final ComponentName toLaunch = new ComponentName(COM_ANDROID_SETTINGS, COM_ANDROID_SETTINGS_SECURITY_SETTINGS); final Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.setComponent(toLaunch); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); f.startActivityForResult(intent, 0); }
From source file:com.irccloud.android.activity.QuickReplyActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_quick_reply); if (getIntent().hasExtra("cid") && getIntent().hasExtra("bid")) { onNewIntent(getIntent());/*from ww w . j av a2s .co m*/ } else { finish(); return; } final ImageButton send = (ImageButton) findViewById(R.id.sendBtn); final EditText message = (EditText) findViewById(R.id.messageTxt); message.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) { if (actionId == EditorInfo.IME_ACTION_SEND && message.getText() != null && message.getText().length() > 0) send.performClick(); return true; } }); message.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View view, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER && message.getText() != null && message.getText().length() > 0) send.performClick(); return false; } }); send.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (message.getText() != null && message.getText().length() > 0) { Intent i = new Intent(RemoteInputService.ACTION_REPLY); i.setComponent(new ComponentName(getPackageName(), RemoteInputService.class.getName())); i.putExtras(getIntent()); i.putExtra("reply", message.getText().toString()); startService(i); finish(); } } }); ListView listView = (ListView) findViewById(R.id.conversation); listView.setAdapter(adapter); }
From source file:com.mb.kids_mind.GcmBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.v(TAG, "1"); // 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 . j a v a 2s. co m }
From source file:com.goftagram.telegram.messenger.GcmBroadcastReceiver.java
@Override public void onReceive(final Context context, final Intent intent) { FileLog.d("tmessages", "GCM received intent: " + intent); ComponentName comp = new ComponentName(context.getPackageName(), GcmPushMessageHandlerIntentService.class.getName()); startWakefulService(context, (intent.setComponent(comp))); if (intent.getAction().equals("com.google.android.c2dm.intent.RECEIVE")) { AndroidUtilities.runOnUIThread(new Runnable() { @Override/*from w ww .ja v a 2 s . c o m*/ public void run() { ApplicationLoader.postInitApplication(); try { String key = intent.getStringExtra("loc_key"); if ("DC_UPDATE".equals(key)) { String data = intent.getStringExtra("custom"); JSONObject object = new JSONObject(data); int dc = object.getInt("dc"); String addr = object.getString("addr"); String[] parts = addr.split(":"); if (parts.length != 2) { return; } String ip = parts[0]; int port = Integer.parseInt(parts[1]); ConnectionsManager.getInstance().applyDatacenterAddress(dc, ip, port); } } catch (Exception e) { FileLog.e("tmessages", e); } ConnectionsManager.getInstance().resumeNetworkMaybe(); } }); } else if (intent.getAction().equals("com.google.android.c2dm.intent.REGISTRATION")) { String registration = intent.getStringExtra("registration_id"); if (intent.getStringExtra("error") != null) { FileLog.e("tmessages", "Registration failed, should try again later."); } else if (intent.getStringExtra("unregistered") != null) { FileLog.e("tmessages", "unregistration done, new messages from the authorized sender will be rejected"); } else if (registration != null) { FileLog.e("tmessages", "registration id = " + registration); } } setResultCode(Activity.RESULT_OK); }
From source file:com.parabal.parabaltaskmanager.GcmBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.d("GcmBR", "Begin"); // 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 a va2 s .co m Log.d("GcmBR", "GcmBR started"); }
From source file:com.example.hack_push.GcmBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { Bundle extras = intent.getExtras();/*w ww. j av a 2 s . c o m*/ String message = extras.getString("message"); 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); Intent intent_sendback = new Intent(MainActivity.DISPLAY_MESSAGE_ACTION); intent_sendback.putExtra("message", message); context.sendBroadcast(intent_sendback); }
From source file:com.dartmouth.yuanjiang.myruns_2.GcmBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.d("d", "delete"); // 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 w w .j a v a2s . co m*/ }
From source file:com.example.demoflavius.GcmBroadcastReceiver.java
@Override public void onReceive(Context context, Intent intent) { try {/*from w w w . j ava 2 s . c om*/ // 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); } catch (Exception ex) { ex.printStackTrace(); } }