android-7.0-nougat

FCM token returns null in android nougat

徘徊边缘 提交于 2019-12-13 07:59:48
问题 FCM token not generated in Android Nougat device(Moto,Sony & Huawei) when installed my app FirebaseInstanceId.getInstance().getToken() returns null, But FCM token generated in Emulator(Nougat) and below Nougat versions. 回答1: When do you call FirebaseInstanceId.getInstance().getToken() ? You need to wait in a Service extending FirebaseInstanceIdService for the onTokenRefresh callback. This is the moment, where your Token is available. public class FcmTokenService extends

Android N - Change Locale in runtime

大兔子大兔子 提交于 2019-12-13 03:18:38
问题 I have an android app to which I want to add a simple preferences screen with a single option to switch between to languages (english and portuguese). I have already the proper string resources files in place. If I change the main language of the OS in the system preferences, and reload the app, it will use that language, however I would like to be able to do it via the preferences screen. I saw in other questions here that in this was a lot easier to do in previous Android versions, but that

Permission Denial: writing android.support.v4.content.FileProvider uri

早过忘川 提交于 2019-12-12 18:54:42
问题 Good day.I have an weird issue to which none of examples in stack overflow has worked.I am opening an gallery,after which i am redirecting user to crop intent.Important to mention that this only happens on android N and not below devices.The issue is that this exception is thrown as soon as the crop is done..I dont know what causes this,but actually here is how i start crop intent. Intent cropIntent = new Intent("com.android.camera.action.CROP"); cropIntent.addFlags(Intent.FLAG_GRANT_WRITE

How to have different network-security-config for different build variants?

末鹿安然 提交于 2019-12-12 10:53:55
问题 I would like to trust certificate only in one build-variant. How to make it? 回答1: Create a source for the variant. Create a res/xml/ directory in that source set, and put your network security configuration XML in there. Create other stuff in that source set as needed (e.g., res/raw/ and your certificate). In that source set, create an AndroidManifest.xml file, with an <application> element that just has the android:networkSecurityConfig attribute and nothing else. And you should be done.

Android: take screenshot of whole WebView in Nougat ( Android 7 )

為{幸葍}努か 提交于 2019-12-12 10:48:39
问题 I use below code to take screenshot from a WebView . it works well in Android 6 and lower versions but in Android 7 it takes only the visible part of the webview. // before setContentView if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { WebView.enableSlowWholeDocumentDraw(); } ... // before set webview url webView.setDrawingCacheEnabled(true); // after html load complete final Bitmap b = Bitmap.createBitmap(webView.getMeasuredWidth(), webView.getContentHeight(), Bitmap.Config.ARGB

Camera is not working in Nougat 7.0

懵懂的女人 提交于 2019-12-12 07:57:16
问题 My camera code is working in all Android versions but in Nougat 7.0 it gives the following error: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.toString()' on a null object reference It is working perfectly on all other versions of android except on android 7.0. I have given run time permission for the camera & the gallery but the camera is still not working. Here is the relevant code: @Override protected void onActivityResult(int

DP5 7.0 - Does adding extras to a pending intent fail?

╄→尐↘猪︶ㄣ 提交于 2019-12-12 07:54:26
问题 Adding the linked issue on tracker: https://code.google.com/p/android/issues/detail?id=216581&thanks=216581&ts=1468962325 So I installed the DP5 Android 7.0 release onto my Nexus 5X today. I've been working on an app that schedules local notifications at specific times using Android's AlarmManager class. Up until this release, the code has been working great on devices running KitKat, Lollipop, and Marshmallow. Below is how I'm scheduling the alarms: Intent intent = new Intent(context,

FileUriExposedException using Android 7 [duplicate]

佐手、 提交于 2019-12-12 07:17:37
问题 This question already has answers here : android.os.FileUriExposedException: file:///storage/emulated/0/test.txt exposed beyond app through Intent.getData() (24 answers) Closed 5 months ago . When I try to capture a picture I have this error : FATAL EXCEPTION: main android.os.FileUriExposedException: file:///storage/emulated/0/fname_1498727381241.jpg exposed beyond app through ClipData.Item.getUri() at android.os.StrictMode.onFileUriExposed(StrictMode.java:1799) at android.net.Uri

Programmatically accept call in Nougat

杀马特。学长 韩版系。学妹 提交于 2019-12-12 07:09:03
问题 From one year, I have been working over IOT product and the application attached was working fine. Now I am not able to accept call programmatically in higher versions of android. Feature is very important to product. Any help is highly appreciated. Before security patch update November 2016 , Runtime.getRunTime.exec("Command") was working fine to accept call programmatically. Runtime.getRuntime().exec("input keyevent " +Integer.toString(KeyEvent.KEYCODE_HEADSETHOOK)); How to make it possible

App language changes on its own on making a call for dfp ads in android N

百般思念 提交于 2019-12-12 04:35:07
问题 I have an app which support two language english and indonesian(bahasa). I am facing an issue in android N. I am using dfp sdk to show native ads to our user, everything works great as long as I am in my english layout but as soon as I change my app language to indonesian and make a request for ads, my app language forcefully changes to english and the layout breaks. The app works fine if I dont make any call to dfp. Has anyone else faced this issue before? I think my problem is related to