Search code examples
androidandroid-14

Android - understanding android 14 changes


I am new to android development and want to understand the changes done for android 14 (API level 34).

What happened was the usual flow of activities (from android 13) that we have (A -> B -> C) no longer finishes and returns to A but instead, it goes back to B. Which change from android 14 is causing this?

As I understood from the documentation, implicit and pending intents have some changes but I don't think this is the cause since it opens the activity regardless but maybe I am wrong. The only change I've done so far for android 14 target increment is to specify export behaviour for broadcast receivers.

Any input is appreciated. Many thanks.

Intent code for Activity B

startActivity(new Intent(EnterNameActivity.this, EnterMobileActivity.class));
                            AnimationsHandler.INSTANCE.playActivityAnimation(EnterNameActivity.this, AnimationsHandler.Animations.RightToLeft);

Intent code for Activity C

Intent intent = new Intent();
intent.setAction("FINISH");
sendBroadcast(intent)
finish();

Note that I understand I can just add finish() in Activity B if I don't want it to reappear but I would like to understand why did it work before and why it doesn't now.


Solution

  • It turns out the Intent change for android 14 was the cause of it. It needs to set package name so it directs to the screen correctly.

    // This makes the intent explicit.
    Intent explicitIntent =
            new Intent("com.example.action.APP_ACTION")
    explicitIntent.setPackage(context.getPackageName());
    context.startActivity(explicitIntent);
    

    This answer has the details https://stackoverflow.com/a/77371953/14787959.