I had a working code. It is working fine till Android 13 but from Android 14 it is not working.
Problem: application needs to start a new activity-for-result. On launching new Activity, code is throwing exception.
Code:
ActivityResultLauncher<Intent> myNewActivity = myActivity.registerForActivityResult(
new ActivityResultContracts.StartActivityForResult()
, result -> myActivityResult(getJotterReqNo(), result.getResultCode(), result.getData())
);
myNewActivity.launch(new Intent(getMyActivity().ACTIVITY_TO_LAUNCH));
Exception:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=app.my.application.MyActivity }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2239)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1878)
at android.app.Activity.startActivityForResult(Activity.java:5589)
at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:780)
at androidx.core.app.ActivityCompat$Api16Impl.startActivityForResult(ActivityCompat.java:854)
at androidx.core.app.ActivityCompat.startActivityForResult(ActivityCompat.java:245)
at androidx.activity.ComponentActivity$1.onLaunch(ComponentActivity.java:239)
at androidx.activity.result.ActivityResultRegistry$2.launch(ActivityResultRegistry.java:173)
at androidx.activity.result.ActivityResultLauncher.launch(ActivityResultLauncher.java:47)
at app.my.application.fragments.applicationsList.MainActivity.onListItemClicked(MainActivity.java:241)
at app.my.application.fragments.applicationsList.MainActivity$$ExternalSyntheticLambda5.onItemClick(Unknown Source:6)
As Paul T mentioned, there has been a security change in Android that restricts implicit intents for apps targeting Android 14+.
Option 1 :
Option 2 :
You can read more here,
https://developer.android.com/about/versions/14/behavior-changes-14#security