List of usage examples for android.content Intent setFlags
public @NonNull Intent setFlags(@Flags int flags)
From source file:de.badaix.snapcast.MainActivity.java
@Override public void onPropertiesClicked(ClientItem clientItem) { Intent intent = new Intent(this, ClientSettingsActivity.class); intent.putExtra("client", clientItem.getClient().toJson().toString()); intent.putExtra("streams", serverStatus.getJsonStreams().toString()); intent.setFlags(0); startActivityForResult(intent, CLIENT_PROPERTIES_REQUEST); }
From source file:com.adjust.sdk.ActivityHandler.java
private void launchDeeplinkMain(String deeplink) { if (deeplink == null) return;//from w ww .j a va 2s . c om Uri location = Uri.parse(deeplink); Intent mapIntent = new Intent(Intent.ACTION_VIEW, location); mapIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Verify it resolves PackageManager packageManager = adjustConfig.context.getPackageManager(); List<ResolveInfo> activities = packageManager.queryIntentActivities(mapIntent, 0); boolean isIntentSafe = activities.size() > 0; // Start an activity if it's safe if (!isIntentSafe) { logger.error("Unable to open deep link (%s)", deeplink); return; } logger.info("Open deep link (%s)", deeplink); adjustConfig.context.startActivity(mapIntent); }
From source file:jieehd.villain.updater.VillainUpdater.java
private boolean haveNetworkConnection() { boolean haveConnectedWifi = false; boolean haveConnectedMobile = false; ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo[] netInfo = cm.getAllNetworkInfo(); for (NetworkInfo ni : netInfo) { if (ni.getTypeName().equalsIgnoreCase("WIFI")) if (ni.isConnected()) haveConnectedWifi = true; if (ni.getTypeName().equalsIgnoreCase("MOBILE")) if (ni.isConnected()) haveConnectedMobile = true; }/*from www .j a v a2 s . co m*/ if (haveConnectedWifi == false && haveConnectedMobile == false) { Log.d("Network State", "false"); AlertDialog.Builder alert = new AlertDialog.Builder(VillainUpdater.this); alert.setTitle("No Data Connection!"); alert.setMessage( "You have no data connection, click ok to turn on WiFi or Mobile Data in order to check for OTA updates."); alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // TODO Auto-generated method stub final Intent intent = new Intent(Intent.ACTION_MAIN, null); intent.addCategory(Intent.CATEGORY_LAUNCHER); final ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.wifi.WifiSettings"); intent.setComponent(cn); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub return; } }); alert.show(); } else { download(); } return haveConnectedWifi || haveConnectedMobile; }
From source file:com.ichi2.anki.StudyOptionsFragment.java
private void openReviewer() { Intent reviewer = new Intent(getActivity(), Reviewer.class); if (mFragmented) { startActivityForResult(reviewer, AnkiActivity.REQUEST_REVIEW); } else {/* ww w .j a v a2 s . c om*/ // Go to DeckPicker after studying when not tablet reviewer.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); startActivity(reviewer); getActivity().finish(); } animateLeft(); getCol().startTimebox(); }
From source file:com.amazonaws.mobileconnectors.pinpoint.targeting.notification.NotificationClient.java
private Intent notificationIntent(final Bundle pushBundle, final String campaignId, final int requestId, final String intentAction, final Class<?> targetClass) { final Intent notificationIntent = new Intent(pinpointContext.getApplicationContext(), targetClass); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); notificationIntent.setAction(intentAction); notificationIntent.putExtras(pushBundle); notificationIntent.putExtra(INTENT_SNS_NOTIFICATION_FROM, AWS_EVENT_TYPE_OPENED); notificationIntent.putExtra(CAMPAIGN_ID_PUSH_KEY, campaignId); notificationIntent.putExtra(REQUEST_ID, requestId); notificationIntent.setPackage(pinpointContext.getApplicationContext().getPackageName()); return notificationIntent; }
From source file:com.wso2.mobile.mdm.services.PolicyTester.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public PolicyTester(Context context, JSONArray recJArray, int type, String msgID) { this.context = context; devicePolicyManager = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE); appList = new ApplicationManager(context); deviceInfo = new DeviceInfo(context); deviceState = new PhoneState(context); if (type == POLICY_MONITOR_TYPE_NO_ENFORCE_RETURN) { IS_ENFORCE = false;/*from w ww . j a v a2 s. c o m*/ } else if (type == POLICY_MONITOR_TYPE_NO_ENFORCE_MESSAGE_RETURN) { IS_ENFORCE = false; } else if (type == POLICY_MONITOR_TYPE_ENFORCE_RETURN) { IS_ENFORCE = true; } else { IS_ENFORCE = false; type = POLICY_MONITOR_TYPE_NO_ENFORCE_MESSAGE_RETURN; } SharedPreferences mainPref = context.getSharedPreferences("com.mdm", Context.MODE_PRIVATE); policy = mainPref.getString("policy", ""); try { JSONArray jArray = null; if (recJArray != null) { jArray = recJArray; } else { jArray = new JSONArray(policy); } Log.e("POLICY ARAY : ", jArray.toString()); for (int i = 0; i < jArray.length(); i++) { JSONObject policyObj = (JSONObject) jArray.getJSONObject(i); if (policyObj.getString("data") != null && policyObj.getString("data") != "") { testPolicy(policyObj.getString("code"), policyObj.getString("data")); } } JSONObject rootObj = new JSONObject(); try { if (deviceInfo.isRooted()) { rootObj.put("status", false); } else { rootObj.put("status", true); } rootObj.put("code", "notrooted"); finalArray.put(rootObj); } catch (JSONException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } Log.e("MONITOR POLICY : ", policy); Log.e("MONITOR USER MESSAGE : ", usermessage); //Display an alert to the user about policy violation if (policy != null && policy != "") { if (usermessage != null && usermessage != "" && type == POLICY_MONITOR_TYPE_NO_ENFORCE_MESSAGE_RETURN) { Intent intent = new Intent(context, AlertActivity.class); intent.putExtra("message", usermessage); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } } returnJSON.put("code", CommonUtilities.OPERATION_POLICY_MONITOR); returnJSON.put("data", finalArray); Map<String, String> params = new HashMap<String, String>(); params.put("code", CommonUtilities.OPERATION_POLICY_MONITOR); params.put("msgID", msgID); params.put("status", "200"); params.put("data", finalArray.toString()); ServerUtilities.pushData(params, context); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:com.amazonaws.mobileconnectors.pinpoint.targeting.notification.NotificationClient.java
private void openURL(final String url, final boolean noSchemeValidation) { final String validatedUrl; if (url.startsWith("http://") || url.startsWith("https://") || noSchemeValidation) { validatedUrl = url;/*from ww w . j a v a 2s .co m*/ } else { validatedUrl = "http://" + url; } final Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(validatedUrl)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (intent.resolveActivity(pinpointContext.getApplicationContext().getPackageManager()) != null) { pinpointContext.getApplicationContext().startActivity(intent); } }
From source file:com.android.mms.ui.ConversationList.java
@Override public boolean onContextItemSelected(MenuItem item) { Cursor cursor = mListAdapter.getCursor(); if (cursor != null && cursor.getPosition() >= 0) { Conversation conv = Conversation.from(ConversationList.this, cursor); long threadId = conv.getThreadId(); switch (item.getItemId()) { case MENU_DELETE: { confirmDeleteThread(threadId, mQueryHandler); break; }/* ww w.ja v a 2 s .c o m*/ case MENU_VIEW: { openThread(threadId); break; } case MENU_VIEW_CONTACT: { Contact contact = conv.getRecipients().get(0); Intent intent = new Intent(Intent.ACTION_VIEW, contact.getUri()); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(intent); break; } case MENU_ADD_TO_CONTACTS: { String address = conv.getRecipients().get(0).getNumber(); startActivity(createAddContactIntent(address)); break; } default: break; } } return super.onContextItemSelected(item); }
From source file:com.example.pyrkesa.shwc.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { if (mDrawerLayout.isDrawerOpen(mDrawerList)) { mDrawerLayout.closeDrawer(mDrawerList); } else {/*from ww w .ja v a2s .c o m*/ mDrawerLayout.openDrawer(mDrawerList); } } int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.quit) { Intent intent = new Intent(this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra("Exit me", true); startActivity(intent); } if (id == R.id.log_out) { String android_id = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID); new LogOut().execute(android_id); } return super.onOptionsItemSelected(item); }
From source file:com.teleca.jamendo.activity.PlayerActivity.java
public void homeClickHandler(View target) { Intent intent = new Intent(this, HomeActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);/*from w w w. j a v a2s. com*/ finish(); }