I want to set password policy on screen lock and now I use setPasswordQuality(ComponentName admin, int quality) in DevicePolicyManager but this method is deprecated on API 31 and they add new method(setRequiredPasswordComplexity(passwordComplexity : Int)). I can use this method in API < 31? If I can,how should I use it? https://developer.android.com/reference/android/app/admin/DevicePolicyManager#setRequiredPasswordComplexity(int)
Use setRequiredPasswordComplexity(passwordComplexity : Int) in API less than 31
253 Views Asked by nazanin At
2
There are 2 best solutions below
0
Ajay K S
On
I think your problem might solve here. You can check the build version by
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S){
// Do something for version 31 and above versions
} else{
// do something for phones running an SDK before 31
}
Related Questions in ANDROID
- Creating global Class holder
- Flutter + Dart: Editing name of a tab shows up a black screen
- android-pdf-viewer Received status code 401 from server: Unauthorized
- Sdk 34 WRITE_EXTERNAL_STORAGE not working
- ussd reader in Recket Native module
- Incorrect display of LinearGradientBrush in IOS
- The Binary Version Of its metadata is 1.8.0, expected Version is 1.6.0 build error
- I can't make TextInput to auto expand properly in Android
- Creating multiple instances of a class with different initializing values in Flutter
- How to create a lottie animation
- making android analyze with coverity sast tool
- Flutter plugin development android src not opening after opening example
- I initialize my ViewModel in the Activity with several fragments as tabs, but the fragments(tabs) return null for the updated livedata
- Node.js Server + Socket.IO + Android Mobile Applicatoin XHR Polling Error...?
- How I can use the shared preferences class?
Related Questions in KOTLIN
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- ussd reader in Recket Native module
- making android analyze with coverity sast tool
- Jooq - Insert does not update object with generated id
- Doesn't work TrafficStats.clearThreadStatsTag() in Kotlin
- Difference between map and function returning when in Kotlin
- Every Time i run the app it gives me an error related to gradle
- How Do I Create A Path In The pubspec.yaml File?
- Android jetpack compose webview, image selector not works
- Why doesn't CIOEngine have a dispatcher in kotlin script?
- preventing duplicate text
- onCompletion(mp: MediaPlayer?) is unintentionally called after USB storage is connected
- When using a Room database on an Android application, is it possible to pre-populate data
- Jetpack compose - how I can hookup LiveData property from ViewModel with TextField in activity?
- Failed to getEnergyData
Related Questions in PASSWORDS
- Forgotten RAR password recovery
- I'm unable to access 'https://github.com/Danniecodjoe/alx-system_engineering-devops.git/':
- How to get new text input after entering a password in a tab?
- invalid application password of gmail
- Auto-complete doesn't work on Chrome or Edge
- Decrypting Magento 2 customer passwords using email for migration to Shopify
- In two subversion repositories (same machine), can I have different usernames with no password prompting?
- Store website username/password on Elinks for Ubuntu
- Sending Password to a PHP Script
- "error": "The public key is required. Visit https://dashboard.emailjs.com/admin/account"
- im stuck trying to guess a password to a server im accessing through netcat for a ctf
- Hashcat / John the Ripper - find password when you know most of password but don't remember the sequence
- Hashing the password if it is not hashed in django
- How do I change I change my redis docker containers password?
- How to detect password protected file in Angular 14+ without using Promise calls
Related Questions in LOCKSCREEN
- Android 12+: Microphone stops in WebRTC app within a WebView when screen is locked or user switches apps
- Long button tap on LiveActivity
- Check if lock screen instantly with power button enabled/disabled
- After setting 6 digit password lock screen shows only 4 digit to enter the password using DevicePolicyManager Android
- How to Find resources IDs
- Why doesn't full Screen Intent doesn't display on lock screen
- Show Presentation screen on external display while phone is locked
- Lock screen doesn't turn on by full screen intent filter on Android 14
- How to stop the screen from going to sleep
- android capture intruder video from lockscreen
- Lock Windows Slideshow for the Lock Screen
- SwiftUI AVAudioPlayer Lock Screen Control Not Resuming Slideshow on Unlock
- android, how to create a custom UI to show on top of the lockscreen
- Alarm App not able to start Activity when Alarm fires and app is in background in SDK 33 and screen is locked
- Need to detect if lock screen is enabled from windows command line
Related Questions in DEVICE-POLICY-MANAGER
- Grant MANAGE_EXTERNAL_STORAGE And REQUEST_INSTALL_PACKAGES on Android 11+ using DPM and/or Root access
- Prevent work profiles being removed after wipe or factory reset using Android Management API
- After setting 6 digit password lock screen shows only 4 digit to enter the password using DevicePolicyManager Android
- Activate Button is disabled in Device Admin Screen in android
- Facing problem while getting Network & Security Logs for profile owner app
- How to Re-Activate Admin Access using DevicePolicyManager
- Install app restriction on some part of work profile
- How to apply restrictions like set a timelimit for another apps, block certain URLs from my devlopment app in mobile devices?
- Start activity from background on Android 13+ with lock task mode
- Android EMM custom DPC
- Android Lock Phone Programatically without Strong authentication to unlock again
- how to get ADMIN_SIGNATURE_CHECKSUM or ADMIN_PACKAGE_CHECKSUM of my apk?
- "java.lang.SecurityException: Attempt to remove non-test admin" while trying to remove device admin
- Android Management API Installation Policies
- How to get enrollment-specific identifier of an android device?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
As the documentation already states the method was added in API 31 and since there is no backward compatibility library for this so this functionality can only be used on devices with api 31 or above