OnNewIntent never called

MichalKukucaMichalKukuca USMember ✭✭
edited September 2015 in Xamarin.Android

Hi.

I have 2 "applications" , let's say A and B.

App A consists of 2 activities, SplashScreen and MainActivity.

Here is a part of my source code(app A):


[Activity(MainLauncher = true, Theme = "@style/Theme.Splash", NoHistory = true)]
public class SplashScreen : Activity {
protected override void OnNewIntent(Intent intent) {...}


[Activity(ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, WindowSoftInputMode = SoftInput.AdjustPan,LaunchMode=LaunchMode.SingleTop)]
public class MainForm : FormsApplicationActivity {
protected override void OnNewIntent(Intent intent) {...}

I'd like to start app A from app B.

This is how i start the A app:

var i = Application.Context.ApplicationContext.PackageManager.GetLaunchIntentForPackage("A");
i.SetFlags(ActivityFlags.SingleTop | ActivityFlags.NewTask);
i.PutExtra("foo", "bar");
StartActivity(i);

Now here goes the problem :)

After starting A app using app B method A.OnCreate is called. That's correct behaviour.
But next try to run app A from app B doesn't trigger onNewIntent.

Where am i making a mistake?

Thanks

Posts

  • MichalKukucaMichalKukuca USMember ✭✭
    edited September 2015

    I forgot to mention some parts of the source code, so here is the update


    [Activity(MainLauncher = true, Theme = "@style/Theme.Splash", NoHistory = true)]
    public class SplashScreen : Activity {
    protected override void OnNewIntent(Intent intent) {...}
    protected override void OnCreate(Bundle bundle)
    {
    base.OnCreate(bundle);
    Intent mainIntent = new Intent(this, typeof(MainForm));
    StartActivity(mainIntent);
    }

Sign In or Register to comment.