android-6.0-marshmallow

Android 6.0 Dialog text doesn't appear

末鹿安然 提交于 2019-12-18 03:03:10
问题 I updated my phone to Android 6.0 and I have these 2 problems with dialogs: 1)The title is shown but the messages isn't for alert dialog(SOLVED): new AlertDialog.Builder(context).setTitle("Title").setMessage("Message"); 2)Also custom dialog fragment's title is not shown(NOT SOLVED): getDialog().setTitle("Title"); There was not such a problem in lollipop or in older versions, the problem appeared only after updating my phone to marshmallow. How to solve the problem? 回答1: Use constructor with

Getting Latitude and Longitude 0.0 in Android M

纵然是瞬间 提交于 2019-12-18 01:33:27
问题 I am suffering from the problem of getting value 0.0 as latitude and longitude in Android Marshmallow (API 23) i.e. 6.0. I have searched a lot regarding this but didn't find solution of it. My code is fully working for the other API versions which are less than 23. I have also put the code for selfPermission and which all are working instead it's giving me 0.0 as late and long. Please have a look on the way I am following: GPSTracker.java public class GPSTracker extends Service implements

Getting Latitude and Longitude 0.0 in Android M

拜拜、爱过 提交于 2019-12-18 01:33:00
问题 I am suffering from the problem of getting value 0.0 as latitude and longitude in Android Marshmallow (API 23) i.e. 6.0. I have searched a lot regarding this but didn't find solution of it. My code is fully working for the other API versions which are less than 23. I have also put the code for selfPermission and which all are working instead it's giving me 0.0 as late and long. Please have a look on the way I am following: GPSTracker.java public class GPSTracker extends Service implements

listFiles() returns null on Android 6.0 emulator

空扰寡人 提交于 2019-12-17 23:45:10
问题 I want to read jpeg files from sdcard on Android 6.0 emulator, but file list returns null. The sample code can work on my phone: String sdcard = Environment.getExternalStorageDirectory().toString(); File sdcard_dir = new File(sdcard); if (sdcard_dir.isDirectory()) { File[] fileNames = sdcard_dir.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.toString().endsWith(".jpg") ? true : false; } }); } fileNames = null! I can use adb shell to list image

App links intent filters in assetlinks.json not working on Android

谁都会走 提交于 2019-12-17 22:23:30
问题 My app defines the intent filters to handle URL's from my site defined by <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <data android:host="www.host.com" android:scheme="http"/> </intent-filter> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent

How does storage access change on Android 6?

二次信任 提交于 2019-12-17 22:05:15
问题 Background Android had a lot of changes as to how to handle the SD-card and storage in general: API 3 - you get all access, no permission needed API 4-15 - you need to use WRITE_EXTERNAL_STORAGE, and you get all access. API 16-18 - if you wish only to read, use READ_EXTERNAL_STORAGE API 19-20 - you can't read or write to secondary external storage (SD-card), unless your app is a system app, or you have root. API 21-22 - in order to access the SD-card, you need to ask the user for permission,

Use new fingerprint API from Android for multiple users

雨燕双飞 提交于 2019-12-17 19:47:44
问题 We are creating a timestamp application on Android and ideally this would use fingerprint to identify the user. In one organisation there can be like 150 different users. Would the fingerprint API allow multiple users? Or is this currently only for the owner of the device? If this is only for the current users, are there any other API's available that would allow this? If not I think we need to abandon this road completely. 回答1: Android M or Samsung or iPhone APIs only allow to verify current

How to ask runtime permissions for Camera

此生再无相见时 提交于 2019-12-17 19:22:20
问题 I am doing an application to scan barcodes on a button click and it was working fine up to Lollipop versions. When I came to Marshmallow it stopped working. This is the error: camerabase an error occurred while connecting to camera 0 It forces me to turn on permission by: Settings --> application --> my app --> camera. My question is how to allow camera permission to my app automatically in Marshmallow or by asking the user to turn on camera at runtime. A screen shot: 回答1: Below I have

Is it available to set checkSelfPermission on minimum SDK < 23?

馋奶兔 提交于 2019-12-17 18:26:05
问题 New runtime permissions in Android-M asking for minimum 23 API level, but I still need minimum 16 API level in my project. So, how to make this code more forward-compatible? Regards 回答1: Use ContextCompat.checkSelfPermission(), ActivityCompat.requestPermissions(), and ActivityCompat.shouldShowPermissionRequestRationale(), from the support-v4 library (v23 or higher). These are backwards-compatible; if you are running on an older version of Android, they will "do the right thing" (e.g., return

Getting mobile data usage history using NetworkStatsManager

情到浓时终转凉″ 提交于 2019-12-17 17:42:06
问题 I want to know the data usage history and noticed the "new" android-6 NetworkStatsManager which seems positive (I've used TrafficStats a while but that won't cover anything previous a reboot). From the API documentation: NOTE: This API requires the permission PACKAGE_USAGE_STATS, which is a system-level permission and will not be granted to third-party apps. However, declaring the permission implies intention to use the API and the user of the device can grant permission through the Settings