Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android 10+] OnActivated not called. App lifecycle with Deeplink flow #5076

Closed
4 tasks done
vincentcastagna opened this issue Jan 29, 2021 · 2 comments · Fixed by #5094
Closed
4 tasks done

[Android 10+] OnActivated not called. App lifecycle with Deeplink flow #5076

vincentcastagna opened this issue Jan 29, 2021 · 2 comments · Fixed by #5094
Assignees
Labels
kind/bug Something isn't working project/non-ui ⚙️ Categorizes an issue or PR as relevant to winrt (non-ui)
Milestone

Comments

@vincentcastagna
Copy link

vincentcastagna commented Jan 29, 2021

Current behavior

This issue has been identified on Android 10+ (11) devices, it seems like its not behaving the same on Android 7,8 and 9.

Giving scenario when an email is sent to the device with a deeplink to an application :

  1. App put OnPause through back button on android

    • OnPause() hit in MainActivity
    • Go to email client, click on deeplink
    • OnActivated() called, and then OnResume()
    • Deeplink handling is OK
  2. App put OnPause through home button

    • OnPause() hit in MainActivity
    • Go to email client, click on deeplink
    • OnRestart() called, and then OnResume()
    • OnActivated() is not called at all
    • Deeplink handling not ok (as we do not reach OnActivated())

Note : On Android 7,8,9 it seems like OnActivated() is called between OnRestart() and OnResume(), explaining why it works every time.

Also, seems like giving a certain amount of time, we hit theOnActivated()method on Android 10, but it's random and inconsistent, I didn't find a real flow to reproduce this. Sometimes it is called, sometimes not

Expected behavior

Given scenario 2 should behave the same as 1 and call OnActivated(). It seems like because OnRestart() is called in the second flow, it takes precedence on OnActivated().

Workaround

  • None at the moment ...

Environment

Nuget Package:

  • Uno.UI - 3.1.0-beta.76
  • Uno.SourceGenerationTasks - 3.0.0-dev.78

Affected platform(s):

  • Android 10+

IDE:

  • Visual Studio 2019 (version: 16.8.4 )
@vincentcastagna vincentcastagna added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Jan 29, 2021
@andreaSflores18
Copy link

The issue seems to occur on Android 11 as well.

@MartinZikmund MartinZikmund self-assigned this Jan 29, 2021
@MartinZikmund MartinZikmund added project/non-ui ⚙️ Categorizes an issue or PR as relevant to winrt (non-ui) and removed triage/untriaged Indicates an issue requires triaging or verification labels Jan 29, 2021
@MartinZikmund MartinZikmund added this to the 3.5 milestone Jan 29, 2021
MartinZikmund added a commit to MartinZikmund/Uno that referenced this issue Feb 1, 2021
- Fixes unoplatform#5076. In case the application activity is in SingleTask mode, OnNewIntent is called to set the intent. This occurs after Activity OnStarted, so we need to check whether the intent should be handled (by OnActivated for example)
@mergify mergify bot closed this as completed in #5094 Feb 2, 2021
mergify bot pushed a commit that referenced this issue Feb 2, 2021
- Fixes #5076. In case the application activity is in SingleTask mode, OnNewIntent is called to set the intent. This occurs after Activity OnStarted, so we need to check whether the intent should be handled (by OnActivated for example)

(cherry picked from commit 5ab623d)
vincentcastagna pushed a commit that referenced this issue Feb 2, 2021
- Fixes #5076. In case the application activity is in SingleTask mode, OnNewIntent is called to set the intent. This occurs after Activity OnStarted, so we need to check whether the intent should be handled (by OnActivated for example)
@MartinZikmund MartinZikmund reopened this Feb 4, 2021
@MartinZikmund
Copy link
Member

This works, the PR is not required to resolve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working project/non-ui ⚙️ Categorizes an issue or PR as relevant to winrt (non-ui)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants