android-7.0-nougat

SecureRandom provider “Crypto” unavailable in Android N for deterministially generating a key

北城余情 提交于 2019-11-29 04:22:30
Users can purchase a "Pro" version of my app. When they do, I store and verify their purchase as follows. Combine the user's UUID and another unique string. The resulting string is then encrypted using a static seed. I do this using SecureRandom.getInstance("SHA1PRNG", "Crypto") - This is the problem! The resulting encrypted string is then the "unlock code". Therefore, I always know the expected unique unlock code value for the user. When the user purchases "Pro", I store the "unlock code" in the database. I check to see whether the user has "Pro" by seeing if the stored "unlock code" in the

Android 7.0 and 7.1 getApplication() ClassCastException

我们两清 提交于 2019-11-29 01:50:40
问题 In Developer Console I see a lot of crashes with stacktrace like this 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:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android

list certificate stored in user credentials

我怕爱的太早我们不能终老 提交于 2019-11-28 21:19:56
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 question is how can I programmatically list the credentials inside User credentials in Android 7? To

IllegalArgumentException: column '_data' does not exist

霸气de小男生 提交于 2019-11-28 20:26:01
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.moveToFirst(); return cursor.getString(column_index); } finally { if (cursor != null) { cursor.close(); }

RuntimeException with Dagger 2 on Android 7.0 and Samsung devices

北战南征 提交于 2019-11-28 17:51:31
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.handleMessage (ActivityThread.java:1642) at android.os.Handler.dispatchMessage (Handler.java:102) at android.os

Get Device mac adress in Android Nougat and O programmatically

强颜欢笑 提交于 2019-11-28 10:10:35
问题 I have an application, which required device mac address. I'm getting mac address in Marshmallow and below easily but problem with android nougat and O. So how to find mac. 回答1: Changed since 6.0 and later: https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-hardware-id To provide users with greater data protection, starting in this release, Android removes programmatic access to the device’s local hardware identifier for apps using the Wi-Fi and

Android N - Cannot run on lower API though minSDK set to 14

不羁岁月 提交于 2019-11-28 09:47:32
I am trying to run the APK on API 22 device after updating compileSdkVersion to N but unable to do so. compileSdkVersion 'android-N' buildToolsVersion "24.0.0 rc1" defaultConfig { minSdkVersion 14 targetSdkVersion 'N' } Out of the box, the build tools are set up to block you from running N Developer Preview apps on older devices. Presumably, this is a sloppy way for Google to try to prevent people from shipping stuff built off of the preview. This approach was also used in the past two developer previews. So, Google does not want you testing your N Developer Preview app on your Android 5.0

java.lang.NullPointerException with Nougat

拜拜、爱过 提交于 2019-11-28 07:35:56
My app has been humming along nicely through various Android versions. I have users running it on Android 4.3, 5.0, 5.1 and 6.0 with no problems. However a user with a S7 Edge has just updated with Android 7.0 and the app is crashing when text is pasted into an EditText field (This is the first and only thing you do with this app - it starts you paste in text into a box and then the app parses the text). I have looked at many threads on Null Pointer Exceptions and I have looked at the source for Editor.java but nothing is obvious. The stack trace below shows no problems with my code. Any ideas

How to get the current locale (API level 24)?

落爺英雄遲暮 提交于 2019-11-28 02:27:34
问题 I was doing this way: context.getResources().getConfiguration().locale Configuration.locale is deprecated if target is 24. So I made this change: context.getResources().getConfiguration().getLocales().get(0) Now it says that it's only for minSdkVersion 24, so I cannot use it because my min target is lower. What's the right method? 回答1: Check which version you're running on and fallback to the deprecated solution: Locale locale; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { locale =

Android Nougat: Why do checkboxes on Fragment have incomplete state when selected programmatically (but look fine on Lollipop)

☆樱花仙子☆ 提交于 2019-11-28 00:09:18
问题 Here is what my settings tab (Fragment) looks like before any selections are made: From the main Fragment the user can make a selection from the Spinner -- looks like the following (after the user has made a choice): When the user makes that selection, choices the user has previously chosen which are saved in the User Prefs are loaded and the appropriate checkboxes are selected. Checkboxes which were shown in first snapshot now look like the following: See, the items which now have associated