List of usage examples for android.content Intent CATEGORY_DEFAULT
String CATEGORY_DEFAULT
To view the source code for android.content Intent CATEGORY_DEFAULT.
Click Source Link
From source file:syncthing.android.ui.sessionsettings.EditDevicePresenter.java
public void startQRScannerActivity(View btn) { Intent intentScan = new Intent("com.google.zxing.client.android.SCAN"); intentScan.addCategory(Intent.CATEGORY_DEFAULT); intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); try {// w w w .j av a2s . co m activityResultsController.startActivityForResult(intentScan, ActivityRequestCodes.SCAN_QR, null); } catch (ActivityNotFoundException e) { if (hasView()) { dialogPresenter.showDialog(context -> new AlertDialog.Builder(context).setTitle(R.string.error) .setMessage(R.string.no_qr_scanner_installed).setPositiveButton(android.R.string.ok, null) .create()); } } }
From source file:library.artaris.cn.library.utils.SystemUtils.java
/** * ???/*from w w w . j a va 2 s . com*/ * @param context * @return */ public static List<ResolveInfo> getShareTargets(Context context) { Intent intent = new Intent(Intent.ACTION_SEND, null); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setType("text/plain"); PackageManager pm = context.getPackageManager(); return pm.queryIntentActivities(intent, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT); }
From source file:io.rapidpro.androidchannel.RapidPro.java
public static void broadcastUpdatedCounts(Context context) { Intent intent = new Intent(); intent.setAction(Intents.UPDATE_COUNTS); intent.addCategory(Intent.CATEGORY_DEFAULT); int sent = RapidPro.get().getTotalSent(); int capacity = RapidPro.get().getSendCapacity(); int outgoing = DBCommandHelper.getCommandCount(context, DBCommandHelper.IN, DBCommandHelper.BORN, MTTextMessage.CMD)//from ww w . j ava2 s . co m + DBCommandHelper.getCommandCount(context, DBCommandHelper.IN, MTTextMessage.PENDING, MTTextMessage.CMD); int incoming = DBCommandHelper.getMessagesReceivedInWindow(context); int retry = DBCommandHelper.getCommandCount(context, DBCommandHelper.IN, MTTextMessage.RETRY, MTTextMessage.CMD); int sync = DBCommandHelper.getCommandCount(context, DBCommandHelper.OUT, DBCommandHelper.BORN, null); intent.putExtra(Intents.SENT_EXTRA, sent); intent.putExtra(Intents.CAPACITY_EXTRA, capacity); intent.putExtra(Intents.OUTGOING_EXTRA, outgoing); intent.putExtra(Intents.INCOMING_EXTRA, incoming); intent.putExtra(Intents.RETRY_EXTRA, retry); intent.putExtra(Intents.SYNC_EXTRA, sync); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); intent.putExtra(Intents.CONNECTION_UP_EXTRA, prefs.getBoolean(SettingsActivity.CONNECTION_UP, true)); intent.putExtra(Intents.LAST_SMS_SENT, prefs.getLong(SettingsActivity.LAST_SMS_SENT, 0)); intent.putExtra(Intents.LAST_SMS_RECEIVED, prefs.getLong(SettingsActivity.LAST_SMS_RECEIVED, 0)); intent.putExtra(Intents.IS_PAUSED, prefs.getBoolean(SettingsActivity.IS_PAUSED, false)); context.sendBroadcast(intent); }
From source file:es.ugr.swad.swadroid.modules.notifications.Notifications.java
@Override protected void onResume() { super.onResume(); SWADroidTracker.sendScreenView(getApplicationContext(), TAG); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(NotificationsSyncAdapterService.START_SYNC); intentFilter.addAction(NotificationsSyncAdapterService.STOP_SYNC); intentFilter.addAction(Intent.CATEGORY_DEFAULT); registerReceiver(receiver, intentFilter); Log.i(TAG, "Registered receiver for automatic synchronization"); refreshScreen();//from w ww . ja v a 2 s . c om }
From source file:foundme.uniroma2.it.professore.HomeActivity.java
public static void setupForegroundDispatch(final Activity activity, NfcAdapter adapter) { final Intent intent = new Intent(activity.getApplicationContext(), activity.getClass()); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); final PendingIntent pendingIntent = PendingIntent.getActivity(activity.getApplicationContext(), 0, intent, 0);//ww w . jav a 2s .c o m IntentFilter[] filters = new IntentFilter[1]; String[][] techList = new String[][] {}; //Stesso filtro del Manifest. filters[0] = new IntentFilter(); filters[0].addAction(NfcAdapter.ACTION_NDEF_DISCOVERED); filters[0].addCategory(Intent.CATEGORY_DEFAULT); try { filters[0].addDataType(Variables_it.MIME_TEXT_PLAIN); } catch (IntentFilter.MalformedMimeTypeException e) { throw new RuntimeException(Variables_it.MIME_ERROR); } adapter.enableForegroundDispatch(activity, pendingIntent, filters, techList); }
From source file:org.universAAL.android.proxies.ServiceCalleeProxy.java
@Override public void handleRequest(BusMessage m) { ServiceCall call = (ServiceCall) m.getContent(); // Extract the origin action and category from the call String fromAction = (String) call.getNonSemanticInput(AppConstants.UAAL_META_PROP_FROMACTION); String fromCategory = (String) call.getNonSemanticInput(AppConstants.UAAL_META_PROP_FROMCATEGORY); Boolean needsOuts = (Boolean) call.getNonSemanticInput(AppConstants.UAAL_META_PROP_NEEDSOUTPUTS); boolean isNonIntrusive = fromAction != null && fromAction.equals(action) && fromCategory != null && fromCategory.equals(category); // This means the serv Intent in the caller proxy is the same as the // serv Intent in destination native app. Therefore the destination will // already have received it and we must not send the intent to avoid // duplication or infinite loops. if (!isNonIntrusive) { // In this case the serv intents are different because the origin // action+cat is being used as a kind of API to call the SCaller. // In this case we have to relay the call to the destination native app. Context ctxt = contextRef.get(); if (ctxt != null) { // Prepare an intent for sending to Android grounded service Intent serv = new Intent(action); serv.addCategory(category);//from ww w . j av a 2s . c o m boolean expecting = false; // If a response is expected, prepare a callback receiver (which must be called by uaalized app) if ((replyAction != null && !replyAction.isEmpty()) && (replyCategory != null && !replyCategory.isEmpty())) { // Tell the destination where to send the reply serv.putExtra(AppConstants.ACTION_META_REPLYTOACT, replyAction); serv.putExtra(AppConstants.ACTION_META_REPLYTOCAT, replyCategory); // Register the receiver for the reply receiver = new ServiceCalleeProxyReceiver(m);// TODO Can only handle 1 call at a time per proxy IntentFilter filter = new IntentFilter(replyAction); filter.addCategory(replyCategory); ctxt.registerReceiver(receiver, filter); expecting = true; } else if (needsOuts != null && needsOuts.booleanValue()) { // No reply* fields set, but caller still needs a response, // lets build one (does not work for callers outside android MW) Random r = new Random(); String action = AppConstants.ACTION_REPLY + r.nextInt(); serv.putExtra(AppConstants.ACTION_META_REPLYTOACT, action); serv.putExtra(AppConstants.ACTION_META_REPLYTOCAT, Intent.CATEGORY_DEFAULT); // Register the receiver for the reply receiver = new ServiceCalleeProxyReceiver(m); IntentFilter filter = new IntentFilter(action); filter.addCategory(Intent.CATEGORY_DEFAULT); ctxt.registerReceiver(receiver, filter); expecting = true; } // Take the inputs from the call and put them in the intent if (inputURItoExtraKEY != null && !inputURItoExtraKEY.isEmpty()) { VariableSubstitution.putCallInputsAsIntentExtras(call, serv, inputURItoExtraKEY); } // Flag to avoid feeding back the intent to bus when intent is the same in app and in callerproxy serv.putExtra(AppConstants.ACTION_META_FROMPROXY, true); // Send the intent to Android grounded service ComponentName started = ctxt.startService(serv);//Not allowed in Android 5.0 (fall back to broadcast) if (started == null) { // No android service was there, try with broadcast. Before, here it used to send failure response ctxt.sendBroadcast(serv); // No way to know if received. If no response, bus will timeout (?) } else if (!expecting) { // There is no receiver waiting a response, send success now ServiceResponse resp = new ServiceResponse(CallStatus.succeeded); sendResponse(m, resp); } //TODO Handle timeout } } }
From source file:de.uni_koblenz_landau.apow.PatientListActivity.java
/** * Start scanning for NFC tags./*from w ww .j a v a 2 s . c o m*/ * @param activity The Activity requesting to the foreground dispatch. * @param adapter The NfcAdapter used for the foreground dispatch. */ private static void setupForegroundDispatch(final Activity activity, NfcAdapter adapter) { if (adapter != null) { // Add intents for NFC. final Intent intent = new Intent(activity.getApplicationContext(), activity.getClass()); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); final PendingIntent pendingIntent = PendingIntent.getActivity(activity.getApplicationContext(), 0, intent, 0); IntentFilter[] filters = new IntentFilter[1]; String[][] techList = new String[][] {}; filters[0] = new IntentFilter(); filters[0].addAction(NfcAdapter.ACTION_TAG_DISCOVERED); filters[0].addCategory(Intent.CATEGORY_DEFAULT); adapter.enableForegroundDispatch(activity, pendingIntent, filters, techList); } }
From source file:de.uni_koblenz_landau.apow.LoginActivity.java
/** * Start scanning for NFC tags./*from ww w. j a v a 2s. c o m*/ * @param activity The Activity requesting to the foreground dispatch. * @param adapter The NfcAdapter used for the foreground dispatch. */ private static void setupForegroundDispatch(final Activity activity, NfcAdapter adapter) { if (adapter != null) { // Add intents for NFC. final Intent intent = new Intent(activity.getApplicationContext(), activity.getClass()); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); final PendingIntent pendingIntent = PendingIntent.getActivity(activity.getApplicationContext(), 0, intent, 0); IntentFilter[] filters = new IntentFilter[1]; String[][] techList = new String[][] {}; filters[0] = new IntentFilter(); filters[0].addAction(NfcAdapter.ACTION_NDEF_DISCOVERED); filters[0].addCategory(Intent.CATEGORY_DEFAULT); try { filters[0].addDataType(MIME_TEXT_PLAIN); } catch (MalformedMimeTypeException e) { e.printStackTrace(); } adapter.enableForegroundDispatch(activity, pendingIntent, filters, techList); } }
From source file:com.vuze.android.remote.AndroidUtils.java
public static void openFileChooser(Activity activity, String mimeType, int requestCode) { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType(mimeType);/* ww w . ja v a2 s . c o m*/ intent.addCategory(Intent.CATEGORY_OPENABLE); // special intent for Samsung file manager Intent sIntent = new Intent("com.sec.android.app.myfiles.PICK_DATA"); sIntent.putExtra("CONTENT_TYPE", mimeType); sIntent.addCategory(Intent.CATEGORY_DEFAULT); Intent chooserIntent; if (activity.getPackageManager().resolveActivity(sIntent, 0) != null) { chooserIntent = Intent.createChooser(sIntent, "Open file"); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] { intent }); } else { chooserIntent = Intent.createChooser(intent, "Open file"); } if (chooserIntent != null) { try { activity.startActivityForResult(chooserIntent, requestCode); return; } catch (android.content.ActivityNotFoundException ex) { } } Toast.makeText(activity.getApplicationContext(), activity.getResources().getString(R.string.no_file_chooser), Toast.LENGTH_SHORT).show(); }
From source file:se.leap.bitmaskclient.ProviderAPI.java
/** * Sets up an intent with the progress value passed as a parameter * and sends it as a broadcast./*from w w w . j a v a 2s .co m*/ * * @param progress */ private void broadcastProgress(int progress) { Intent intentUpdate = new Intent(); intentUpdate.setAction(UPDATE_PROGRESSBAR); intentUpdate.addCategory(Intent.CATEGORY_DEFAULT); intentUpdate.putExtra(CURRENT_PROGRESS, progress); sendBroadcast(intentUpdate); }