android-7.0-nougat

In Android 7 (API level 24) my app is not allowed to mute phone (set ringer mode to silent)

倾然丶 夕夏残阳落幕 提交于 2019-11-26 07:33:13
问题 I have an app that mutes the phone by using AudioManager and setting ringer mode to silent with this code: AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); try { audioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT) } catch (Exception e) { e.printStackTrace(); } This works with Android 6, but now with Android 7, I get the following error: System.err: java.lang.SecurityException: Not allowed to change Do Not Disturb state System.err: at android

Detect CONNECTIVITY CHANGE in Android 7 and above when app is killed/in background

不羁的心 提交于 2019-11-26 07:26:56
问题 Problem: So the problem is that I have an app which sends a request to our backend whenever WiFi is connected (with the connected SSID and other info) or when it is disconnected (over the mobile network). However with the changes in Android 7/N and above, CONNECTIVITY_CHANGE and CONNECTIVITY_ACTION no longer work in the background. Now in most cases people misuse this broadcast and as such I can completely understand why the change was made. However, I have no idea how to solve this problem

Android install apk with Intent.VIEW_ACTION not working with File provider

强颜欢笑 提交于 2019-11-26 07:19:36
问题 My app has an auto-update feature that download an APK and when the download is finished that a Intent.VIEW_ACTION to open the app and let the user install the downloaded apk Uri uri = Uri.parse(\"file://\" + destination); Intent install = new Intent(Intent.ACTION_VIEW); install.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); install.setDataAndType(uri, manager.getMimeTypeForDownloadedFile(downloadId)); activity.startActivity(install); This works great for all the device < 24 Now with Android 24

Android N requires the IDE to be running with Java 1.8 or later?

假装没事ソ 提交于 2019-11-26 07:00:53
问题 My XML layout is not rendering with this error message. I am already using Java 8. Also using latest build tools in Gradle. android { compileSdkVersion \'android-N\' buildToolsVersion 24.0.0 rc1 ... } XML Error - 回答1: I got the same error you describe but on OS X. I know this may not solve your problem (because I don't know the equivalent for Windows), but since this is not OS specific I am leaving the solution for any OS X fellow out there. Edit the file /Applications/Android\ Studio.app

android.os.TransactionTooLargeException on Nougat

冷暖自知 提交于 2019-11-26 06:29:21
问题 I updated Nexus 5X to Android N, and now when I install the app (debug or release) on it I am getting TransactionTooLargeException on every screen transition that has Bundle in extras. The app is working on all other devices. The old app that is on PlayStore and has mostly same code is working on Nexus 5X. Is anyone having the same issue? java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 592196 bytes at android.app.ActivityThread$StopInfo.run(ActivityThread

SSLHandshakeException: Handshake failed on Android N/7.0

こ雲淡風輕ζ 提交于 2019-11-26 05:58:00
问题 I\'m working on an app for which the (power)users have to set up their own server (i.e. nginx) to run the backend application. The corresponding domain needs to be configured in the app so it can connect. I\'ve been testing primarily on my own phone (sony z3c) and started developing for 5.1. Later I received an update for 6.0 but still maintained a working 5.1 inside the emulator. Not too long ago, I started to work on an AVD with an image for 7.0 and to my suprise it won\'t connect to my

Html.fromHtml deprecated in Android N

谁说胖子不能爱 提交于 2019-11-26 03:26:23
问题 I am using Html.fromHtml to view html in a TextView . Spanned result = Html.fromHtml(mNews.getTitle()); ... ... mNewsTitle.setText(result); But Html.fromHtml is now deprecated in Android N+ What/How do I find the new way of doing this? 回答1: update : as @Andy mentioned below Google has created HtmlCompat which can be used instead of the method below. Add this dependency implementation 'androidx.core:core:1.0.1 to the build.gradle file of your app. Make sure you use the latest version of

android.os.FileUriExposedException: file:///storage/emulated/0/test.txt exposed beyond app through Intent.getData()

拥有回忆 提交于 2019-11-26 01:17:55
问题 The app is crashing when I\'m trying to open a file. It works below Android Nougat, but on Android Nougat it crashes. It only crashes when I try to open a file from the SD card, not from the system partition. Some permission problem? Sample code: File file = new File(\"/storage/emulated/0/test.txt\"); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), \"text/*\"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); // Crashes on this