android-6.0-marshmallow

How to make Alarm Manager work when Android 6.0 in Doze mode?

*爱你&永不变心* 提交于 2019-12-17 02:35:16
问题 I am a developer of two alarm clock apps on Google Play. I am trying to get them to work with Android 6.0. However, Doze mode makes it so they do not ring. I put them on the white list, I put a foreground notification icon up, I'm not sure what else I can do - when in Doze mode, the the Alarm Manager alarms are still ignored. The Clock app (which is a Google Play rather than AOSP app), however, is different. When the alarm is enabled on the Clock app, "adb deviceidle step" will always read

How to request permissions from a Service in Android Marshmallow

依然范特西╮ 提交于 2019-12-17 02:13:06
问题 In Android Marshmallow, permissions should be requested at runtime when they are needed, instead of all at once when an app is installed. However, I can only seem to request permissions from an Activity, which is a problem since my app contains only Services. (Why is that, you might ask? The app has an Android Wear watch face bundled inside, and all the phone does is look up photos nearby to send to the watch - no Activity needed. But it does require location permissions.) So, is there any

How to request permissions from a Service in Android Marshmallow

╄→尐↘猪︶ㄣ 提交于 2019-12-17 02:12:10
问题 In Android Marshmallow, permissions should be requested at runtime when they are needed, instead of all at once when an app is installed. However, I can only seem to request permissions from an Activity, which is a problem since my app contains only Services. (Why is that, you might ask? The app has an Android Wear watch face bundled inside, and all the phone does is look up photos nearby to send to the watch - no Activity needed. But it does require location permissions.) So, is there any

Android 6.0 Marshmallow. Cannot write to SD Card

我的梦境 提交于 2019-12-16 22:23:52
问题 I have an app that uses external storage to store photographs. As required, in its manifest, the following permissions are requested <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> and it uses the following to retrieve the required directory File sdDir = Environment .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd", Locale.US);

Android M - check runtime permission - how to determine if the user checked “Never ask again”?

对着背影说爱祢 提交于 2019-12-16 21:23:09
问题 According to this: http://developer.android.com/preview/features/runtime-permissions.html#coding an app can check for runtime permissions and request permissions if it hasn't been granted already. The following dialog will be displayed then: In case the user declines an important permission, imo an app should display an explanation why the permission is needed and what impact declining has. That dialog has two options: re-try again (permission is requested again) deny (app will work without

Android M Google API's to use Google Maps and other permissions

丶灬走出姿态 提交于 2019-12-14 02:49:25
问题 I have Android M set up for my project and could build fine. However, When i launch the app, i see the following error and app doesn't launch: <06-23 11:53:24.833 32416 32416 W System.err: java.lang.RuntimeException: **Unable to create application xxxxx: java.lang.SecurityException: "gps" location provider requires ACCESS_FINE_LOCATION permission.** 06-23 11:53:24.833 32416 32416 W System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4697) 06-23 11:53:24.833

Can not locate the sdcard file(not hard code) in android 6.0

不打扰是莪最后的温柔 提交于 2019-12-13 23:41:58
问题 Since android 6.0, the sdcard path is no longer "/storage/sdcard1/", "/storage/sdcard-ext/" or something. The path depends on the phone instead. If I use Nexus 5x AVD, the path is "/storage/1D15-3A1B/". When I use Nexus 6p AVD, the path is "/storage/4679-1802/". So how can I dynamically write the sdcard path in program to locate the file in external sdcard? Thank you! 回答1: Have a look at getExternalFilesDirs() . 回答2: It seems that I found the solution. I'm using the access storage framework.

java.io.IOException: open failed: EACCES (Permission denied) when writing file in API level 23

徘徊边缘 提交于 2019-12-13 18:49:09
问题 I'm trying to export my DB to a CSV file. I have applied the appropriate permission to the AndroidManifest.xml . I'm just wondering why I can't write/create the file in my (actual device) Nexus 5X API level 23 where the same code works in my emulator Nexus 7 API level 22. Is the permission not enough? Here's the code: private void writeCsv() { File fileDir = new File(Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_DOWNLOADS).getAbsolutePath(), File.separator + "Example");

Doze and App Standby mode in Android 6.0

て烟熏妆下的殇ゞ 提交于 2019-12-13 16:52:12
问题 Google introduced Doze and App Standby mode with Android 6.0 OS. Device will enter in Doze mode if device is unplugged and unused for some amount of time and if application stays inactive for some amount of time, that app goes in StandBy mode (Correct me if I am wrong). Can we (developer) know, device entered in Doze mode or application entered in StandBy mode? How? http://developer.android.com/training/monitoring-device-state/doze-standby.html#whitelisting-cases In this link, Google says

android.content.ActivityNotFoundException “android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS”

我的梦境 提交于 2019-12-13 13:12:30
问题 I'm trying to guide my users to the battery optimizations activity and it seems to be working for most except for some Samsung phones with Android 6 where I get: Fatal Exception: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS } This is what I am using to launch it: Intent intent = new Intent("android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS"); startActivity(intent); Any idea what I should be