android-7.0-nougat

Android 7.0 Notification Sound from File Provider Uri not playing

南楼画角 提交于 2019-12-02 18:38:56
I'm changing my app code for supporting Android 7, but in my NotificationCompat.Builder.setSound(Uri) passing the Uri from FileProvider the Notification don't play any sound, in Android 6 using the Uri.fromFile() worked properly. The mp3 file is in: /Animeflv/cache/.sounds/ This is my Notification Code: knf.animeflv.RequestBackground NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.ic_not_r) .setContentTitle(NotTit) .setContentText(mess); ... mBuilder.setVibrate(new long[]{100, 200, 100, 500}); mBuilder.setSound(UtilSound.getSoundUri(not));

File system changes in Android Nougat

怎甘沉沦 提交于 2019-12-02 17:30:57
Ever since the first release of the Android N developer preview, I get "permission denied" errors when attempting to list the root directory or other system directories. The permissions on these directories didn't seem to change (as far as I can tell). Question: What change(s) in Android N caused these permission denied errors? How to replicate: In ADB shell, run the following commands: run-as com.debuggable.packagename ls / This gives permission denied errors on Android N. Why list system directories: I noticed this behavior on Android N with several file managers. They could no longer list

Webview blank page shown in Nougat OS in my app

老子叫甜甜 提交于 2019-12-02 14:01:14
问题 I have called CCAvenue Payment Gateway Integration in my app. till it is working properly but when i update my device OS Marshmallow to Nougat, Webview page display blank white screen. No Error log found in logcat also. I have also tested in all another device which lower than Nougat and in that devices, WebView working properly. Only issue found in Nougat OS. I have searched this issue in google, but not found any proper solution from last three days. 回答1: I found the solution, when I update

Job Scheduler Not recurring in periodic in Android 7.0 (Nougat)

帅比萌擦擦* 提交于 2019-12-02 08:46:26
问题 Job is not firing on given time...it delays ...delays...delay time increases. my requirement is to perform job no matter what in every 10 mins using Job Scheduler in Android 7.0 and above. here my code snippet private static long Scheduler_Interval = 5 * DateUtils.MINUTE_IN_MILLIS; JobScheduler mJobScheduler mJobScheduler = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE); JobInfo.Builder builder = new JobInfo.Builder(1, new ComponentName(getPackageName(), JobSchedulerService

How to get current location in android 7?

此生再无相见时 提交于 2019-12-02 04:36:54
I'm trying to get current location in android and its OK when i'm using on android M or lower, But when i run my application on android N, location is null and when i want get latitude from it will returns 0. here is my code try { if (!isGPSEnabled && !isNetworkEnabled) { } else { this.canGetLocation = true; if (isNetworkEnabled) { locationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); Log.d("Network", "Network"); if (locationManager != null) { location = locationManager .getLastKnownLocation(LocationManager

How to open an APK file for all Android versions

霸气de小男生 提交于 2019-12-01 18:08:08
Background So far, there was an easy way to install an APK file, using this intent: final Intent intent=new Intent(Intent.ACTION_VIEW) .setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); But, if your app targets Android API 24 and above (Nougat - 7.0) , and you run this code on it or newer, you will get an exception, as shown here , for example: android.os.FileUriExposedException: file:///storage/emulated/0/sample.apk exposed beyond app through Intent.getData() The problem So I did what I was told: use the support library's FileProvider class, as such: final

The SDK platform-tools version (24.0.4) is too old to check APIs compiled with API 25; please update

自闭症网瘾萝莉.ら 提交于 2019-12-01 15:30:00
I am getting this error on the latest version of Android Studio and while I have installed both Android SDK Platform API 25 and Android SDK Build-Tools 25. I had a similar problem. Updating Android Studio to version 2.2.2 (latest at the time of this writing) and Gradle version to 2.2.2 (latest at the time of this writing) in project_name/build.gradle file fixed this issue. For reference, this is my config in project_name/app/build.gradle file: minSdkVersion = 19 targetSdkVersion = 25 compileSdkVersion = 25 buildToolsVersion = "25" supportLibraryVersion = "25.0.0" And this is my dependencies in

Android 7.1 Write to text file

孤者浪人 提交于 2019-12-01 14:27:13
Guys New to Nougat come from Jelly bean Trying to write to sdcard a text file I know I now have to request permissions but cant find any code that works Tried the following StringBuilder bodyStr=new StringBuilder(); bodyStr.append(data1Str.toString()).append(",").append(data2Str.toString()).append(",").append(data3Str.toString()).append(",").append(data4Str.toString()).append(",").append(data5Str.toString()).append(",").append(data22Str.toString()).append(",").append(data23Str.toString()).append(lineSep);; String bodytextStr=bodyStr.toString(); boolean hasPermission = (ContextCompat

Android 7.1 Write to text file

孤者浪人 提交于 2019-12-01 12:51:33
问题 Guys New to Nougat come from Jelly bean Trying to write to sdcard a text file I know I now have to request permissions but cant find any code that works Tried the following StringBuilder bodyStr=new StringBuilder(); bodyStr.append(data1Str.toString()).append(",").append(data2Str.toString()).append(",").append(data3Str.toString()).append(",").append(data4Str.toString()).append(",").append(data5Str.toString()).append(",").append(data22Str.toString()).append(",").append(data23Str.toString())

In Android 7, ContentResolver's method-openAssetFileDescriptor(vCardUri, “r”) returns AssetFileDescriptor having declaredLength as -1

雨燕双飞 提交于 2019-12-01 11:04:55
In Android 7, getContentResolver().openAssetFileDescriptor(vCardUri, "r") returns AssetFileDescriptor having declaredLength as -1 returned by getDeclaredLength() . Trying to export the contacts as vcards into vcf file. The code I have tried is as follows Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey); AssetFileDescriptor fd = resolver.openAssetFileDescriptor(uri, "r"); FileInputStream fis = fd.createInputStream(); byte[] b = new byte[(int)fd.getDeclaredLength()]; fis.read(b); The above code works perfectly in Android 6 or below.But when ran using Android