android-7.0-nougat

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

本小妞迷上赌 提交于 2019-11-26 18:39:25
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 in the current state. Now I'm not at all much of an Android developer (this is for a Cordova plugin) so

Job Scheduler not running on Android N

99封情书 提交于 2019-11-26 17:27:57
问题 Job Scheduler is working as expected on Android Marshmallow and Lollipop devices, but it is not running and Nexus 5x (Android N Preview). Code for scheduling the job ComponentName componentName = new ComponentName(MainActivity.this, TestJobService.class.getName()); JobInfo.Builder builder; builder = new JobInfo.Builder(JOB_ID, componentName); builder.setPeriodic(5000); JobInfo jobInfo; jobScheduler = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE); jobInfo = builder.build();

What Do We Use for Android N Network Security Configuration for a Self-Signed Certificate?

橙三吉。 提交于 2019-11-26 16:41:35
问题 I am trying to test out all aspects of the network security configuration capability of the N Developer Preview. I have most of it working, but I am stumped by the self-signed certificate scenario. According to the docs, Android N should be happy with a PEM or DER file, as it is for other certificate validation scenarios. However, I do not work with self-signed certificates much, and my attempts to get this working keep running into certificate path validation exceptions. For testing, I am

SSLHandshakeException: Handshake failed on Android N/7.0

我是研究僧i 提交于 2019-11-26 15:50:54
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 server, telling me the ssl handshake failed. My nginx configuration is pretty strict, but it works for both 5

Android N change language programmatically

会有一股神秘感。 提交于 2019-11-26 14:08:57
I found really weird bug that is reproduced only on Android N devices. In tour of my app there is a possibility to change language. Here is the code that changes it. public void update(Locale locale) { Locale.setDefault(locale); Configuration configuration = res.getConfiguration(); if (BuildUtils.isAtLeast24Api()) { LocaleList localeList = new LocaleList(locale); LocaleList.setDefault(localeList); configuration.setLocales(localeList); configuration.setLocale(locale); } else if (BuildUtils.isAtLeast17Api()){ configuration.setLocale(locale); } else { configuration.locale = locale; } res

How to pick image for crop from camera or gallery in Android 7.0?

耗尽温柔 提交于 2019-11-26 13:08:27
问题 Pick image for crop from gallery and camera it\'s done for below Android 7.0 but in Android Nought it crashes in camera. I use fileprovider for it but doesn\'t work. MainActivity.java public class MainActivity extends AppCompatActivity implements View.OnClickListener { private Button mBtn; private Context context; private static final int SELECT_PICTURE_CAMARA = 101, SELECT_PICTURE = 201, CROP_IMAGE = 301; private Uri outputFileUri; String mCurrentPhotoPath; private Uri selectedImageUri;

“Canvas: trying to draw too large bitmap” when Android N Display Size set larger than Small

耗尽温柔 提交于 2019-11-26 12:56:57
问题 I have a published app that is crashing at startup on Android N when the newly introduced Display size OS setting is set to too large a value. When I look in logcat, I see the following message: java.lang.RuntimeException: Canvas: trying to draw too large(106,975,232 bytes) bitmap. I\'ve traced the issue to an ImageView in my first Activity that shows a nice big background image. The image in question is 2048x1066 and is in my generic drawables directory, so no matter the density, this image

Html.fromHtml deprecated in Android N

大憨熊 提交于 2019-11-26 10:14:00
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? Rockney update : as @Andy mentioned 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 androidx.core:core . This allows you to use: HtmlCompat.fromHtml(html, HtmlCompat.FROM_HTML_MODE_LEGACY); You

Expand/Collapse Lollipop toolbar animation (Telegram app)

老子叫甜甜 提交于 2019-11-26 08:57:47
问题 I\'m trying to figure out how the expand/collapse animation of the toolbar is done. If you have a look at the Telegram app settings, you will see that there is a listview and the toolbar. When you scroll down, the toolbar collapse, and when you scroll up it expands. There is also the animation of the profile pic and the FAB. Does anyone have any clue on that? Do you think they built all the animations on top of it? Maybe I\'m missing something from the new APIs or the support library. I

Replacing default Phone app on Android 6 and 7 with InCallService

China☆狼群 提交于 2019-11-26 08:30:39
问题 Android API level 23 added InCallService to provide the user-interface for managing phone calls . The documentation provides an example manifest registration but I couldn\'t get it to work. The app compiles fine but Default Apps in settings doesn\'t show my app. The only place I found any information about the subject was a StackOverflow question that was closed a year ago. Comment on that question proposed to add android.intent.action.DIAL activity but that didn\'t help me either. I have