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 bu开发者_运维技巧t 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.
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.
精彩评论