List of usage examples for android.content Intent toString
@Override
public String toString()
From source file:se.frostyelk.cordova.mifare.MifarePlugin.java
@Override public void onNewIntent(Intent intent) { super.onNewIntent(intent); NxpLogUtils.i(TAG, "onNewIntent Intent: " + intent.toString()); NxpLogUtils.i(TAG, "onNewIntent Action: " + intent.getAction()); tagInfo = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); // Only act on intents from a tag if (tagInfo == null) { return;// w w w . ja va2 s. co m } NxpLogUtils.i(TAG, "Tag info: " + tagInfo.toString()); Nxpnfcliblitecallback callback = new Nxpnfcliblitecallback() { @Override public void onNTag210CardDetected(NTag210 nTag210) { NxpLogUtils.i(TAG, "Found a NTag210 Card!"); handleCardDetected(nTag210); } @Override public void onNTag213215216CardDetected(NTag213215216 nTag213215216) { NxpLogUtils.i(TAG, "Found a NTag213215216 Card!"); handleCardDetected(nTag213215216); } @Override public void onNTag213F216FCardDetected(NTag213F216F nTag213F216F) { NxpLogUtils.i(TAG, "Found a NTag213F216F Card!"); handleCardDetected(nTag213F216F); } @Override public void onUltraLightCardDetected(Ultralight ultralight) { handleUnsupportedCards(); } @Override public void onUltraLightCCardDetected(UltralightC ultralightC) { handleUnsupportedCards(); } @Override public void onUltraLightEV1CardDetected(UltralightEV1 ultralightEV1) { handleUnsupportedCards(); } @Override public void onClassicCardDetected(MFClassic mfClassic) { handleUnsupportedCards(); } @Override public void onDESFireCardDetected(DESFire desFire) { handleUnsupportedCards(); } @Override public void onNTag203xCardDetected(NTag203x nTag203x) { handleUnsupportedCards(); } @Override public void onNTagI2CCardDetected(NTagI2C nTagI2C) { handleUnsupportedCards(); } @Override public void onICodeSLIDetected(ICodeSLI iCodeSLI) { handleUnsupportedCards(); } @Override public void onICodeSLISDetected(ICodeSLIS iCodeSLIS) { handleUnsupportedCards(); } @Override public void onICodeSLILDetected(ICodeSLIL iCodeSLIL) { handleUnsupportedCards(); } @Override public void onICodeSLIXDetected(ICodeSLIX iCodeSLIX) { handleUnsupportedCards(); } @Override public void onICodeSLIXSDetected(ICodeSLIXS iCodeSLIXS) { handleUnsupportedCards(); } @Override public void onICodeSLIXLDetected(ICodeSLIXL iCodeSLIXL) { handleUnsupportedCards(); } @Override public void onPlusCardDetected(Plus plus) { handleUnsupportedCards(); } @Override public void onPlusSL1CardDetected(PlusSL1 plusSL1) { handleUnsupportedCards(); } @Override public void onICodeSLIX2Detected(ICodeSLIX2 iCodeSLIX2) { handleUnsupportedCards(); } }; NxpNfcLibLite.getInstance().filterIntent(intent, callback); }
From source file:com.krayzk9s.imgurholo.activities.MainActivity.java
private void processIntent(Intent intent) { String action = intent.getAction(); String type = intent.getType(); Log.d("New Intent", intent.toString()); if (Intent.ACTION_SEND.equals(action) && type != null) { if (type.startsWith("image/")) { Toast.makeText(this, R.string.toast_uploading, Toast.LENGTH_SHORT).show(); Intent serviceIntent = new Intent(this, UploadService.class); if (intent.getExtras() == null) finish();/* ww w. j a v a 2 s . c o m*/ serviceIntent.setData((Uri) intent.getExtras().get("android.intent.extra.STREAM")); startService(serviceIntent); finish(); } } else if (Intent.ACTION_SEND_MULTIPLE.equals(action)) { Log.d("sending", "sending multiple"); Toast.makeText(this, R.string.toast_uploading, Toast.LENGTH_SHORT).show(); ArrayList<Parcelable> list = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM); Intent serviceIntent = new Intent(this, UploadService.class); serviceIntent.putParcelableArrayListExtra("images", list); startService(serviceIntent); finish(); } else if (Intent.ACTION_VIEW.equals(action) && intent.getData().toString().startsWith("imgur-holo")) { Uri uri = intent.getData(); Log.d("URI", "" + action + "/" + type); String uripath = ""; if (uri != null) uripath = uri.toString(); Log.d("URI", uripath); Log.d("URI", "HERE"); if (uri != null && uripath.startsWith(ApiCall.OAUTH_CALLBACK_URL)) { apiCall.verifier = new Verifier(uri.getQueryParameter("code")); CallbackAsync callbackAsync = new CallbackAsync(apiCall, this); callbackAsync.execute(); } } else if (getSupportFragmentManager().getFragments() == null) { loadDefaultPage(); } }
From source file:com.heneryh.aquanotes.service.SyncService.java
@Override protected void onHandleIntent(Intent intent) { Log.d(TAG, "onHandleIntent(intent=" + intent.toString() + ")"); /**//from www .j a v a2 s .c om * Using the intent, we can tell why we are running this service */ Cursor cursor = null; // This came from the timer expiring or from the gui, either way, push all controllers onto the queue. if (ACTION_UPDATE_ALL.equals(intent.getAction()) || Intent.ACTION_SYNC.equals(intent.getAction())) { try { Uri controllersQueryUri = Controllers.buildQueryControllersUri(); cursor = dbResolverSyncSrvc.query(controllersQueryUri, ControllersQuery.PROJECTION, null, null, null); if (cursor != null && cursor.moveToFirst()) { while (!cursor.isAfterLast()) { Integer controllerId = cursor.getInt(ControllersQuery._ID); requestUpdate(controllerId); cursor.moveToNext(); } } } catch (SQLException e) { Log.e(TAG, "getting controller list", e); // need a little more here! } finally { if (cursor != null) { cursor.close(); } } } else if (ACTION_UPDATE_SINGLE.equals(intent.getAction())) { // This came from the a widget update, id is in the queue } /** * Only start processing thread if not already running, if the thread was running it would * grab the queue items */ synchronized (sLock) { if (!sThreadRunning) { sThreadRunning = true; new SyncThread().execute(); } } }
From source file:com.android.tv.settings.about.AboutFragment.java
@Override public boolean onPreferenceTreeClick(Preference preference) { switch (preference.getKey()) { case KEY_FIRMWARE_VERSION: System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1); mHits[mHits.length - 1] = SystemClock.uptimeMillis(); if (mHits[0] >= (SystemClock.uptimeMillis() - 500)) { if (mUm.hasUserRestriction(UserManager.DISALLOW_FUN)) { Log.d(TAG, "Sorry, no fun for you!"); return false; }//from w w w. j a v a2s . c o m Intent intent = new Intent(Intent.ACTION_MAIN); intent.setClassName("android", com.android.internal.app.PlatLogoActivity.class.getName()); try { startActivity(intent); } catch (Exception e) { Log.e(TAG, "Unable to start activity " + intent.toString()); } } break; case KEY_BUILD_NUMBER: // Don't enable developer options for secondary users. if (!mUm.isAdminUser()) return true; if (mUm.hasUserRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES)) return true; if (mDevHitCountdown > 0) { mDevHitCountdown--; if (mDevHitCountdown == 0) { Settings.Global.putInt(getActivity().getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1); if (mDevHitToast != null) { mDevHitToast.cancel(); } mDevHitToast = Toast.makeText(getActivity(), R.string.show_dev_on, Toast.LENGTH_LONG); mDevHitToast.show(); // This is good time to index the Developer Options // Index.getInstance( // getActivity().getApplicationContext()).updateFromClassNameResource( // DevelopmentSettings.class.getName(), true, true); } else if (mDevHitCountdown > 0 && mDevHitCountdown < (TAPS_TO_BE_A_DEVELOPER - 2)) { if (mDevHitToast != null) { mDevHitToast.cancel(); } mDevHitToast = Toast.makeText(getActivity(), getResources().getQuantityString( R.plurals.show_dev_countdown, mDevHitCountdown, mDevHitCountdown), Toast.LENGTH_SHORT); mDevHitToast.show(); } } else if (mDevHitCountdown < 0) { if (mDevHitToast != null) { mDevHitToast.cancel(); } mDevHitToast = Toast.makeText(getActivity(), R.string.show_dev_already, Toast.LENGTH_LONG); mDevHitToast.show(); } break; case KEY_DEVICE_FEEDBACK: sendFeedback(); break; case KEY_SYSTEM_UPDATE_SETTINGS: CarrierConfigManager configManager = (CarrierConfigManager) getActivity() .getSystemService(Context.CARRIER_CONFIG_SERVICE); PersistableBundle b = configManager.getConfig(); if (b != null && b.getBoolean(CarrierConfigManager.KEY_CI_ACTION_ON_SYS_UPDATE_BOOL)) { ciActionOnSysUpdate(b); } break; } return super.onPreferenceTreeClick(preference); }
From source file:com.wifiafterconnect.WifiAuthenticator.java
protected void requestUserParams(ParsedHttpInput parsedPage) { debug("Need user input for authentication credentials."); if (getContext() == null) { error("Context is not set - cannot start WifiAuthenticationActivity"); return;// w w w .ja v a 2s . co m } // Need to check that screen is not off: PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); if (!pm.isScreenOn()) { /** Screen is Off * if Disable Wifi is enabled : * 1) Disable wifi (if configured). * 2) Post notification with intent to re-enable wifi. * otherwise : * setup Broadcast receiver waiting for SCREEN_ON event, * which will restart the service on wake-up if wifi is still connected. * Don't just want to pop the Activity and let it sit there, * as Wifi may get disconnected and device moved to another location meanwhile **/ boolean disableWifiOnLock = prefs.getAutoDisableWifi(); debug("Screen is off and disableWifiOnLock is " + disableWifiOnLock); if (disableWifiOnLock) { WifiTools.disableWifi(getContext()); notifyWifiDisabled(); } else { ScreenOnReceiver.register(getContext()); // don't want to receive repeat notifications - will re-enable when screen comes on WifiBroadcastReceiver.setEnabled(getContext(), false); } } else { debug("Screen is on - Starting new activity."); /** * Screen is On - so proceeding displaying activity asking for credentials. */ Intent intent = makeIntent(WifiAuthenticatorActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(OPTION_URL, parsedPage.getURL().toString()); intent.putExtra(OPTION_PAGE, parsedPage.getHtml()); toIntent(intent); debug("Starting activity for intent:" + intent.toString()); startActivity(intent); } }
From source file:com.android.deskclock.timer.TimerReceiver.java
@Override public void onReceive(final Context context, final Intent intent) { if (Timers.LOGGING) { Log.v(TAG, "Received intent " + intent.toString()); }// w ww.j av a 2s .com String actionType = intent.getAction(); // This action does not need the timers data if (Timers.NOTIF_IN_USE_CANCEL.equals(actionType)) { cancelInUseNotification(context); return; } // Get the updated timers data. if (mTimers == null) { mTimers = new ArrayList<>(); } SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); TimerObj.getTimersFromSharedPrefs(prefs, mTimers); if (AlarmService.PRE_SHUTDOWN_ACTION.equals(actionType)) { // Stop Ringtone if all timers are not in times-up status TimerObj timerRing = Timers.findExpiredTimer(mTimers); if (timerRing != null) { timerRing.mState = TimerObj.STATE_STOPPED; stopRingtoneIfNoTimesup(context); } return; } // These actions do not provide a timer ID, but do use the timers data if (Timers.NOTIF_IN_USE_SHOW.equals(actionType)) { showInUseNotification(context); return; } else if (Timers.NOTIF_TIMES_UP_SHOW.equals(actionType)) { showTimesUpNotification(context); return; } else if (Timers.NOTIF_TIMES_UP_CANCEL.equals(actionType)) { cancelTimesUpNotification(context); return; } // Remaining actions provide a timer Id if (!intent.hasExtra(Timers.TIMER_INTENT_EXTRA)) { // No data to work with, do nothing Log.e(TAG, "got intent without Timer data"); return; } // Get the timer out of the Intent int timerId = intent.getIntExtra(Timers.TIMER_INTENT_EXTRA, -1); if (timerId == -1) { Log.d(TAG, "OnReceive:intent without Timer data for " + actionType); } TimerObj t = Timers.findTimer(mTimers, timerId); if (Timers.TIMES_UP.equals(actionType)) { // Find the timer (if it doesn't exists, it was probably deleted). if (t == null) { Log.d(TAG, " timer not found in list - do nothing"); return; } t.setState(TimerObj.STATE_TIMESUP); t.writeToSharedPref(prefs); Events.sendEvent(R.string.category_timer, R.string.action_fire, 0); /// M: We acquire the lock here because in some rare scenario, the wake lock is release /// by alarm before it could be acquired by Timer activity causing state to be suspended AlarmAlertWakeLock.acquireScreenCpuWakeLock(context); // Play ringtone by using TimerRingService service with a default alarm. Log.d(TAG, "playing ringtone"); Intent si = new Intent(); si.setClass(context, TimerRingService.class); context.startService(si); // Update the in-use notification if (getNextRunningTimer(mTimers, false, Utils.getTimeNow()) == null) { // Found no running timers. cancelInUseNotification(context); } else { showInUseNotification(context); } /** * M: To show time up notification to avoid the case: pausing the * current activity(eg: touch home key) when time is up, it cause * the TimerAlertFullScreen can not be started, and this cause no * notification in status bar but the timer has sound. @{ */ Utils.showTimesUpNotifications(context); /** @} */ // Start the TimerAlertFullScreen activity. Intent timersAlert = new Intent(context, TimerAlertFullScreen.class); timersAlert.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_USER_ACTION); context.startActivity(timersAlert); } else if (Timers.RESET_TIMER.equals(actionType) || Timers.DELETE_TIMER.equals(actionType) || Timers.TIMER_DONE.equals(actionType)) { // Stop Ringtone if all timers are not in times-up status stopRingtoneIfNoTimesup(context); if (t != null) { cancelTimesUpNotification(context, t); } } else if (Timers.NOTIF_TIMES_UP_STOP.equals(actionType)) { // Find the timer (if it doesn't exists, it was probably deleted). if (t == null) { Log.d(TAG, "timer to stop not found in list - do nothing"); return; } else if (t.mState != TimerObj.STATE_TIMESUP) { Log.d(TAG, "action to stop but timer not in times-up state - do nothing"); return; } // Update timer state t.setState(t.getDeleteAfterUse() ? TimerObj.STATE_DELETED : TimerObj.STATE_RESTART); t.mTimeLeft = t.mOriginalLength = t.mSetupLength; t.writeToSharedPref(prefs); // Flag to tell DeskClock to re-sync with the database prefs.edit().putBoolean(Timers.REFRESH_UI_WITH_LATEST_DATA, true).apply(); cancelTimesUpNotification(context, t); // Done with timer - delete from data base if (t.getDeleteAfterUse()) { t.deleteFromSharedPref(prefs); } // Stop Ringtone if no timers are in times-up status stopRingtoneIfNoTimesup(context); } else if (Timers.NOTIF_TIMES_UP_PLUS_ONE.equals(actionType)) { // Find the timer (if it doesn't exists, it was probably deleted). if (t == null) { Log.d(TAG, "timer to +1m not found in list - do nothing"); return; } else if (t.mState != TimerObj.STATE_TIMESUP) { Log.d(TAG, "action to +1m but timer not in times up state - do nothing"); return; } // Restarting the timer with 1 minute left. t.setState(TimerObj.STATE_RUNNING); t.mStartTime = Utils.getTimeNow(); t.mTimeLeft = t.mOriginalLength = TimerObj.MINUTE_IN_MILLIS; t.writeToSharedPref(prefs); // Flag to tell DeskClock to re-sync with the database prefs.edit().putBoolean(Timers.REFRESH_UI_WITH_LATEST_DATA, true).apply(); cancelTimesUpNotification(context, t); // If the app is not open, refresh the in-use notification if (!prefs.getBoolean(Timers.NOTIF_APP_OPEN, false)) { showInUseNotification(context); } // Stop Ringtone if no timers are in times-up status stopRingtoneIfNoTimesup(context); } else if (Timers.TIMER_UPDATE.equals(actionType)) { // Find the timer (if it doesn't exists, it was probably deleted). if (t == null) { Log.d(TAG, " timer to update not found in list - do nothing"); return; } // Refresh buzzing notification if (t.mState == TimerObj.STATE_TIMESUP) { // Must cancel the previous notification to get all updates displayed correctly cancelTimesUpNotification(context, t); showTimesUpNotification(context, t); } } if (intent.getBooleanExtra(Timers.UPDATE_NEXT_TIMESUP, true)) { // Update the next "Times up" alarm unless explicitly told not to. updateNextTimesup(context); } }
From source file:com.example.itsatrap.app.GcmIntentService.java
@Override protected void onHandleIntent(Intent otherIntent) { // Log.d(TAG, "old intent to string: " + otherIntent.toString()); ComponentName comp = new ComponentName(com.example.itsatrap.app.MapActivity.PACKAGE_NAME, com.example.itsatrap.app.MapActivity.class.getName()); // Log.d(TAG, "handling intent."); // otherIntent.setAction(BROADCAST_ACTION); // otherIntent.setComponent(comp); // Log.d(TAG, "intent action: " + otherIntent.getAction()); Log.d(TAG, "other intent to string: " + otherIntent.toString()); Bundle otherBundle = otherIntent.getExtras(); try {/*from ww w . ja va2 s . com*/ this.intent.putExtras(otherBundle); } catch (NullPointerException e) { } Log.d(TAG, "intent to string: " + intent.toString()); sendBroadcast(intent); // Bundle extras = intent.getExtras(); // GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); // // The getMessageType() intent parameter must be the intent you received // // in your BroadcastReceiver. // String messageType = gcm.getMessageType(intent); // // if (!extras.isEmpty()) { // has effect of unparcelling Bundle // /* // * Filter messages based on message type. Since it is likely that GCM will be // * extended in the future with new message types, just ignore any message types you're // * not interested in, or that you don't recognize. // */ // if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) { // sendNotification("Send error: " + extras.toString()); // } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)) { // sendNotification("Deleted messages on server: " + extras.toString()); // // If it's a regular GCM message, do some work. // } else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) { // // This loop represents the service doing some work. // for (int i = 0; i < 5; i++) { // Log.i(TAG, "Working... " + (i + 1) // + "/5 @ " + SystemClock.elapsedRealtime()); // try { // Thread.sleep(5000); // } catch (InterruptedException e) { // } // } // Log.i(TAG, "Completed work @ " + SystemClock.elapsedRealtime()); // // Post notification of received message. // sendNotification("Received: " + extras.toString()); // Log.i(TAG, "Received: " + extras.toString()); // } // } // // Release the wake lock provided by the WakefulBroadcastReceiver. // GcmBroadcastReceiver.completeWakefulIntent(intent); }
From source file:com.owncloud.android.ui.activity.ShareActivity.java
@Override protected void onNewIntent(Intent intent) { // Verify the action and get the query if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); Log_OC.w(TAG, "Ignored Intent requesting to query for " + query); } else if (UsersAndGroupsSearchProvider.ACTION_SHARE_WITH.equals(intent.getAction())) { Uri data = intent.getData();//from w w w . j a v a 2s . c o m doShareWith(data.getLastPathSegment(), UsersAndGroupsSearchProvider.DATA_GROUP.equals(data.getAuthority())); } else { Log_OC.wtf(TAG, "Unexpected intent " + intent.toString()); } }
From source file:net.wrolf.android.outages.OutageListFragment.java
/** * Load an outage in the default browser when selected by the user. *///www. j av a 2s . co m @Override public void onListItemClick(ListView listView, View view, int position, long id) { super.onListItemClick(listView, view, position, id); // Get a URI for the selected item, then start an Activity that displays the URI. Any // Activity that filters for ACTION_VIEW and a URI can accept this. In most cases, this will // be a browser. // Get the item at the selected position, in the form of a Cursor. Cursor c = (Cursor) mAdapter.getItem(position); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity()); String method = sharedPref.getString("method_list", ""); String server = sharedPref.getString("server", ""); String prefix; if (method.equals("http")) { prefix = "http://" + server; } else if (method.equals("https")) { prefix = "https://" + server; } else if (method.equals("http8960")) { prefix = "http://" + server + ":8960"; } else { // method == https8443 prefix = "https://" + server + ":8443"; } String outageUrlString = prefix + "/opennms/outage/detail.htm?id=" + Long.toString(c.getLong(COLUMN_OUTAGE_ID)); Log.i(TAG, "Opening URL: " + outageUrlString); final String user = sharedPref.getString("user", ""); Log.d(TAG, "user: " + user); final String password = sharedPref.getString("password", ""); Log.d(TAG, "password: " + password); Uri outageURI = Uri.parse(outageUrlString); Intent i = new Intent(Intent.ACTION_VIEW, outageURI); String authorization = user + ":" + password; String authorizationBase64 = Base64.encodeToString(authorization.getBytes(), 0); Bundle bundle = new Bundle(); bundle.putString("Authorization", "Basic " + authorizationBase64); i.putExtra(Browser.EXTRA_HEADERS, bundle); Log.d(TAG, "intent:" + i.toString()); startActivity(i); }
From source file:org.y20k.trackbook.MainActivity.java
private void handleIncomingIntent() { Intent intent = getIntent(); LogHelper.v(LOG_TAG, "Main Activity received intent. Content: " + intent.toString()); String intentAction = intent.getAction(); switch (intentAction) { case ACTION_SHOW_MAP: // show map fragment mSelectedTab = FRAGMENT_ID_MAP;/* ww w . ja v a 2s.c om*/ mViewPager.setCurrentItem(mSelectedTab); // clear intent intent.setAction(ACTION_DEFAULT); break; default: break; } }