ClearPackagePersistentPreferredActivities does not work on Xamarin.Android on Android 10 and Android 11

YD_4851 26 Reputation points
2021-11-18T08:49:26.227+00:00

Hello.

I'm currently working on a COSU app.
I was able to become a device owner and used DevicePolicyManager.AddPersistentPreferredActivity to create a home app on Android 10 and Android 11, but I cannot cancel the home app using ClearPackagePersistentPreferredActivities.

Does ClearPackagePersistentPreferredActivities not work on Xamarin.Android on Android 10 and Android 11?

The Android Developer and Xamarin.Android documentation has been confirmed.

I am sorry for my poor English, but I would appreciate it if you could teach me.

The tool I'm using

=== Visual Studio Community 2019 for Mac ===

Version 8.9.7 (build 8)
Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)
Package version: 612000125

=== Xamarin.Profiler ===

Version :1.6.15.68

=== Xamarin.Android ===

Version :11.2.2.1 (Visual Studio Community)

=== Xamarin.Forms ===

Version: 5.0.0.2244

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,377 questions
{count} votes

Accepted answer
  1. JarvanZhang 23,966 Reputation points
    2021-11-22T08:17:56.523+00:00

    Hello YD4851-4478,​

    Welcome to our Microsoft Q&A platform!

    Starting with Android 9 (API level 28), some admin policies will be marked as deprecated when invoked by a device admin. Existing functionality continues to work for applications targeting the API level 28, though its use is discouraged.

    For more details, you could refer to this doc: https://developers.google.com/android/work/device-admin-deprecation#timelines

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.