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:org.cloudsky.cordovaPlugins.BarcodeminCDV.java
/** * Starts an intent to scan and decode a barcode. *//*from w ww. j av a 2s. c o m*/ public void scan(final JSONArray args) { final CordovaPlugin that = this; cordova.getThreadPool().execute(new Runnable() { public void run() { 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()); } } intentScan.putExtra(Intents.Scan.CAMERA_ID, obj.optBoolean(PREFER_FRONTCAMERA, false) ? 1 : 0); intentScan.putExtra(Intents.Scan.SHOW_FLIP_CAMERA_BUTTON, obj.optBoolean(SHOW_FLIP_CAMERA_BUTTON, false)); if (obj.has(FORMATS)) { intentScan.putExtra(Intents.Scan.FORMATS, obj.optString(FORMATS)); } if (obj.has(PROMPT)) { intentScan.putExtra(Intents.Scan.PROMPT_MESSAGE, obj.optString(PROMPT)); } //if (obj.has(ORIENTATION)) { //intentScan.putExtra(Intents.Scan.ORIENTATION_LOCK, obj.optString(ORIENTATION)); intentScan.putExtra(Intents.Scan.ORIENTATION_LOCK, "false"); //} } } // avoid calling other phonegap apps intentScan.setPackage(that.cordova.getActivity().getApplicationContext().getPackageName()); that.cordova.startActivityForResult(that, intentScan, REQUEST_CODE); } }); }
From source file:edu.mines.letschat.GcmIntentService.java
@Override protected void onHandleIntent(Intent intent) { Bundle extras = intent.getExtras();//w w w .j a v a 2 s. c o m 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(), "0"); } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)) { sendNotification("Deleted messages on server: " + extras.toString(), "0"); // 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. String message = (String) extras.get("message"); messages.add(message); String picture = (String) extras.get("picture"); String senderID = (String) extras.get("sender"); String recipientID = (String) extras.get("recipient"); sendNotification(message, senderID); Log.v(TAG, "Received: " + message); Log.i(TAG, "Received: " + extras.toString()); Intent resultBroadCastIntent = new Intent(); /*set action here*/ resultBroadCastIntent.setAction( edu.mines.letschat.MessageActivity.TextCapitalizeResultReceiver.ACTION_TEXT_CAPITALIZED); /*set intent category as default*/ resultBroadCastIntent.addCategory(Intent.CATEGORY_DEFAULT); /*add data to intent*/ resultBroadCastIntent.putExtra(OUTPUT_TEXT, message); // Log.v(TAG, "Sender id " + senderID + " recieve id " + recipientID); Log.v(TAG, picture); Conversation convo = new Conversation(getApplicationContext(), senderID, recipientID, message, false, picture); convo.save(); if (!picture.isEmpty()) { new DownloadImage(picture).execute(); } /*send broadcast */ sendBroadcast(resultBroadCastIntent); } } // Release the wake lock provided by the WakefulBroadcastReceiver. GcmBroadcastReviever.completeWakefulIntent(intent); }
From source file:com.asksven.betterbatterystats.PackageFragmentActivity.java
public static void showAppOps(Context context, String packageName) { Intent intent = null;/* w w w . j a v a 2s .c o m*/ // JB if (Build.VERSION.SDK_INT == 18) { intent = new Intent("android.settings.APP_OPS_SETTINGS"); Uri uri = Uri.fromParts(SCHEME, packageName, null); } else if (Build.VERSION.SDK_INT >= 19) { // @see http://brightechno.com/blog/archives/211 intent = new Intent(); intent.setClassName("com.android.settings", "com.android.settings.Settings"); intent.setAction(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); intent.putExtra(":android:show_fragment", "com.android.settings.applications.AppOpsSummary"); } if (intent != null) { try { context.startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(context, context.getString(R.string.message_no_appops), Toast.LENGTH_SHORT).show(); } } }
From source file:com.github.howeyc.slideshow.activities.SettingsActivity.java
@Override protected void onResume() { super.onResume(); if (broadcastManager == null) { broadcastManager = LocalBroadcastManager.getInstance(getApplicationContext()); }/* w w w. ja v a 2s.co m*/ if (receiver == null) { IntentFilter filter = new IntentFilter(); filter.addAction(Keys.ACTION_LOGINSTATUSSUCCESS); filter.addAction(Keys.ACTION_LOGINSTATUSFAILURE); filter.addCategory(Intent.CATEGORY_DEFAULT); receiver = new StatusReceiver(); broadcastManager.registerReceiver(receiver, filter); } }
From source file:gov.wa.wsdot.android.wsdot.ui.TravelTimesFragment.java
@Override public void onResume() { super.onResume(); IntentFilter filter = new IntentFilter("gov.wa.wsdot.android.wsdot.intent.action.TRAVEL_TIMES_RESPONSE"); filter.addCategory(Intent.CATEGORY_DEFAULT); mTravelTimesSyncReceiver = new TravelTimesSyncReceiver(); getActivity().registerReceiver(mTravelTimesSyncReceiver, filter); }
From source file:com.phonegap.plugins.discoverscanar.DiscoverScanAR.java
/** * Starts an intent to scan and decode a barcode. *//*from w w w . j a v a2 s .c o m*/ public void scan() { Intent intentScan = new Intent(SCAN_INTENT); intentScan.addCategory(Intent.CATEGORY_DEFAULT); this.cordova.startActivityForResult((CordovaPlugin) this, intentScan, REQUEST_SCAN_CODE); }
From source file:org.openmidaas.app.services.GCMIntentService.java
@Override protected void onMessage(Context context, Intent message) { Log.d(TAG, "Received push message"); Bundle extras = message.getExtras(); for (String key : extras.keySet()) { Logger.debug(getClass(), "Received key: " + key + " and value as: " + extras.getString(key)); if (key.equals("url")) { if (!extras.getString(key).isEmpty() && extras.getString(key) != null) { Log.d(TAG, "Received key as 'url' and value as " + extras.getString(key)); Intent intent = new Intent(getBaseContext(), SplashActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setAction(Constants.IntentActionMessages.PROCESS_URL); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra("url", extras.getString(key)); //Check for the lock before continuing if (SessionManager.getBusyness() == false) { getApplication().startActivity(intent); } else { Log.d(TAG, "Received push message but won't process the URL as session is locked."); }/*from w ww .j a v a 2s.c o m*/ } else { Log.d(TAG, "Received push message but vaue of key:\"url\" is empty or null. "); } } } }
From source file:com.magnet.mmx.client.MMXWakeupIntentService.java
private void invokeNotificationForPush(GCMPayload payload) { // Launch the activity with action=MAIN, category=DEFAULT. Make sure that // it has DEFAULT category declared in AndroidManifest.xml intent-filter. PendingIntent intent = PendingIntent.getActivity(this.getApplicationContext(), 0, new Intent(Intent.ACTION_MAIN).setPackage(this.getPackageName()) .addCategory(Intent.CATEGORY_DEFAULT) // it is redundant .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED), PendingIntent.FLAG_UPDATE_CURRENT); // If title is not specified, use the app name (compatible with iOS push notification) String title = (payload.getTitle() == null) ? this.getApplicationInfo().name : payload.getTitle(); Notification.Builder noteBuilder = new Notification.Builder(this).setContentIntent(intent) .setAutoCancel(true).setWhen(System.currentTimeMillis()).setContentTitle(title) .setContentText(payload.getBody()); if (payload.getSound() != null) { // TODO: cannot handle custom sound yet; use notification ring tone. noteBuilder.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)); }//from www.ja v a 2 s .c o m if (payload.getIcon() != null) { noteBuilder.setSmallIcon( this.getResources().getIdentifier(payload.getIcon(), "drawable", this.getPackageName())); } else { noteBuilder.setSmallIcon(this.getApplicationInfo().icon); } if (payload.getBadge() != null) { noteBuilder.setNumber(payload.getBadge()); } NotificationManager noteMgr = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); noteMgr.notify(sNoteId++, noteBuilder.build()); }
From source file:universe.constellation.orion.viewer.OrionFileManagerActivity.java
protected void openFile(File file) { Common.d("Opening new book " + file.getPath()); Intent in = new Intent(Intent.ACTION_VIEW); in.setClass(getApplicationContext(), OrionViewerActivity.class); in.setData(Uri.fromFile(file));//from www . ja v a2 s . co m in.addCategory(Intent.CATEGORY_DEFAULT); startActivity(in); }
From source file:org.wso2.app.catalog.AppListActivity.java
private void getAppList() { DialogInterface.OnCancelListener cancelListener = new DialogInterface.OnCancelListener() { @Override/*from w w w . ja v a2s . c om*/ public void onCancel(DialogInterface arg0) { CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context, getResources().getString(R.string.error_app_fetch_failed_detail), getResources().getString(R.string.app_list_failed), getResources().getString(R.string.button_ok), null); } }; progressDialog = CommonDialogUtils.showProgressDialog(context, getResources().getString(R.string.dialog_app_list), getResources().getString(R.string.dialog_please_wait), cancelListener); // Check network connection availability before calling the API. if (CommonUtils.isNetworkAvailable(context)) { ApplicationManager applicationManager = new ApplicationManager(context); if (applicationManager.isPackageInstalled(Constants.AGENT_PACKAGE_NAME)) { btnSignOut.setVisibility(View.GONE); IntentFilter filter = new IntentFilter(Constants.AGENT_APP_ACTION_RESPONSE); filter.addCategory(Intent.CATEGORY_DEFAULT); AgentServiceResponseReceiver receiver = new AgentServiceResponseReceiver(); registerReceiver(receiver, filter); CommonUtils.callAgentApp(context, Constants.Operation.GET_APPLICATION_LIST, null, null); } else { btnSignOut.setVisibility(View.VISIBLE); btnSignOut.setTag(TAG_BTN_SIGN_OUT); btnSignOut.setOnClickListener(onClickListener); getAppListFromServer(); } } else { CommonDialogUtils.stopProgressDialog(progressDialog); CommonDialogUtils.showNetworkUnavailableMessage(context); } }