cancel
Showing results for 
Search instead for 
Did you mean: 

Issue when forward to new activity

LuisInThisUniverse
Honored Guest

Hi at all!

I'm trying to start another activity with a different panel. From starter template I take the button and prepare the intent.

I want to re-use the original environment and register a new panel for the new activity, but if I try I have this:

 

java.lang.Exception: Native Assert. FILE=Utils/AndroidUtils.cpp:102 MSG=Global asset manager can only be set once
                                                                                                    	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3724)

 

 

This is my target activity:

 

import com.meta.spatial.castinputforward.CastInputForwardFeature
import com.meta.spatial.core.SpatialFeature
import com.meta.spatial.debugtools.HotReloadFeature
import com.meta.spatial.runtime.LayerConfig
import com.meta.spatial.toolkit.AppSystemActivity
import com.meta.spatial.toolkit.PanelRegistration
import com.meta.spatial.vr.VRFeature

class TestActivity : AppSystemActivity() {

    override fun registerFeatures(): List<SpatialFeature> {
        val features = mutableListOf<SpatialFeature>(VRFeature(this), HotReloadFeature(this))
        if (BuildConfig.DEBUG) {
            features.add(CastInputForwardFeature(this))
        }
        return features
    }


    override fun registerPanels(): List<PanelRegistration> {
        return listOf(
            PanelRegistration(R.layout.ui_new_panel) {
                config {
                    themeResourceId = R.style.PanelAppThemeTransparent
                    includeGlass = false
                    width = 2.0f
                    height = 1.5f
                    layerConfig = LayerConfig()
                    enableTransparent = true
                }
            })
    }



}

 

Thanks!  

1 ACCEPTED SOLUTION

Accepted Solutions

dav-s
Meta Employee

If you just want to spawn the 2D panels in the home environment, you can just launch another regular activity as you would in Android. You may need some extra manifest flags to make it not just replace the current window (for example you may need the FLAG_ACTIVITY_NEW_TASK), but things should just work as they would in Android.

Alternatively, like you said, you can launch as many panels as you want and control them by rendering the whole scene in immersive mode with Meta Spatial SDK.

View solution in original post

4 REPLIES 4

ForrestBumpz
Honored Guest

+1 I would like to do the same thing.

dav-s
Meta Employee

Hi! Could you explain your situation a bit more?

I am assuming in the starter sample, you have StarterSampleActivity (immersive activity) and some panel. Are you trying to launch another panel or a different immersive activity?

If it is another panel, your target activity should not be a AppSystemActivity.

If it is a different immersive activity (a separate immersive activity defined in your Manifest), you have to run it in a separate android:process (in your Manifest). Make sure you are not running these processes at once though as this can cause unnecessary resource usage.

After doing a bit more research I realize my particular use case may be slightly different. I’m currently rendering a 2D Activity (I don’t have an AppSystemActivity or ImmersiveActivity). I am wondering if it’s possible to render n number of activities and spawn them all at the same time the same way my current activity does. I couldn’t find any documentation on this and it seems like the only way to do this is to create an immersive activity and spawn panels. Though I would like to know if there’s a way to do this without the immersive activity.

dav-s
Meta Employee

If you just want to spawn the 2D panels in the home environment, you can just launch another regular activity as you would in Android. You may need some extra manifest flags to make it not just replace the current window (for example you may need the FLAG_ACTIVITY_NEW_TASK), but things should just work as they would in Android.

Alternatively, like you said, you can launch as many panels as you want and control them by rendering the whole scene in immersive mode with Meta Spatial SDK.