android-6.0-marshmallow

Doze mode and App Standby

丶灬走出姿态 提交于 2020-01-23 04:32:27
问题 How can I know in my app if the phone is in Doze mode or if my app is in Standby mode? Can I also know it by using some subscribing approach? 回答1: There's a difference between App Standby (where your app goes to sleep because it's lonely) and Doze (where the system went to sleep because users have lives). Doze only works when your device remains stationary. If you pick it up or wake the screen, Doze mode is deactivated and the timer resets. It won’t ever turn on when the phone is sitting in

how to turn off doze mode for specific apps in marshmallow devices programmatically

馋奶兔 提交于 2020-01-23 02:44:48
问题 Marshmallow APIs are very different from previous android OS. When screen is off, devices are in doze mode and unable to sync network. So for doing background operations with network we have to prevent from doze mode. 回答1: Add below permission to manifest.xml <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/> Call below method public void turnOffDozeMode(Context context){ //you can use with or without passing context if(Build.VERSION.SDK_INT >= Build

Crash casting AndroidKeyStoreRSAPrivateKey to RSAPrivateKey

∥☆過路亽.° 提交于 2020-01-22 15:25:02
问题 I'm following this tutorial: How to use the Android Keystore to store passwords and other sensitive information. It (loosely) ties up with the Google Sample app: BasicAndroidKeyStore. I can encrypt my data using the public key, and I can decrypt on devices running Lollipop. However I have a Nexus 6 running marshmallow and this crashes giving the error: java.lang.RuntimeException: Unable to create application com.android.test: java.lang.ClassCastException: android.security.keystore

Crash casting AndroidKeyStoreRSAPrivateKey to RSAPrivateKey

落花浮王杯 提交于 2020-01-22 15:24:12
问题 I'm following this tutorial: How to use the Android Keystore to store passwords and other sensitive information. It (loosely) ties up with the Google Sample app: BasicAndroidKeyStore. I can encrypt my data using the public key, and I can decrypt on devices running Lollipop. However I have a Nexus 6 running marshmallow and this crashes giving the error: java.lang.RuntimeException: Unable to create application com.android.test: java.lang.ClassCastException: android.security.keystore

windowBackground in Android 6 (Marshmallow)

我怕爱的太早我们不能终老 提交于 2020-01-21 04:11:37
问题 I have defined a base style for my application with the following element: <item name="android:windowBackground">@color/window_background</item> Which has set the background color for all my activities fine until I tested my app on Android 6 where all backgrounds are white. The backgrounds are still color/window_background on devices running pre-marshmallow. Anyone know how to make this work (or why it is not working) on Android 6? Edit with some more info: I am targeting API 22, I have not

Permission issues for location in android Marshmallow applicaton

南楼画角 提交于 2020-01-19 01:48:46
问题 I am learning to develop an android application for getting device location following Google developers forum: @http://developer.android.com/training/location/retrieve-current.html#last-known @http://developer.android.com/training/location/receive-location-updates.html The example shows how to use Google PLay Services for this purpose. But the getLastLocation() function always return null. Location location = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); As initially

Permission issues for location in android Marshmallow applicaton

徘徊边缘 提交于 2020-01-19 01:47:46
问题 I am learning to develop an android application for getting device location following Google developers forum: @http://developer.android.com/training/location/retrieve-current.html#last-known @http://developer.android.com/training/location/receive-location-updates.html The example shows how to use Google PLay Services for this purpose. But the getLastLocation() function always return null. Location location = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); As initially

org.apache.http.entity.FileEntity is deprecated in Android 6 (Marshmallow)

坚强是说给别人听的谎言 提交于 2020-01-16 07:04:16
问题 I'm upgrading an app to API 23 where org.apache.http is deprecated. My current (deprecated) code looks like this: HttpClient httpClient = new DefaultHttpClient(); File file = new File(attr.Value); String url = server_url; HttpPost request = new HttpPost(url); FileEntity fileEntity = new FileEntity(file, "image/png"); request.setEntity(fileEntity); HttpResponse response = httpClient.execute(request); String output = getContent(response.getEntity().getContent()); I've found some suggestions to

error <declare-styleable> MenuView, unable to find attribute android:preserveIconSpacing

一笑奈何 提交于 2020-01-13 14:04:28
问题 I had update my eclipse Version: 4.2.2 and android SDK with API 23. When i created an app then get an error like this. [2015-10-12 17:03:05 - appcompat_v7] ERROR: In MenuView, unable to find attribute android:preserveIconSpacing and warning [2015-10-12 16:50:14 - appcompat_v7] WARNING: unable to write jarlist cache file D:\lolipop Workspace\appcompat_v7\bin\jarlist.cache Syntax error, insert "}" to complete ClassBody R.java /appcompat_v7/gen/android/support/v7/appcompat line 3065 Java Problem

How does one retrieve the cameraID and use setTorchMode?

随声附和 提交于 2020-01-11 10:33:33
问题 So Android M recently came out and it now has a built in cameralight function called setTorchMode. I was curious as to how this worked as the parameters are (String cameraID, Boolean true/false). The Boolean obviously dictates whether the light is on or off, but how do you get the cameraID? I know there's a method called getCameraIDList, but that returns an array of IDs, not just one. How do you know which one in that list to use? 回答1: You should use CameraManager "getCameraIdList" function