Recent company projects add something, the caller is "mobile banking", the callee is "Bankeys", take a time to record, in fact, very simple
1. Caller:
This we can use the normal activity of the startup mode, the code is as follows:
New Intent (); Intent.setaction ("com.bankeys.mobile_sign"); Intent.putextra ("Data" ) 1);
2. Callee:
Add the following code to the manifest file of the activity that needs to be called by the caller app:
<activity android:name= "Com.bankeys.shield.activity.BankBillingDetailsActivity" Android:screenorientation= "Portrait" > <intent-filter > <action android:name= " Com.bankeys.mobile_sign"/> <category android:name=" Android.intent.category.DEFAULT "/> </intent-filter> </activity>
There are two points to note:
①: The Scarlet Letter part of the code is guaranteed to be consistent
②: If the phone is not installed in the call app, when the call will be error, I resolved, through the following code to get all the information on the phone application (filter out the system application):
/*** Non-system application in mobile phone *@paramContext *@return */ Public StaticList<packageinfo>Getnosystemapp (Context context) {List<PackageInfo> list =NewArraylist<packageinfo>(); Packagemanager Pmanager=Context.getpackagemanager (); List<PackageInfo> L = pmanager.getinstalledpackages (0); if(List! =NULL&& l.size ()! = 0){ for(PackageInfo p:l) {if((p.applicationinfo.flags &p.applicationinfo.flag_system) <= 0) {List.add (P); } } } returnlist; }
Android App calls another app