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:com.example.qrcode.BarcodeScanner.java
/** * Starts an intent to scan and decode a barcode. *//* w ww . ja v a 2 s . c o m*/ public void scan(JSONArray args) { Intent intentScan = new Intent(SCAN_INTENT); intentScan.addCategory(Intent.CATEGORY_DEFAULT); // add config as intent extras if (args.length() > 0) { JSONObject obj; JSONArray names; String key; Object value; for (int i = 0; i < args.length(); i++) { try { obj = args.getJSONObject(i); } catch (JSONException e) { Log.i("CordovaLog", e.getLocalizedMessage()); continue; } names = obj.names(); for (int j = 0; j < names.length(); j++) { try { key = names.getString(j); value = obj.get(key); if (value instanceof Integer) { intentScan.putExtra(key, (Integer) value); } else if (value instanceof String) { intentScan.putExtra(key, (String) value); } } catch (JSONException e) { Log.i("CordovaLog", e.getLocalizedMessage()); continue; } } } } // avoid calling other phonegap apps intentScan.setPackage(this.cordova.getActivity().getApplicationContext().getPackageName()); this.cordova.startActivityForResult((CordovaPlugin) this, intentScan, REQUEST_CODE); }
From source file:com.android.stockbrowser.search.OpenSearchSearchEngine.java
public void startSearch(Context context, String query, Bundle appData, String extraData) { String uri = mSearchEngineInfo.getSearchUriForQuery(query); if (uri == null) { Log.e(TAG, "Unable to get search URI for " + mSearchEngineInfo); } else {// ww w.j ava 2 s .co m Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); // Make sure the intent goes to the StockBrowser itself intent.setPackage(context.getPackageName()); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra(SearchManager.QUERY, query); if (appData != null) { intent.putExtra(SearchManager.APP_DATA, appData); } if (extraData != null) { intent.putExtra(SearchManager.EXTRA_DATA_KEY, extraData); } intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName()); context.startActivity(intent); } }
From source file:com.android.browser.search.OpenSearchSearchEngine.java
public void startSearch(Context context, String query, Bundle appData, String extraData) { String uri = mSearchEngineInfo.getSearchUriForQuery(query); if (uri == null) { Log.e(TAG, "Unable to get search URI for " + mSearchEngineInfo); } else {/*w w w . j av a 2 s.c o m*/ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); // Make sure the intent goes to the Browser itself intent.setPackage(context.getPackageName()); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra(SearchManager.QUERY, query); if (appData != null) { intent.putExtra(SearchManager.APP_DATA, appData); } if (extraData != null) { intent.putExtra(SearchManager.EXTRA_DATA_KEY, extraData); } intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName()); context.startActivity(intent); } }
From source file:com.nfc.gemkey.MainActivity.java
@Override public void onCreate(Bundle icicle) { if (DEBUG)// w w w . ja v a2 s .co m Log.d(TAG, "onCreate"); super.onCreate(icicle); setContentView(R.layout.activity_main); mAdapter = NfcAdapter.getDefaultAdapter(this); // Create a generic PendingIntent that will be deliver to this activity. The NFC stack // will fill in the intent with the details of the discovered tag before delivering to // this activity. mPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); // Setup an intent filter for all MIME based dispatches IntentFilter tagDetected = new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED); tagDetected.addCategory(Intent.CATEGORY_DEFAULT); mFilters = new IntentFilter[] { tagDetected }; mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE); mPermissionIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0); IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION); filter.addAction(UsbManager.ACTION_USB_ACCESSORY_DETACHED); registerReceiver(mUsbReceiver, filter); if (getLastNonConfigurationInstance() != null) { Log.i(TAG, "open usb accessory@onCreate"); mAccessory = (UsbAccessory) getLastNonConfigurationInstance(); openAccessory(mAccessory); } buttonLED = (ToggleButton) findViewById(R.id.nfc_btn); buttonLED.setBackgroundResource( buttonLED.isChecked() ? R.drawable.btn_toggle_yes : R.drawable.btn_toggle_no); buttonLED.setOnCheckedChangeListener(mKeyLockListener); tagId = (TextView) findViewById(R.id.nfc_tag); tagId.setText(R.string.nfc_scan_tag); // Avoid NetworkOnMainThreadException StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites() .detectNetwork().penaltyLog().build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects() .detectLeakedClosableObjects().penaltyLog().penaltyDeath().build()); setVolumeControlStream(AudioManager.STREAM_MUSIC); }
From source file:com.borqs.browser.search.OpenSearchSearchEngine.java
public void startSearch(Context context, String query, Bundle appData, String extraData) { Log.i("OpenSearchSearchEng", "startSearch, query: " + query); String uri = mSearchEngineInfo.getSearchUriForQuery(query); if (uri == null) { Log.e(TAG, "Unable to get search URI for " + mSearchEngineInfo); } else {/*from w ww.j av a2s.c om*/ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); // Make sure the intent goes to the Browser itself intent.setPackage(context.getPackageName()); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra(SearchManager.QUERY, query); if (appData != null) { intent.putExtra(SearchManager.APP_DATA, appData); } if (extraData != null) { intent.putExtra(SearchManager.EXTRA_DATA_KEY, extraData); } intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName()); context.startActivity(intent); } }
From source file:org.sufficientlysecure.keychain.ui.PassphraseWizardActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getActionBar() != null) { getActionBar().setTitle(R.string.unlock_method); }//w w w . j av a 2 s .c o m selectedAction = getIntent().getAction(); if (savedInstanceState == null) { SelectMethods selectMethods = new SelectMethods(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.fragmentContainer, selectMethods).commit(); } setContentView(R.layout.passphrase_wizard); adapter = NfcAdapter.getDefaultAdapter(this); if (adapter != null) { pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, PassphraseWizardActivity.class).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); IntentFilter tagDetected = new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED); tagDetected.addCategory(Intent.CATEGORY_DEFAULT); writeTagFilters = new IntentFilter[] { tagDetected }; } }
From source file:io.indy.drone.service.ScheduledService.java
@Override protected void onHandleIntent(Intent intent) { ifd("onHandleIntent"); boolean isPullToRefresh = intent.getBooleanExtra(StrikeListActivity.ResponseReceiver.IS_PTR, false); if (isPullToRefresh) { ifd("invoked service via pull to refresh"); }//w w w . ja v a 2 s . c om mDatabase = new SQLDatabase(this); // called by a repeating alarm so update sharedpreferences with the current time updateAlarmTime(); try { int serverCount = fetchStrikesCount(); int localCount = mDatabase.getNumStrikes(); if (localCount == 0) { ifd("localCount == 0"); return; } if (localCount < serverCount) { // there's new strike data in the server ifd("new strike data found on server"); JSONArray jsonStrikes = fetchNewStrikes(localCount); if (jsonStrikes == null) { ifd("fetching new strike data returned null"); return; } ifd("adding strike data to local db"); addStrikes(jsonStrikes); // event to inform list that new strike data is in the db EventBus.getDefault().post(new UpdatedDatabaseEvent()); // create a notification if (!isPullToRefresh) { createNotification(); } } else { ifd("serverCount (" + serverCount + ") not greater than localCount (" + localCount + ")"); } if (isPullToRefresh) { Intent broadcastIntent = new Intent(); broadcastIntent.setAction(StrikeListActivity.ResponseReceiver.ACTION_RESP); broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT); int diff = serverCount - localCount; broadcastIntent.putExtra(StrikeListActivity.ResponseReceiver.STRIKE_DIFF, diff); sendBroadcast(broadcastIntent); } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.android.settings.SettingsLicenseActivity.java
private void showHtmlFromUri(Uri uri) { // Kick off external viewer due to WebView security restrictions; we // carefully point it at HTMLViewer, since it offers to decompress // before viewing. final Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(uri, "text/html"); intent.putExtra(Intent.EXTRA_TITLE, getString(R.string.settings_license_activity_title)); if (ContentResolver.SCHEME_CONTENT.equals(uri.getScheme())) { intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); }/*from w w w. java2 s. c o m*/ intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setPackage("com.android.htmlviewer"); try { startActivity(intent); finish(); } catch (ActivityNotFoundException e) { Log.e(TAG, "Failed to find viewer", e); showErrorAndFinish(); } }
From source file:org.wso2.app.catalog.services.AppCatalogService.java
private void sendBroadcast(String status, String payload) { Intent broadcastIntent = new Intent(); broadcastIntent.setAction(Constants.ACTION_RESPONSE); broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT); broadcastIntent.putExtra(INTENT_KEY_STATUS, status); broadcastIntent.putExtra(INTENT_KEY_PAYLOAD, payload); sendBroadcast(broadcastIntent);//from w w w. j av a 2s .com }
From source file:com.orange.essentials.otb.ui.OtbDataFragment.java
/** * provide access to App permission screen (intent out of the fragment) */// w w w . j a va 2 s . c o m private void gotoPermissions() { /** Code to access to the details settings of the package name */ Intent i = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS); i.addCategory(Intent.CATEGORY_DEFAULT); i.setData(Uri.parse("package:" + TrustBadgeManager.INSTANCE.getApplicationPackageName())); TrustBadgeManager.INSTANCE.getEventTagger().tag(EventType.TRUSTBADGE_GO_TO_SETTINGS); getContext().startActivity(i); }