android-6.0-marshmallow

How to disable captive network assistant into android device?

爷,独闯天下 提交于 2020-03-18 15:44:11
问题 When a user connects to an open WiFi with a Captive Portal, the Android device will open a browser instance with the captive portal/login page. We want to disable it, since we used an app for login purposes. I came across the CaptivePortal Class into Android Marshmallow. Can I use it to disable network? Class Name: android.net.CaptivePortal Method Name: ignoreNetwork How can I use the above class and method to disable auto launch of captive portal on WiFi? 回答1: try this: private void

Image Save to SdCard for 6.0.1 Android Version

别说谁变了你拦得住时间么 提交于 2020-03-06 08:55:30
问题 This code works correctly under 6.0.1 android version but if i run this application on 6.0.1 android devices , it will not save images to sd card. What i need to update for 6.0.1 devices ? public void SaveImages(int a ,String b) { Bitmap bitmap = null; OutputStream output; if(a==0) { bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.image_0); } File filepath = Environment.getExternalStorageDirectory(); // Create a new folder in SD Card File dir = new File(filepath

Android M detect if permission dialog is visible

ぐ巨炮叔叔 提交于 2020-02-21 10:50:29
问题 How can I determine programmatically if a permission dialog is visible to the user so I know what to do in this case? 回答1: @Override protected void onStart() { super.onStart(); ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); ComponentName cn = am.getRunningTasks(1).get(0).topActivity; if ("com.android.packageinstaller.permission.ui.GrantPermissionsActivity".equals(cn.getClassName())){ //permission dialog is displayed } }` ` 回答2: Permission dialog is an

Android M detect if permission dialog is visible

烂漫一生 提交于 2020-02-21 10:50:06
问题 How can I determine programmatically if a permission dialog is visible to the user so I know what to do in this case? 回答1: @Override protected void onStart() { super.onStart(); ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); ComponentName cn = am.getRunningTasks(1).get(0).topActivity; if ("com.android.packageinstaller.permission.ui.GrantPermissionsActivity".equals(cn.getClassName())){ //permission dialog is displayed } }` ` 回答2: Permission dialog is an

Android M detect if permission dialog is visible

妖精的绣舞 提交于 2020-02-21 10:49:08
问题 How can I determine programmatically if a permission dialog is visible to the user so I know what to do in this case? 回答1: @Override protected void onStart() { super.onStart(); ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); ComponentName cn = am.getRunningTasks(1).get(0).topActivity; if ("com.android.packageinstaller.permission.ui.GrantPermissionsActivity".equals(cn.getClassName())){ //permission dialog is displayed } }` ` 回答2: Permission dialog is an

Is Android M not allowing hard links?

[亡魂溺海] 提交于 2020-02-01 04:36:24
问题 I have an Android app with some C code that uses the link(2) system call to create a hard link to an existing file. When I execute the app on Android 5.0.2, this part of the app works. When I execute the exact same app on an Android-M device the link() system call returns -1 "permission denied". I notice in my log getting messages like this: 09-02 17:10:34.222 5291 5291 W ona.crackerjack: type=1400 audit(0.0:59): avc: denied { link } for name="fixed28" dev="mmcblk0p28" ino=82829 scontext=u:r

Capture image without permission with Android 6.0

情到浓时终转凉″ 提交于 2020-01-31 03:25:27
问题 I need to let the user take a picture (from the gallery or from a camera app) with Android 6.0. Because I don't need to control the camera, I wanted to use an intent as describe here: However, if you don't need such control, you can just use an ACTION_IMAGE_CAPTURE intent to request an image. When you start the intent, the user is prompted to choose a camera app (if there isn't already a default camera app), and that app takes the picture. The camera app returns the picture to your app's

REQUEST_IGNORE_BATTERY_OPTIMIZATIONS how to do it right

风格不统一 提交于 2020-01-30 18:42:42
问题 I have IntentService task in foreground mode, but in Android M+ the task stops in Doze mode. I read Google banned if the app uses intent to set themselves in whitelist. But if I use permission and check GRANT or DENIED, I get the granted result, but nothing happen. I don't see my app in whitelist. How can I add the app in whitelist without banned? (I added permission in AndroidManifest.xml ) if(Build.VERSION.SDK_INT>=23){ int permissionCheck= ContextCompat .checkSelfPermission(this, Manifest

Show DialogFragment when user clicks deny on Runtime permissions dialog

末鹿安然 提交于 2020-01-25 20:59:07
问题 I'm trying to show a DialogFragment right after the user clicks "Deny" on the "allow/deny permission" dialog of android 6 But instead I'm getting this error: Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1448) at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1466) at android.support.v4.app.BackStackRecord.commitInternal

Bluetooth LE can't find any device on android 6.0

ぐ巨炮叔叔 提交于 2020-01-25 09:27:09
问题 I am building an app that receives data from bluetooth device and is fully functional on a 4.4.4 android smartphone. But when I try it on version 6.0 devices it does not find the bluetooth devices. I have activated location on the phone and I have added the permissions for location on manifest file but nothing happens. I have read somewhere that I have to request permission from the user and I have tried to add ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.ACCESS