android-6.0-marshmallow

Android 6.0.1 couldn't enable wifi hotspot programmatically

非 Y 不嫁゛ 提交于 2019-12-09 05:46:46
问题 When I tried to enable wifi tethering from the following code it throws the exception java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at com..... .... not granted this permission: android.permission.WRITE_SETTINGS But this works fine in android 6.0 and below versions. And also tried with giving android.permission.WRITE_SETTINGS too. Is there any limitation in accessing wifiAP in android 6.1? Follow I attached the code sample that I used to enable

How to avoid writing duplicate boilerplate code for requesting permissions?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-09 04:30:35
问题 I'm updating my app to be Android 6-compatible. The permission model is not very complex in theory, but now I'm in the process of implementing it and I find myself writing the same ugly boilerplate code in every one of my activities that require permissions. For every permission I need, there is a if (ActivityCompat.checkSelfPermission(this, Manifest.permission.PERMISSION) != PackageManager.PERMISSION_GRANTED) { } else { } and then in the onRequestPermissionsResult I have to check/filter the

Android 6.0 (Marshmallow) READ_CONTACTS permission allows to read Contact's name when permission is denied

寵の児 提交于 2019-12-09 03:09:01
问题 I want to check how new permission model works so in app's settings I disable Contacts . Then I go to app and try to read Contacts and ... it kinda works: try { Uri result = data.getData(); int contentIdx; cursor = getContentResolver().query(result, null, null, null, null); contentIdx = cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER); if(cursor.moveToFirst()) { content = cursor.getInt(contentIdx); } if(content > 0) { contentIdx = cursor.getColumnIndex(ContactsContract

Binary XML file line #: Error inflating class fragment : Only on Android (6.0)-Marshmallow

这一生的挚爱 提交于 2019-12-08 22:14:43
问题 I'm not able to show the google map on Android M. Here is layout xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:wheel="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <include layout="@layout/toolbar_layout" android:layout_width="match_parent" android:layout_height="wrap

Android DOZE mode GCM Priority

感情迁移 提交于 2019-12-08 20:01:35
For DOZE mode test, I am developing a sample GCM App on Android 6.0. As it's said, In DOZE mode the device would not wakeup for normal priority GCM. I wanted to check this. As per the documentation ( https://developers.google.com/cloud-messaging/concept-options#setting-the-priority-of-a-message ) Normal priority. This is the default priority for message delivery. Normal priority messages won't open network connections on a sleeping device, and their delivery may be delayed to conserve battery. For less time-sensitive messages, such as notifications of new email or other data to sync, choose

Doze mode and GCM notifications

亡梦爱人 提交于 2019-12-08 18:07:36
I've followed this stackoverflow post to set my Nexus 5 device to the 'IDLE' state with adb, after switching off the screen. > adb shell dumpsys battery unplug > adb shell dumpsys deviceidle step Stepped to: IDLE Despite this, I am able to see through my device logs the GCM notifications being received. 1-04 15:21:40.708 22138 26007 I GCM : GCM message com.sample.app 0:1446610899548646%82d6ec5bf9fd7ecd My understanding is that Doze mode will allow for certain maintenance windows where normal priority notifications are pushed in a batch, so I was not expecting to see such log entry. (I have

Getting Error while requesting READ_CONTACTS permission Android M

半腔热情 提交于 2019-12-08 14:19:44
i am trying to get READ_CONTACTS permission Android M and on calling: ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_CONTACTS}, 1); app crash with following exception: 05-12 17:08:24.578: E/AndroidRuntime(2846): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.packageinstaller/com.android.packageinstaller.permission.ui.GrantPermissionsActivity}: java.lang.NullPointerException: Attempt to get length of null array 05-12 17:08:24.578: E/AndroidRuntime(2846): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)

How to ask multiple permissions at the same time in android 6.0+

你说的曾经没有我的故事 提交于 2019-12-08 11:09:05
问题 i want to ask the user to accept the following permissions at the same time(one by one), the permissions are like: checkLocationPermission, checkReadSMS, checkCallingPermission, checkReadState, checkContactWriteState. So, how i can ask all these permissions in my first screen itself. Please help me out in this regard. Thanks in advance. 回答1: You have to first check that user phone build version is 23. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { askPermissions(true); } else {

Android sensor sampling rate won't drow below 60 hz

痞子三分冷 提交于 2019-12-08 10:14:09
问题 I'm reading out the accelerometer sensor on a Sony Smartwatch 3. Since the Android Wear 1.5 update the sampling rate won't drop below about 60hz, regardless weather I use SENSOR_DELAY_NORMAL , SENSOR_DELAY_UI or SENSOR_DELAY_GAME . Before the update SENSOR_DELAY_NORMAL resulted in a sampling rate of about 18 samples/seconds. accelerometer.getMaxDelay() still returns 62500, which would be 16 samples/sec. I also tried setting the desired delay directly, when registering the sensor with

Storage permission restarts application

依然范特西╮ 提交于 2019-12-08 08:21:12
问题 I have a launcher application which runs on a custom firmware(have only Camera , Settings , Chrome & Explorer). The problem come when we ask user (runtime permission) for Manifest.permission.WRITE_EXTERNAL_STORAGE on denying the permission onRequestPermissionsResult gets called but on allowing the permission application restarts. This is not happening for Manifest.permission.CAMERA permission. I can't find any proper logs pointing to this issue. The same issue is happening for the above