Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question OnApplicationFocus is not calling inside Teams

Discussion in 'Web' started by nintendaii, Oct 23, 2023.

  1. nintendaii

    nintendaii

    Joined:
    Dec 16, 2019
    Posts:
    14
    We have a WebGL app hosted on server and we added this app to the Teams. We have a functionality that relies on OnApplicationFocus method. This method is working fine in our regular web link, on the web version of Teams BUT not in the actual Teams app. I think this is probably because:
    Mac/Windows OS sends an event that the app has changed the focus (for example we switched from Teams app to Google Chrome) -> this event is captured by Teams codebase => only Teams codebase knows when this event is fired.
    Unity works in the same way BUT only in case if it is a standalone app.
    Any suggestions how we can make the OnApplicationFocus work?
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,979
    „Teams“ is Microsoft Teams?

    You could instead react to pointer enter/exit window instead, perhaps this works better with integration. It may also be possible to write a custom Teams extension - if Teams has an API for extensions - that forwards this event.
     
  3. nintendaii

    nintendaii

    Joined:
    Dec 16, 2019
    Posts:
    14
    Yes, I meant Microsoft Teams.
    The pointer enter/exit sound not bad, but we have our app on the mobile version of Teams app so not sure if that will work fine
     
  4. nintendaii

    nintendaii

    Joined:
    Dec 16, 2019
    Posts:
    14
    I have tried the pointer enter but it didn’t worked (although works fine on browser) Looks like Teams app does not let unity to recognise any app-related events. Any other suggestions?