All my apps have the same sharedUserId. I would like to start a class of another app using the class of my current app. I want to use intent extras but I do not want to use intent URLs. I also would prefer not to have to change the AndroidManifest of my target activity's app.
If both application have the same signature (meaning that both APPS are yours and signed with the same key), you can call your other app activity as follows: Intent LaunchIntent = getActivity(). getPackageManager(). getLaunchIntentForPackage(CALC_PACKAGE_NAME); startActivity(LaunchIntent);
Context.startActivity() The Intent object is passed to this method to launch a new activity or get an existing activity to do something new.
Sending text content putExtra(Intent. EXTRA_TEXT, "This is my text to send.") Intent sendIntent = new Intent();
An explicit intent is one that you use to launch a specific app component, such as a particular activity or service in your app. To create an explicit intent, define the component name for the Intent object—all other intent properties are optional.
Its pretty easy since you have the sharedUserId set.
Intent res = new Intent();
String mPackage = "com.your.package";
String mClass = ".actYouAreLaunching";
res.setComponent(new ComponentName(mPackage,mPackage+mClass));
startActivity(res);
And that's all there is to it. You can add intent extras like you normally would.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With