Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Activity lifecycle for native SDK integration

rupertrupert Posts: 47
Brain Burst
From the native SDK samples I have been able to infer that vrapi_Initialize and vrapi_Shutdown must "bookend" the lifecycle of an Activity. However, if you have a multi-Activity application, are you expected to call these in onResume and onPause for all Activities or should they only be called as part of the overall Application lifecycle?

vrapi_Initialize takes parameter ovrInitParms->ovrJava->ActivityObject so it is implied, but there are no samples to illustrate multi-Activity applications so I want to confirm.


  • mohitkhanmohitkhan Posts: 1
    understand the pastime Lifecycle
    As a person navigates through, out of, and back in your app, the hobby instances on your app transition through one-of-a-kind states of their lifecycle. The interest class affords some of callbacks that permit the hobby to recognize that a country has changed: that the gadget is creating, stopping, or resuming an activity, or destroying the technique in which the interest is living.

    in the lifecycle callback methods, you could declare how your interest behaves whilst the consumer leaves and re-enters the hobby. for instance, if you're constructing a streaming video participant, you would possibly pause the video and terminate the community connection whilst the consumer switches to another app. whilst the user returns, you can reconnect to the network and allow the consumer to renew the video from the identical spot. In other phrases, each callback allows you to carry out precise paintings it really is appropriate to a given trade of kingdom. Doing the proper paintings at the proper time and coping with transitions well make your app extra robust and performant. for example, right implementation of the lifecycle callbacks can assist ensure that your app avoids:

    Crashing if the person gets a telephone name or switches to every other app at the same time as using your app.
    ingesting treasured machine sources whilst the consumer is not actively using it.
    dropping the person's progress if they go away your app and return to it at a later time.
    Crashing or losing the consumer's progress while the screen rotates among panorama and portrait orientation.
  • rupertrupert Posts: 47
    Brain Burst
    @imperativity Good to know. I hadn't paid much attention to OpenXR until now, but it sounds promising.
Sign In or Register to comment.