android-7.0-nougat

Detect Network State change using JobSchedulers in Android

感情迁移 提交于 2019-11-27 23:33:56
With Android N, You cannot statically register a Broadcast receivers for CONNECTIVITY_CHANGE intent. From http://developer.android.com/preview/features/background-optimization.html#connectivity-action Google documentation suggest using Job Schedulers to perform this task. Is it possible to detect network state change (LTE to wifi) and vice versa using Job Schedulers in Android? Yes and no. The JobInfo.Builder.setRequiredNetworkType() method allows you to schedule jobs to run when specific network conditions are met. The network type can be one of three values: JobInfo.NETWORK_TYPE_NONE : No

job scheduler in android N with less then 15 minutes interval

自闭症网瘾萝莉.ら 提交于 2019-11-27 22:03:29
Part of my question, how I can set up a job with less then 15 minutes interval in "Nougat", was answerd by "blizzard" in his answer here: Job Scheduler not running on Android N He explained the problem and suggested to use the following workaround: JobInfo jobInfo; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { jobInfo = new JobInfo.Builder(JOB_ID, serviceName) .setMinimumLatency(REFRESH_INTERVAL) .setExtras(bundle).build(); } else { jobInfo = new JobInfo.Builder(JOB_ID, serviceName) .setPeriodic(REFRESH_INTERVAL) .setExtras(bundle).build(); } However, using the suggested

Missing buttons on AlertDialog | Android 7.0 (Nexus 5x)

泄露秘密 提交于 2019-11-27 21:02:29
I am trying to create an AlertDialog but the buttons are not showing. Only seeing this issue in Android 7.0: final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("This app needs location access"); builder.setMessage("Please grant location access so this app can detect beacons."); builder.setPositiveButton(android.R.string.ok, null); builder.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override @TargetApi(Build.VERSION_CODES.M) public void onDismiss(final DialogInterface dialog) { requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE

Eclipse - Empty Logcat with Android 7

China☆狼群 提交于 2019-11-27 20:27:13
I recently updated my Nexus 9 Tablet to Android 7 Nougat. Since then the Logcat view in Eclipse stoped displaying Logcat messages, the view just stays empty. Also the devices target is shown as "Unknown". If I instead start Logcat outside Eclipse (AndroidSDK->tools->ddms) it displays all messages. However, then the "Application" Column stays empty. There are allready some (older) questions on this topic here on SO, but none of the solutions here worked for me. What i tryed: Use another USB Port Focus the device in the DDMS perspective Restart Eclipse Reboot the device + pc abd kill-server

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

五迷三道 提交于 2019-11-27 19:10:58
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; private File finalFile = null; private ImageView imageView; private PermissionUtil permissionUtil; Uri

Android N Java8 java.time

扶醉桌前 提交于 2019-11-27 15:01:19
I updated to the latest Android N sdk. The only thing I don't understand is why I cannot import java.time into my code? I thought Java8 is available through Android N. Then why didn't Google add java.time package? Maheshwar Ligade Android N is not supporting all the features of Java 8. Following features are only supported: Default and static interface methods Lambda expressions Repeatable annotations Reflection and language-related APIs: java.lang.FunctionalInterface java.lang.annotation.Repeatable java.lang.reflect.Method.isDefault() and Reflection APIs associated with repeatable annotations

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

做~自己de王妃 提交于 2019-11-27 14:20:20
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 using thin as the server, running on my development machine, reachable by an N emulator. The self-signed

list certificate stored in user credentials

烈酒焚心 提交于 2019-11-27 13:42:58
问题 In Android 7 Nougat, user installed certificate goes to "User credentials" instead of "Trusted credentials"(which consists of system credential & user credential). I used to access "Trusted credentials" by: KeyStore keystore = KeyStore.getInstance("AndroidCAStore"); through the above code I can then access system & user trusted credentials. But now, in Android 7, user installed certificate goes to a separate place called "User credentials" under Settings --> Security --> User credentials . My

IllegalArgumentException: column '_data' does not exist

瘦欲@ 提交于 2019-11-27 12:13:03
问题 In Nougat, this function is not working. String path = getRealPathFromURI(this, getIntent().getParcelableExtra(Intent.EXTRA_STREAM)); public String getRealPathFromURI(Context context, Uri contentUri) { Cursor cursor = null; try { String[] proj = {MediaStore.Images.Media.DATA}; cursor = context.getContentResolver().query(contentUri, proj, null, null, null); if (cursor == null) return contentUri.getPath(); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor

RuntimeException with Dagger 2 on Android 7.0 and Samsung devices

喜欢而已 提交于 2019-11-27 11:03:20
问题 On my Google Play console I see quite a lot crash reports since I started to use Dagger 2, but only on Android 7.0 and mainly on Samsung devices, some Huawai and Motorola devices and some rare Xperia devices: java.lang.RuntimeException: at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2984) at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3045) at android.app.ActivityThread.-wrap14 (ActivityThread.java) at android.app.ActivityThread$H