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.

Unity Android Toast Msg and Download Manager

scopevcsscopevcs Posts: 10 Oculus Start Member
edited January 2016 in Oculus Go Development
Hey there,

I'm trying to notify the user in our Unity GearVR app about the current Download Status.

I've build a simple java plugin and can start the native download manager in the background when the user hits the download button.

But I do not know how to render android Toast Messages in the GearVR.
In a Unity 2D project the toast messages appear, but not in the GearVR project.

What is the best way to show android notifications in unity for VR?
Do I have to call the JavaClass functions on a specific thread, like the VR Thread? Because I try this at the moment:
activityContext.Call("runOnUiThread", new AndroidJavaRunnable(() => {
                        toastExample.Call("showMessage", "This is a Toast message");

But no message appears.

Unfortunately I find nothing about Unity and Android Notifcations or Download Managers for VR...
Doesn't have the OVR Unity plugin support for something like that because I find lot of android java functions in some of the SDK files but I do not know how to call them from unity...

Is there anyone who can help with this?

Thanks,
Phil

Comments

  • kilogoldkilogold Posts: 32
    Brain Burst
    Do you REALLY need to use the Java api to display a notification?
    It seems like having to invoke such lower-level implementation is more trouble than it is worth, considering you can slap a uGUI label in your game to display the status of your download method/coroutine.
    For example (pseudo-code):
     var scene: String;
     var path: String;
     var download: WWW;    
     
     function Start () 
     {
             download = WWW.LoadFromCacheOrDownload (path);
             yield download;
             
             // Handle error
             if (download.error != null)
             {
                 Debug.LogError(download.error);
                 return;
             }
             
             var bundle = download.assetBundle;           
     }
       
     function Update () 
     {    
         Debug.Log("Downloading"+download.progress);    
     }
    

    Why go through the low level trouble for such a menial task?
  • I ran into the same problem with toasts as did the OP; they work in a regular android build, but not in VR mode. I never dug much deeper than that (as its easy enough to replicate the behavior from within Unity, as kilogold suggests), but I'd be curious to know if anyone has a solution, or at the very least an explanation of what the underlying issue is.
  • infinite360vrinfinite360vr Posts: 25
    Brain Burst
    Sonar-360 said:
    I've build a simple java plugin and can start the native download manager in the background when the user hits the download button.
    How did you implement the plugin. I am trying to do the same. Any pointers?
  • infinite360vrinfinite360vr Posts: 25
    Brain Burst
    Thanks a lot @gconvergen :)
Sign In or Register to comment.