Device Admin弃用后,targetSdkVersion26的相机管控在安卓P/Q上仍可用吗?
Great question—let’s break this down clearly based on the Android versions you’re concerned about:
Android P (API 28)
If your app targets SDK 26, the Device Admin-based camera enable/disable functionality will work completely normally on Android P. No extra steps are needed here: Android P still fully supports the Device Admin APIs you’re using, and since your target SDK is lower than 28, the system won’t impose any new restrictions on this feature.
Android Q (API 29)
Even though the Device Admin camera control APIs were marked as deprecated in Android 10, your app will still function as intended here when targeting SDK 26. Android’s backward compatibility framework ensures that apps with lower target SDK versions retain access to old API behaviors—so you can keep enabling/disabling the camera without modifying your code.
A couple of quick notes for Android Q:
- Deprecation doesn’t mean immediate removal: the API still works, but Google recommends moving away from it for future app updates.
- You might see minor system UI hints (like a subtle warning to users about outdated app features), but this won’t break your core camera control functionality.
Key Takeaway
You don’t need to make any extra changes to your app right now. The camera管控 feature will run reliably on both Android P and Q while targeting SDK 26. If you plan to upgrade your target SDK to 29 or higher later, you’ll need to migrate to alternative management APIs (like those for work profiles or managed devices), but that’s a separate task for down the line.
内容的提问来源于stack exchange,提问作者yanivtwin

