Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

ActivatableLifetime for Android is not working #16457

Closed
sanyadrobot opened this issue Jul 25, 2024 · 1 comment · Fixed by #16477
Closed

ActivatableLifetime for Android is not working #16457

sanyadrobot opened this issue Jul 25, 2024 · 1 comment · Fixed by #16477
Labels

Comments

@sanyadrobot
Copy link

sanyadrobot commented Jul 25, 2024

Describe the bug

public override void OnCreate(Bundle? savedInstanceState, PersistableBundle? persistentState)
{
// Global IActivatableLifetime expects a main activity, so we need to replace it on each OnCreate.
if (Avalonia.Application.Current?.TryGetFeature()
is AndroidActivatableLifetime activatableLifetime)
{
activatableLifetime.Activity = this;
}
base.OnCreate(savedInstanceState, persistentState);
}

So this thing is never being called. Probably you should override OnCreate(Bundle? savedInstanceState) method. Idk maybe I'm targeting wrong api but as see Avalonia is not using OnCreate(Bundle? savedInstanceState, PersistableBundle? persistentState) method at all and all of the Init things is done inside OnCreate(Bundle? savedInstanceState) method

To Reproduce

ActivatableLifetime returns with Activity = null on Android device

Expected behavior

ActivatableLifetime should work on Android

Avalonia version

11.1.0

OS

Android

Additional context

No response

@YSW33
Copy link

YSW33 commented Jul 25, 2024

You can try,

protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
return base.CustomizeAppBuilder(builder)
.WithInterFont()
.UseReactiveUI();
}

@AvaloniaUI AvaloniaUI locked and limited conversation to collaborators Jul 26, 2024
@maxkatz6 maxkatz6 converted this issue into discussion #16473 Jul 26, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants