List of usage examples for android.content Intent toString
@Override
public String toString()
From source file:uk.ac.horizon.ug.exploding.client.logging.ActivityLogger.java
public void logStartActivityIfNeeded(Intent intent, int requestCode) { log("startActivityIfNeeded", "intent", intent.toString()); }
From source file:uk.ac.horizon.ug.exploding.client.logging.ActivityLogger.java
public void logStartActivityForResult(Intent intent, int requestCode) { log("startActivityForResult", "intent", intent.toString()); }
From source file:uk.ac.horizon.ug.exploding.client.logging.ActivityLogger.java
public void logStartActivityFromChild(Activity child, Intent intent, int requestCode) { log("startActivityFromChild", "intent", intent.toString()); }
From source file:org.godotengine.godot.storage.Storage.java
public void init(FirebaseApp firebaseApp) { mFirebaseApp = firebaseApp;/* www . j a v a 2 s . c o m*/ // Local broadcast receiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Utils.d("SD:OnReceive:" + intent.toString()); // hideProgressDialog(); // Hiding our progress dialog switch (intent.getAction()) { case DownloadService.DOWNLOAD_COMPLETED: // Get number of bytes downloaded long numBytes = intent.getLongExtra(DownloadService.EXTRA_BYTES_DOWNLOADED, 0); // Alert success // activity.getString(R.string.success), /** showMessageDialog("Success", String.format(Locale.getDefault(), "%d bytes downloaded from %s", numBytes, intent.getStringExtra(DownloadService.EXTRA_DOWNLOAD_PATH))); **/ break; case DownloadService.DOWNLOAD_ERROR: // Alert failure /** showMessageDialog("Error", String.format(Locale.getDefault(), "Failed to download from %s", intent.getStringExtra(DownloadService.EXTRA_DOWNLOAD_PATH))); **/ break; // case MyUploadService.UPLOAD_COMPLETED: // case MyUploadService.UPLOAD_ERROR: // onUploadResultIntent(intent); // break; } } }; onStart(); Utils.d("Initilaized Storage"); }
From source file:com.android.my.calendar.alerts.DismissAlarmsService.java
@Override public void onHandleIntent(Intent intent) { if (AlertService.DEBUG) { Log.d(TAG, "onReceive: a=" + intent.getAction() + " " + intent.toString()); }//w w w . j av a2 s . co m long eventId = intent.getLongExtra(AlertUtils.EVENT_ID_KEY, -1); long eventStart = intent.getLongExtra(AlertUtils.EVENT_START_KEY, -1); long eventEnd = intent.getLongExtra(AlertUtils.EVENT_END_KEY, -1); long[] eventIds = intent.getLongArrayExtra(AlertUtils.EVENT_IDS_KEY); long[] eventStarts = intent.getLongArrayExtra(AlertUtils.EVENT_STARTS_KEY); int notificationId = intent.getIntExtra(AlertUtils.NOTIFICATION_ID_KEY, -1); List<AlarmId> alarmIds = new LinkedList<AlarmId>(); Uri uri = CalendarAlerts.CONTENT_URI; String selection; // Dismiss a specific fired alarm if id is present, otherwise, dismiss all alarms if (eventId != -1) { alarmIds.add(new AlarmId(eventId, eventStart)); selection = CalendarAlerts.STATE + "=" + CalendarAlerts.STATE_FIRED + " AND " + CalendarAlerts.EVENT_ID + "=" + eventId; } else if (eventIds != null && eventIds.length > 0 && eventStarts != null && eventIds.length == eventStarts.length) { selection = buildMultipleEventsQuery(eventIds); for (int i = 0; i < eventIds.length; i++) { alarmIds.add(new AlarmId(eventIds[i], eventStarts[i])); } } else { // NOTE: I don't believe that this ever happens. selection = CalendarAlerts.STATE + "=" + CalendarAlerts.STATE_FIRED; } GlobalDismissManager.dismissGlobally(getApplicationContext(), alarmIds); ContentResolver resolver = getContentResolver(); ContentValues values = new ContentValues(); values.put(PROJECTION[COLUMN_INDEX_STATE], CalendarAlerts.STATE_DISMISSED); resolver.update(uri, values, selection, null); // Remove from notification bar. if (notificationId != -1) { NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); nm.cancel(notificationId); } if (SHOW_ACTION.equals(intent.getAction())) { // Show event on Calendar app by building an intent and task stack to start // EventInfoActivity with AllInOneActivity as the parent activity rooted to home. Intent i = AlertUtils.buildEventViewIntent(this, eventId, eventStart, eventEnd); TaskStackBuilder.create(this).addParentStack(EventInfoActivity.class).addNextIntent(i) .startActivities(); } }
From source file:life.kiwi.services.gcm.RegistrationIntentService.java
@Override protected void onHandleIntent(Intent intent) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); Log.d("IntentServices", intent.toString()); try {/*from w ww. j ava2s . c o m*/ // [START register_for_gcm] // Initially this call goes out to the network to retrieve the token, subsequent calls // are local. // R.string.gcm_defaultSenderId (the Sender ID) is typically derived from google-services.json. // See https://developers.google.com/cloud-messaging/android/start for details on this file. // [START get_token] InstanceID instanceID = InstanceID.getInstance(this); String token = instanceID.getToken(getString(R.string.gcm_defaultSenderId), GoogleCloudMessaging.INSTANCE_ID_SCOPE, null); // [END get_token] Log.i(TAG, "GCM Registration Token: " + token); // TODO: Implement this method to send any registration to your app's servers. sendRegistrationToServer(token); // Subscribe to topic channels subscribeTopics(token); // You should store a boolean that indicates whether the generated token has been // sent to your server. If the boolean is false, send the token to your server, // otherwise your server should have already received the token. sharedPreferences.edit().putBoolean(SaveSharedPreference.SENT_TOKEN_TO_SERVER, true).apply(); // [END register_for_gcm] } catch (Exception e) { Log.d(TAG, "Failed to complete token refresh", e); // If an exception happens while fetching the new token or updating our registration data // on a third-party server, this ensures that we'll attempt the update at a later time. sharedPreferences.edit().putBoolean(SaveSharedPreference.SENT_TOKEN_TO_SERVER, false).apply(); } // Notify UI that registration has completed, so the progress indicator can be hidden. Intent registrationComplete = new Intent(SaveSharedPreference.REGISTRATION_COMPLETE); LocalBroadcastManager.getInstance(this).sendBroadcast(registrationComplete); }
From source file:org.androidtitlan.estoesgoogle.service.SyncService.java
@Override protected void onHandleIntent(Intent intent) { Log.d(TAG, "onHandleIntent(intent=" + intent.toString() + ")"); final ResultReceiver receiver = intent.getParcelableExtra(EXTRA_STATUS_RECEIVER); if (receiver != null) receiver.send(STATUS_RUNNING, Bundle.EMPTY); final SharedPreferences prefs = getSharedPreferences(Prefs.IOSCHED_SYNC, Context.MODE_PRIVATE); try {/*from w w w . java 2s . com*/ // Bulk of sync work, performed by executing several fetches from // local sources. // Load static local data mLocalExecutor.execute(R.xml.blocks, new LocalBlocksHandler()); mLocalExecutor.execute(R.xml.speakers, new LocalSpeakersHandler()); mLocalExecutor.execute(R.xml.rooms, new LocalRoomsHandler()); mLocalExecutor.execute(R.xml.tracks, new LocalTracksHandler()); mLocalExecutor.execute(R.xml.search_suggest, new LocalSearchSuggestHandler()); mLocalExecutor.execute(R.xml.sessions, new LocalSessionsHandler()); // Save local parsed version prefs.edit().putInt(Prefs.LOCAL_VERSION, VERSION_CURRENT).commit(); } catch (Exception e) { Log.e(TAG, "Problem while syncing", e); if (receiver != null) { // Pass back error to surface listener final Bundle bundle = new Bundle(); bundle.putString(Intent.EXTRA_TEXT, e.toString()); receiver.send(STATUS_ERROR, bundle); } } // Announce success to any surface listener Log.d(TAG, "sync finished"); if (receiver != null) receiver.send(STATUS_FINISHED, Bundle.EMPTY); }
From source file:com.krayzk9s.imgurholo.activities.ImgurLinkActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); destroyed = false;/*from w w w .jav a 2s . c o m*/ if (getActionBar() != null) getActionBar().setDisplayHomeAsUpEnabled(true); Intent intent = getIntent(); 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(); 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() != null && intent.getData().toString().startsWith("http://imgur.com/a")) { String uri = intent.getData().toString(); album = uri.split("/")[4]; Log.d("album", album); Fetcher fetcher = new Fetcher(this, "/3/album/" + album, ApiCall.GET, null, apiCall, ALBUM); fetcher.execute(); } else if (Intent.ACTION_VIEW.equals(action) && intent.getData().toString().startsWith("http://imgur.com/gallery/")) { String uri = intent.getData().toString(); final String album = uri.split("/")[4]; if (album.length() == 5) { Log.d("album", album); Fetcher fetcher = new Fetcher(this, "/3/album/" + album, ApiCall.GET, null, apiCall, ALBUM); fetcher.execute(); } else if (album.length() == 7) { Log.d("image", album); Fetcher fetcher = new Fetcher(this, "/3/gallery/image/" + album, ApiCall.GET, null, apiCall, IMAGE); fetcher.execute(); } } else if (Intent.ACTION_VIEW.equals(action) && intent.getData().toString().startsWith("http://i.imgur")) { String uri = intent.getData().toString(); final String image = uri.split("/")[3].split("\\.")[0]; Log.d("image", image); Fetcher fetcher = new Fetcher(this, "/3/image/" + image, ApiCall.GET, null, apiCall, IMAGE); fetcher.execute(); } }
From source file:com.goliathonline.android.kegbot.service.SyncService.java
@Override protected void onHandleIntent(Intent intent) { Log.d(TAG, "onHandleIntent(intent=" + intent.toString() + ")"); final ResultReceiver receiver = intent.getParcelableExtra(EXTRA_STATUS_RECEIVER); if (receiver != null) receiver.send(STATUS_RUNNING, Bundle.EMPTY); final Context context = this; final SharedPreferences prefs = getSharedPreferences(Prefs.IOSCHED_SYNC, Context.MODE_PRIVATE); final int localVersion = prefs.getInt(Prefs.LOCAL_VERSION, VERSION_NONE); try {/*from w w w. j a va2s . c om*/ // Bulk of sync work, performed by executing several fetches from // local and online sources. final long startLocal = System.currentTimeMillis(); final boolean localParse = localVersion < VERSION_CURRENT; Log.d(TAG, "found localVersion=" + localVersion + " and VERSION_CURRENT=" + VERSION_CURRENT); if (localParse) { // Parse values from local cache first, since spreadsheet copy // or network might be down. //mLocalExecutor.execute(context, "cache-drinks.json", new RemoteDrinksHandler()); //mLocalExecutor.execute(context, "cache-speakers.xml", new RemoteSpeakersHandler()); //mLocalExecutor.execute(context, "cache-vendors.xml", new RemoteVendorsHandler()); // Save local parsed version prefs.edit().putInt(Prefs.LOCAL_VERSION, VERSION_CURRENT).commit(); } Log.d(TAG, "local sync took " + (System.currentTimeMillis() - startLocal) + "ms"); // Always hit remote spreadsheet for any updates final long startRemote = System.currentTimeMillis(); mRemoteExecutor.executeGet(PrefsHelper.getAPIUrl(getBaseContext()) + "/events", new RemoteJsonHandler(mRemoteExecutor)); Log.d(TAG, "remote sync took " + (System.currentTimeMillis() - startRemote) + "ms"); } catch (Exception e) { Log.e(TAG, "Problem while syncing", e); if (receiver != null) { // Pass back error to surface listener final Bundle bundle = new Bundle(); bundle.putString(Intent.EXTRA_TEXT, e.toString()); receiver.send(STATUS_ERROR, bundle); } } // Announce success to any surface listener Log.d(TAG, "sync finished"); if (receiver != null) receiver.send(STATUS_FINISHED, Bundle.EMPTY); }
From source file:com.google.android.apps.iosched.service.SyncService.java
@Override protected void onHandleIntent(Intent intent) { Log.d(TAG, "onHandleIntent(intent=" + intent.toString() + ")"); final ResultReceiver receiver = intent.getParcelableExtra(EXTRA_STATUS_RECEIVER); if (receiver != null) receiver.send(STATUS_RUNNING, Bundle.EMPTY); final Context context = this; final SharedPreferences prefs = getSharedPreferences(Prefs.IOSCHED_SYNC, Context.MODE_PRIVATE); final int localVersion = prefs.getInt(Prefs.LOCAL_VERSION, VERSION_NONE); try {/*from ww w .j a v a 2s.co m*/ // Bulk of sync work, performed by executing several fetches from // local and online sources. final long startLocal = System.currentTimeMillis(); final boolean localParse = localVersion < VERSION_CURRENT; Log.d(TAG, "found localVersion=" + localVersion + " and VERSION_CURRENT=" + VERSION_CURRENT); if (localParse) { // Load static local data mLocalExecutor.execute(R.xml.blocks, new LocalBlocksHandler()); mLocalExecutor.execute(R.xml.rooms, new LocalRoomsHandler()); mLocalExecutor.execute(R.xml.tracks, new LocalTracksHandler()); mLocalExecutor.execute(R.xml.search_suggest, new LocalSearchSuggestHandler()); mLocalExecutor.execute(R.xml.sessions, new LocalSessionsHandler()); // Parse values from local cache first, since spreadsheet copy // or network might be down. mLocalExecutor.execute(context, "cache-sessions.xml", new RemoteSessionsHandler()); mLocalExecutor.execute(context, "cache-speakers.xml", new RemoteSpeakersHandler()); mLocalExecutor.execute(context, "cache-vendors.xml", new RemoteVendorsHandler()); // Save local parsed version prefs.edit().putInt(Prefs.LOCAL_VERSION, VERSION_CURRENT).commit(); } Log.d(TAG, "local sync took " + (System.currentTimeMillis() - startLocal) + "ms"); // Always hit remote spreadsheet for any updates final long startRemote = System.currentTimeMillis(); mRemoteExecutor.executeGet(WORKSHEETS_URL, new RemoteWorksheetsHandler(mRemoteExecutor)); Log.d(TAG, "remote sync took " + (System.currentTimeMillis() - startRemote) + "ms"); } catch (Exception e) { Log.e(TAG, "Problem while syncing", e); if (receiver != null) { // Pass back error to surface listener final Bundle bundle = new Bundle(); bundle.putString(Intent.EXTRA_TEXT, e.toString()); receiver.send(STATUS_ERROR, bundle); } } // Announce success to any surface listener Log.d(TAG, "sync finished"); if (receiver != null) receiver.send(STATUS_FINISHED, Bundle.EMPTY); }