android-6.0-marshmallow

How to create wifi tethering Hotspot in Android Marshmallow?

假装没事ソ 提交于 2019-12-05 07:52:22
I've tried to create a Wi-Fi tethering hotspot in Android Marshmallow using the following code. public class WifiAccessManager { private static final String SSID = "1234567890abcdef"; public static boolean setWifiApState(Context context, boolean enabled) { //config = Preconditions.checkNotNull(config); try { WifiManager mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (enabled) { mWifiManager.setWifiEnabled(false); } WifiConfiguration conf = getWifiApConfiguration(); mWifiManager.addNetwork(conf); return (Boolean) mWifiManager.getClass().getMethod(

Request permission on Android M only when targeting lower API

≯℡__Kan透↙ 提交于 2019-12-05 07:46:57
So in my app i would like to add an option to selectively add a permission (say, direct dial) when the user is on Android M but, at the same time, i would like to have that permission NOT showing as required in API 22 or lower simply because its not essential so i prefer not asking for it during install (so de facto making that feature available on M only). So, i understand the new model of M is that it will allow optional permissions when user is on M and it will make those permissions mandatory when on lower APIs. So is there any known way to just remove those permissions on API lower than

onRequestPermissionsResult is not called back in an android activity

浪子不回头ぞ 提交于 2019-12-05 06:52:20
I am trying to get the camera permission from the user before launching my camera activity. onRequestPermissionsResult is never called back after the user presses "Allow" from the permission dialog. Here is my Activity class: public class ImageCaptureActivity extends AppCompatActivity { public static final String TAG = ImageCaptureActivity.class.getSimpleName(); private static final int REQUEST_CAMERA = 0; private static final int REQUEST_CAMERA_PERMISSION = 1; private Point mSize; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView

How can I get notification of any file being deleted from SD card

天涯浪子 提交于 2019-12-05 05:48:00
I want to create Dumpster like app, for this I want notification when user is deleting any file so that I can save it to my app memory. I used File Observer but it is giving notification after file deletion and in marshmallow it does not notify for deletion also. I referred this link for file observer. Somewhere I read it is possible using native programming language (C), but couldn't get any solution. How can I do this? Thanks in advance. I have tried this: @Override public void onEvent(int event, String path) { if (path == null) { return; } //the monitored file or directory was deleted,

Scrollbar touch area in Android 6

廉价感情. 提交于 2019-12-05 04:55:20
I observe new behaviour in Android 6.0 Marshmallow. The touching area of scrollbar is widther than the scrollbar. It is visible on following screenshot. Scrollbar has 20 dp (green area) and touching area is probably 48 dp (blue and green area). I would like to have the touch area above the scrollbar only: I use following: <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="MyTheme.Dark" parent="android:Theme.Black"> <item name="android:fastScrollStyle">@style/Widget.FastScroll</item> <item name="android:scrollbarThumbVertical">@drawable/dark_scrollbar_thumb<

Android 6 : Connect to specific wifi network programmatically not working

不打扰是莪最后的温柔 提交于 2019-12-05 03:24:33
问题 I am trying to connect to a wifi network by giving the SSID and pass using WifiManager configurations. Based on this threads solution: How do I connect to a specific Wi-Fi network in Android programmatically? The reconnect method is called. but nothing happens (not connected). Is the Android version (6.0.1) for something? If yes then how to perform a network connection programmatically on Android 6? 回答1: A few things have changed about how you connect to a WiFi network since android

textView.getSelectionEnd() returning start index value on Samsung Marshmallow 6.0 devices

拥有回忆 提交于 2019-12-05 01:44:28
This issue is observed on Samsung devices with Android 6.0 only. It is working fine on all other devices, including non - Samsung devices with android 6.0 and Samsung devices with Android 5.1 and below. Currently we don`t have any Samsung device with Android 6.0 to readily check things on it, but we are arranging it soon. The feature where we are using this : The user long presses on a word from a sentence in a TextView and then user can edit the selected word. We accomplish this by : Making the TextView selectable and adding a LongClickListener. Adding a custom Selection Action Mode CallBack

Receive UDP in Android Marshmallow

爱⌒轻易说出口 提交于 2019-12-05 01:37:34
问题 I'm having problems to receive constantly the UDP packets from the server with new Nexus 5X (Marshmallow) I have another real devices that receive all UDP packets, but it seems that something changed in Android API 23. CODE: Anyone with the same problem? if (s == null || s.isClosed()){ Log.v("udp", "----------------------------------------------------new socket---------------------------------"); s = new DatagramSocket(null); s.setReuseAddress(true); s.setBroadcast(true); s.setSoTimeout(5000)

Android app time delay on 5.0+ devices

ぃ、小莉子 提交于 2019-12-04 23:32:31
My app is taking 10-12 sec delay while first load on 5.0+ devices, 4.4 or below devices does not have this problem. I have added a log message in Application class onCreate method but it is also called after 10-12 sec seconds. I have tried multidex enable false, minify enabled true but does not make any difference. I have found one thing, when we clear cache and data from app info activity, then it again delay while loading and my app is taking around 10mb of cache and 5 mb of data which is higher than usual. How to address this problem? I have not find this type of issue on net or

How to send a high-priority GCM?

回眸只為那壹抹淺笑 提交于 2019-12-04 23:30:38
I'm using a Nexus 5 with Android M Preview. My problem that I'm trying to solve is: Network access is disabled, unless your app receives a high priority Google Cloud Messaging tickle. What I'm doing is: I put the phone into Doze mode and then I send a push notification with the priority with value 10 and I'm expecting to have internet access for a brief moments, but this is not working. Should I use other type of notifications? There are any documentation already available? Thanks. Android M changes: https://developer.android.com/preview/behavior-changes.html What I found about GCM priority