From their own development of the application in accordance with the QQ number to jump to QQ application Chat interface, the realization is very convenient:
That
StartActivity (new Intent (Intent.action_view, Uri.parse ("MQQWPA://IM/CHAT?CHAT_TYPE=WPA &uin="+qqnum+"&version=1")));
Qqnum (String type) is the QQ number to jump.
However, if you write this code directly, if the computer does not install QQ application, the program will go straight to die, so to be judged:
if(Checkapkexist ( This,"com.tencent.mobileqq") {startactivity (NewIntent (Intent.action_view, Uri.parse ("mqqwpa://im/chat?chat_type=wpa&uin="+qqnum+"&version=1"))); }Else{Toast.maketext ( This,"QQ app not installed on this machine", Toast.length_short). Show (); } Break;
Method Checkapkexit () is as follows:
PublicBoolean checkapkexist (context context, String PackageName) {if(PackageName = =NULL||"". Equals (PackageName))return false; Try{applicationinfo Info=Context.getpackagemanager (). Getapplicationinfo (PackageName, Packagemanager.get_uninstalled_packa GES); return true; } Catch(packagemanager.namenotfoundexception e) {return false; } }
Note: The application package name of QQ is: COM.TENCENT.MOBILEQQ
Android according to QQ number jump to QQ chat interface