0 votes
by (350 points)
recategorized by

Hi,

I want to use theses 2 functions and the functions don't have effect on my headset.

PropertySetScreenOffDelay
https://sdk.picovr.com/docs/XRPlatformSDK/Unity/en/chapter_seven.html?highlight=sleep#propertysetscreenoffdelay

PropertySetSleepDelay
https://sdk.picovr.com/docs/XRPlatformSDK/Unity/en/chapter_seven.html?highlight=sleep#propertysetsleepdelay

But I got some errors on Android Logcat

Debug ToBService bindTobService
Error ToBService pbsPropertySetScreenOffDelay: not bind ToBService
Error ToBService pbsPropertySetSleepDelay: not bind ToBService
Info UnityMain type=1400 audit(0.0:27783): avc: denied { read } for name="u:object_r:serialno_prop:s0" dev="tmpfs" ino=17296 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:serialno_prop:s0 tclass=file permissive=1
Info UnityMain type=1400 audit(0.0:27784): avc: denied { open } for path="/dev/__properties__/u:object_r:serialno_prop:s0" dev="tmpfs" ino=17296 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:serialno_prop:s0 tclass=file permissive=1
Info UnityMain type=1400 audit(0.0:27785): avc: denied { getattr } for path="/dev/__properties__/u:object_r:serialno_prop:s0" dev="tmpfs" ino=17296 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:serialno_prop:s0 tclass=file permissive=1
Error ToBService onServiceConnected: bind success

Here is how I call the function in my code

public static void Init()
        {
            PXR_Plugin.UPxr_InitAndroidClass();

            //https://sdk.picovr.com/docs/XRPlatformSDK/Unity/en/chapter_seven.html#initaudiodevice
            PXR_System.InitAudioDevice();


            PXR_System.InitSystemService("InitSystemService");
            PXR_System.BindSystemService();


            PXR_System.PropertySetScreenOffDelay(ScreenOffDelayTimeEnum.SIX_HUNDRED, null);
            PXR_System.PropertySetSleepDelay(SleepDelayTimeEnum.ONE_THOUSAND_AND_EIGHT_HUNDRED);
        }

I use Unity 2021.1.14f1
Pico XR Plugin 1.2.3
XR Plugin Management 4.0.1

Have you a solution ?

Thank you

4 Answers

0 votes
by (350 points)
 
Best answer

Hi, I do some tests.

I want to change the brightness and the volume of the headset from my app too.

When I call the changes, the pico opens an android windows about settings and asking "Allow modify system settings"

How can I avoid this windows and how automaticaly allow the changes ?

I think about the android manifest but I didn't find anythings on the setup on the documentation.

0 votes
by (140 points)
edited by

Sorry missclick, how to delete asnwers?)

0 votes
by (2.1k points)
edited by

maybe it works if you try to use a coroutine with a delay? for

   PXR_System.PropertySetScreenOffDelay(ScreenOffDelayTimeEnum.SIX_HUNDRED, null);
        PXR_System.PropertySetSleepDelay(SleepDelayTimeEnum.ONE_THOUSAND_AND_EIGHT_HUNDRED);

or try init service early like in an example

  private void Awake()
{
    PXR_System.InitSystemService(objectName);
    PXR_System.BindSystemService();
}

private void OnDestory()
{
   PXR_Plugin.System.UnBindSystemService();
}
+1 vote
by (2.7k points)
edited by

Make sure Service is bound successfully before calling the interface.
For callback of Service binding success, please add the following code to the initialization script. After Service binding succeed, this method will be called.

public void toBServiceBind(string s){Debug.Log("Bind success.");}

You can try to call the interface(PropertySetScreenOffDelay and PropertySetSleepDelay) after receiving "Bind success".

...