Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Intents: Start activity using class name from another app that has the same sharedUserId

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.

like image 534
700 Software Avatar asked Jan 22 '11 21:01

700 Software


People also ask

How do I open a particular activity for another app on android?

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);

Which method is used to launch a new activity or get an existing activity to do something new?

Context.startActivity() The Intent object is passed to this method to launch a new activity or get an existing activity to do something new.

How do I send Intent to another app?

Sending text content putExtra(Intent. EXTRA_TEXT, "This is my text to send.") Intent sendIntent = new Intent();

How do you make an explicit 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.


1 Answers

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.

like image 172
smith324 Avatar answered Oct 04 '22 04:10

smith324