Android according to QQ number jump to QQ chat interface

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.