15

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.

700 Software
  • 85,281
  • 83
  • 234
  • 341
  • 2
    `All my apps have the same sharedUserId` I would highly suggest not doing that. – Falmarri Jan 22 '11 at 21:51
  • It is necessary from a user perspective that logging in to one app logs in to the others as well. I can either lock the login cookie to my sharedUserId or I can make it publicly available to all apps. Also it is not possible to down the road add a sharedUserId to an app that does not have one without requiring an uninstall and loss of data (unless they fix this in future releases). @Falmarri, All that aside, I would still like to know why it is preferred not to use sharedUserId. – 700 Software Jan 22 '11 at 22:19
  • `All my apps have the same sharedUserId` : Please don't do this unless there is a strong reason. Having sharedUid means a vulnerability in one app can be used to exploit you other apps too on the same device. – damned Aug 16 '22 at 16:05

1 Answers1

35

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.

smith324
  • 13,020
  • 9
  • 37
  • 58