Profile Owner..

Status
Not open for further replies.
Search This thread

tpoeschl

New member
Dec 6, 2021
2
1
Hello together

since more than 4 Days i stuck on my current app project with the message: "admin componentinfo does not own the profile".

I tried many things - Added an Work Profile programmaticaly - Gave Profile Owner via adb and i dont find the result.

Someone have an Idea, what im doing wrong?


Code to add managed profile:
Java:
    private void provisionManagedProfile()
    {
        Activity activity = this;
        if (null == activity) {
            return;
        }
        Intent intent = new Intent(DevicePolicyManager.ACTION_PROVISION_MANAGED_PROFILE);

        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
            intent.putExtra(
                    DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME,
                    activity.getApplicationContext().getPackageName()
            );
        } else {
            final ComponentName component = new ComponentName(activity,
                    DeviceAdmin.class.getName());
            intent.putExtra(
                    DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME,
                    component
            );
        }

        if (intent.resolveActivity(activity.getPackageManager()) != null) {
            startActivityForResult(intent, 1);
            Toast.makeText(activity, "Already used!",
                    Toast.LENGTH_SHORT).show();

            activity.finish();
        } else {
            Toast.makeText(activity, "Device provisioning is not enabled. Stopping.",
                    Toast.LENGTH_SHORT).show();
        }
    }

Code to use:
Java:
DevicePolicyManager dpm = (DevicePolicyManager) getApplicationContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
dpm.setProfileEnabled(compName);

compName is:
Java:
compName = new ComponentName(this, DeviceAdmin.class);


#Edit
If i start the manged Profile, its crashed after the end before the "next" button showing.
But if i take an look on my settings its showing that this profile was created.

Greetings
 
  • Like
Reactions: t9anef

Clark Joseph Kent

Senior Mod / Moderator & RC-RT Committees Lead
Staff member
Dec 17, 2011
28,656
4
67,711
55
www.marines.com
Samsung Galaxy S24 Ultra
Hello together

since more than 4 Days i stuck on my current app project with the message: "admin componentinfo does not own the profile".

I tried many things - Added an Work Profile programmaticaly - Gave Profile Owner via adb and i dont find the result.

Someone have an Idea, what im doing wrong?


Code to add managed profile:
Java:
    private void provisionManagedProfile()
    {
        Activity activity = this;
        if (null == activity) {
            return;
        }
        Intent intent = new Intent(DevicePolicyManager.ACTION_PROVISION_MANAGED_PROFILE);

        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
            intent.putExtra(
                    DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME,
                    activity.getApplicationContext().getPackageName()
            );
        } else {
            final ComponentName component = new ComponentName(activity,
                    DeviceAdmin.class.getName());
            intent.putExtra(
                    DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME,
                    component
            );
        }

        if (intent.resolveActivity(activity.getPackageManager()) != null) {
            startActivityForResult(intent, 1);
            Toast.makeText(activity, "Already used!",
                    Toast.LENGTH_SHORT).show();

            activity.finish();
        } else {
            Toast.makeText(activity, "Device provisioning is not enabled. Stopping.",
                    Toast.LENGTH_SHORT).show();
        }
    }

Code to use:
Java:
DevicePolicyManager dpm = (DevicePolicyManager) getApplicationContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
dpm.setProfileEnabled(compName);

compName is:
Java:
compName = new ComponentName(this, DeviceAdmin.class);


#Edit
If i start the manged Profile, its crashed after the end before the "next" button showing.
But if i take an look on my settings its showing that this profile was created.

Greetings
Technical discussion of Android development and hacking. No noobs, please. Device-specific releases should go under the appropriate device forum.

 
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Hello together

    since more than 4 Days i stuck on my current app project with the message: "admin componentinfo does not own the profile".

    I tried many things - Added an Work Profile programmaticaly - Gave Profile Owner via adb and i dont find the result.

    Someone have an Idea, what im doing wrong?


    Code to add managed profile:
    Java:
        private void provisionManagedProfile()
        {
            Activity activity = this;
            if (null == activity) {
                return;
            }
            Intent intent = new Intent(DevicePolicyManager.ACTION_PROVISION_MANAGED_PROFILE);
    
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
                intent.putExtra(
                        DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME,
                        activity.getApplicationContext().getPackageName()
                );
            } else {
                final ComponentName component = new ComponentName(activity,
                        DeviceAdmin.class.getName());
                intent.putExtra(
                        DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME,
                        component
                );
            }
    
            if (intent.resolveActivity(activity.getPackageManager()) != null) {
                startActivityForResult(intent, 1);
                Toast.makeText(activity, "Already used!",
                        Toast.LENGTH_SHORT).show();
    
                activity.finish();
            } else {
                Toast.makeText(activity, "Device provisioning is not enabled. Stopping.",
                        Toast.LENGTH_SHORT).show();
            }
        }

    Code to use:
    Java:
    DevicePolicyManager dpm = (DevicePolicyManager) getApplicationContext().getSystemService(Context.DEVICE_POLICY_SERVICE);
    dpm.setProfileEnabled(compName);

    compName is:
    Java:
    compName = new ComponentName(this, DeviceAdmin.class);


    #Edit
    If i start the manged Profile, its crashed after the end before the "next" button showing.
    But if i take an look on my settings its showing that this profile was created.

    Greetings