Power Off a rooted android Tablet from Unity

Hi.
I’m making a project for my tablet in android, and I have rooted it (super user).
Now I want to create a button from unity, to call a function from a Android Java library in .jar format.
This is the .jar code:

package com.arbit.apagadolibrary;

import android.os.Bundle;
import android.os.PowerManager;

public class EjecutaApagado {
    static void Apaga() {
        try {
            Process proc = Runtime.getRuntime()
                    .exec(new String[]{"su", "-c", "reboot -p"});
            proc.waitFor();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

Then from my Unity app, I call it with the code as below:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PluginApagado : MonoBehaviour
{

    private AndroidJavaObject javaClass;
   
    // Start is called before the first frame update
    void Start() {

      
        }
    public void ApagaAca()
    {
        javaClass = new AndroidJavaObject(".com.arbit.apagadolibrary.EjecutaApagado");
        javaClass.Call("Apaga");
        Debug.Log("apretado A");

    }
       
           
}

But when I run the app, and then press the button linked to that script, the app closes. And doesn’t power off the tablet.
So, has anyone some idea what should I do? Is it a manifest problem?

I will appreciate so much the help.
Thanks!

Did you get any intel from adb logcat?

That should complain if it was a permissions thing, or some kind of java class issue.

Beyond that, lots of Debug.Log() at the Unity level might give more intel.

With Android you never know: it could be something weird like you need to stand up a special activity that can “survive through shutdown” and actually keep shutting stuff down on the way.