List of usage examples for android.content Intent getAction
public @Nullable String getAction()
From source file:no.ntnu.idi.socialhitchhiking.myAccount.MyAccountCar.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); int px = convertDpToPixel(160, getApp()); if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) { if (data.getData() == null) { Bundle extras = data.getExtras(); btm = (Bitmap) extras.get("data"); } else if (data.getAction() != null) { btm = getBitmap(data.getData(), px, px); }//w w w.j ava 2s .c o m if (btm != null) { imageView.setImageBitmap(btm); imageView.invalidate(); carChanged = true; } } else if (requestCode == ALBUM_REQUEST && resultCode == RESULT_OK) { btm = getBitmap(data.getData(), px, px); if (btm != null) { imageView.setImageBitmap(btm); imageView.invalidate(); carChanged = true; } } }
From source file:eu.dirtyharry.androidopsiadmin.Main.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);// ww w . ja va 2 s. c om PACKAGE_NAME = this.getPackageName(); try { VERSION_NAME = Main.this.getPackageManager().getPackageInfo(getPackageName(), 0).versionName; } catch (NameNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } Eula.show(Main.this, getString(R.string.gen_lang_prefix)); cl = new ChangeLog(this); if (cl.firstRun()) cl.getLogDialog().show(); // FirstTimeUsageDialog.show(Main.this,"main_test","main_test.accepted"); // new Functions().noPreferences(Main.this, // getString(R.string.gen_title_error), // getString(R.string.gen_setpreferences)); // public SharedPreferences preferences = // Main.this.getSharedPreferences( // getPackageName() + "_preferences", MODE_PRIVATE); // CookieSyncManager.createInstance(this); SharedPreferences preferences = Main.this.getSharedPreferences(getPackageName() + "_preferences", MODE_PRIVATE); serverip = preferences.getString("serverip", ""); serverport = preferences.getString("serverport", ""); serverusername = preferences.getString("serverusername", ""); serverpasswd = preferences.getString("serverpasswd", ""); vibrate = preferences.getBoolean("vibrate", true); customtags = preferences.getBoolean("qr_enable_custom_tags", false); String extra = ""; final Intent intent = getIntent(); if (intent.getAction().equals(SHORTCUT_ACTION)) { extra = intent.getStringExtra("shortcut"); } if (extra.equals(getString(R.string.la_allclients))) { getOpsiClientsTask(); } else if (extra.equals(getString(R.string.la_scanqr))) { Intent qrDroid = new Intent("la.droid.qr.scan"); qrDroid.putExtra("la.droid.qr.complete", true); try { startActivityForResult(qrDroid, GET_QR); } catch (ActivityNotFoundException activity) { Functions.qrDroidRequired(Main.this); } } }
From source file:de.ub0r.android.callmeter.ui.prefs.Preferences.java
/** * {@inheritDoc}/*from w w w . j a v a 2 s .c o m*/ */ @Override protected final void onNewIntent(final Intent intent) { final Uri uri = intent.getData(); Log.d(TAG, "new intent: " + intent.getAction()); Log.d(TAG, "intent: " + intent.getData()); if (uri != null) { Log.d(TAG, "importing: " + uri.toString()); this.importData(this, uri); } }
From source file:com.dycody.android.idealnote.async.DataBackupIntentService.java
/** * Creation of notification on operations completed *///from w w w. j a va 2 s.com private void createNotification(Intent intent, Context mContext, String title, String message, File backupDir) { // The behavior differs depending on intent action Intent intentLaunch; if (DataBackupIntentService.ACTION_DATA_IMPORT.equals(intent.getAction()) || DataBackupIntentService.ACTION_DATA_IMPORT_SPRINGPAD.equals(intent.getAction())) { intentLaunch = new Intent(mContext, MainActivity.class); intentLaunch.setAction(Constants.ACTION_RESTART_APP); } else { intentLaunch = new Intent(); } // Add this bundle to the intent intentLaunch.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intentLaunch.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Creates the PendingIntent PendingIntent notifyIntent = PendingIntent.getActivity(mContext, 0, intentLaunch, PendingIntent.FLAG_UPDATE_CURRENT); NotificationsHelper mNotificationsHelper = new NotificationsHelper(mContext); mNotificationsHelper .createNotification(com.dycody.android.idealnote.R.drawable.ic_content_save_white_24dp, title, notifyIntent) .setMessage(message).setRingtone(prefs.getString("settings_notification_ringtone", null)) .setLedActive(); if (prefs.getBoolean("settings_notification_vibration", true)) mNotificationsHelper.setVibration(); mNotificationsHelper.show(); }
From source file:com.google.android.apps.muzei.api.MuzeiArtSource.java
@Override protected void onHandleIntent(Intent intent) { if (intent == null) { return;/*from w w w .ja v a 2 s . c om*/ } String action = intent.getAction(); // TODO: permissions? if (ACTION_SUBSCRIBE.equals(action)) { processSubscribe((ComponentName) intent.getParcelableExtra(EXTRA_SUBSCRIBER_COMPONENT), intent.getStringExtra(EXTRA_TOKEN)); } else if (ACTION_HANDLE_COMMAND.equals(action)) { int commandId = intent.getIntExtra(EXTRA_COMMAND_ID, 0); processHandleCommand(commandId, intent.getExtras()); } else if (ACTION_NETWORK_AVAILABLE.equals(action)) { processNetworkAvailable(); } }
From source file:at.alladin.rmbt.android.test.RMBTLoopService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Log.d(TAG, "onStartCommand: " + intent); readConfig();/*from ww w. j av a2s . co m*/ if (intent != null) { final String action = intent.getAction(); if (ACTION_START.equals(action)) { isActive.set(true); } else if (action != null && action.equals(ACTION_STOP)) { stopAlarm(); loopModeResults.setStatus(Status.IDLE); isActive.set(false); stopForeground(true); stopSelf(); } if (isActive.get()) { if (action != null && action.equals(ACTION_FORCE)) onAlarmOrLocation(true); else if (action != null && action.equals(ACTION_ALARM)) onAlarmOrLocation(false); else if (action != null && action.equals(ACTION_WAKEUP_ALARM)) onWakeup(); else { if (loopModeResults.getLastTestTime() == 0) { Toast.makeText(this, R.string.loop_started, Toast.LENGTH_LONG).show(); onAlarmOrLocation(true); } else { Toast.makeText(this, R.string.loop_already_active, Toast.LENGTH_LONG).show(); onAlarmOrLocation(true); } } } else { } } return START_NOT_STICKY; }
From source file:com.nadmm.airports.tfr.TfrImageService.java
private void getTfrImage(Intent intent) { Tfr tfr = (Tfr) intent.getSerializableExtra(TFR_ENTRY); String notamId = tfr.notamId; int start = notamId.indexOf(' '); if (start > 0) { notamId = notamId.substring(start + 1); }// ww w. ja va 2 s . c om notamId = notamId.replace("/", "_"); String name = "sect_" + notamId + ".gif"; File imageFile = getFile(name); if (!imageFile.exists()) { URI uri; try { uri = URIUtils.createURI("http", TFR_HOST, 80, TFR_PATH + "/" + name, null, null); fetch(uri, imageFile); } catch (URISyntaxException e) { UiUtils.showToast(this, "TFR: " + e.getMessage()); } } Intent result = makeResultIntent(intent.getAction()); if (imageFile.exists()) { result.putExtra(TFR_IMAGE_PATH, imageFile.getAbsolutePath()); } sendResultIntent(result); }
From source file:com.menumomma.chrome2phone.C2DMReceiver.java
@Override public void onMessage(Context context, Intent intent) { Bundle extras = intent.getExtras();//from w ww. j ava 2 s . c o m if (extras != null) { String url = (String) extras.get("url"); String title = (String) extras.get("title"); String sel = (String) extras.get("sel"); String debug = (String) extras.get("debug"); if (debug != null) { // server-controlled debug - the server wants to know // we received the message, and when. This is not user-controllable, // we don't want extra traffic on the server or phone. Server may // turn this on for a small percentage of requests or for users // who report issues. DefaultHttpClient client = new DefaultHttpClient(); HttpGet get = new HttpGet(Config.BASE_URL + "/debug?id=" + extras.get("collapse_key")); // No auth - the purpose is only to generate a log/confirm delivery // (to avoid overhead of getting the token) try { client.execute(get); } catch (ClientProtocolException e) { // ignore } catch (IOException e) { // ignore } } if (title != null && url != null && url.startsWith("http")) { SharedPreferences settings = Prefs.get(context); Intent launchIntent = LauncherUtils.getLaunchIntent(context, title, url, sel); // Notify and optionally start activity if (settings.getBoolean("launchBrowserOrMaps", true) && launchIntent != null) { try { context.startActivity(launchIntent); LauncherUtils.playNotificationSound(context); } catch (ActivityNotFoundException e) { return; } } else { LauncherUtils.generateNotification(context, url, title, launchIntent); } // Record history (for link/maps only) if (launchIntent != null && launchIntent.getAction().equals(Intent.ACTION_VIEW)) { HistoryDatabase.get(context).insertHistory(title, url); } } } }
From source file:cn.studyjams.s2.sj0132.bowenyan.mygirlfriend.nononsenseapps.notepad.ui.editor.TaskDetailFragment.java
void fixIntent() { stateId = mTask._id;/*from w w w. ja v a 2 s.co m*/ stateListId = mTask.dblist; if (getActivity() == null) return; final Intent orgIntent = getActivity().getIntent(); if (orgIntent == null || orgIntent.getAction() == null || !orgIntent.getAction().equals(Intent.ACTION_INSERT)) return; if (mTask == null || mTask._id < 1) return; final Intent intent = new Intent().setAction(Intent.ACTION_EDIT) .setClass(getActivity(), ActivityEditor.class).setData(mTask.getUri()) .putExtra(TaskDetailFragment.ARG_ITEM_LIST_ID, mTask.dblist); getActivity().setIntent(intent); }
From source file:fr.shywim.antoinedaniel.ui.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Crashlytics not initialized, only safe code mContext = this; Fabric.with(this, new Crashlytics()); Crashlytics.setUserIdentifier(Installation.id(this)); // Crashlytics initialized, can start doing "unsafe" code AnalyticsUtils.initAnalyticsTracker(getApplicationContext()); mHandler = new Handler(); mAppContext = this.getApplicationContext(); utils = Utils.getInstance();/*from w w w. j a v a 2 s . co m*/ setVolumeControlStream(AudioManager.STREAM_MUSIC); setContentView(R.layout.activity_main); Intent intent = getIntent(); if (SearchIntents.ACTION_SEARCH.equals(intent.getAction())) { searchQuery = intent.getStringExtra(SearchManager.QUERY); } ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); } attachTaskFragment(); appState = AppState.getInstance(); appState.load(this); }