Company to do the e-commerce app, now to join the contact customer service function, at first thinking is to do an instant chat system, did not do before, the two days began to evil, then the demand changed, to call QQ open platform, do a temporary session on the line, which saves a lot of strength, also do not need to go to the component service end.
Steps:
1. Refer to the QQ SDK source code file.
Create a project and copy the Open-sdk.jar file and the Mta_sdk_x.x.x.jar file to the Libs (or LIB) directory, as shown in:
Select Open-sdk.jar and mta_sdk_x.x.x.ja, select Build path from the right-click menu, select Add to build Path
2. Add the configuration required by the SDK to the androidmanifest of the application;
Add the following configuration under the <application> node of the application's androidmanifest.xml add configuration ( Note: No configuration will cause the API not to be called)
<uses-permission android:name= "Android.permission.INTERNET"/><uses-permission android:name= " Android.permission.ACCESS_NETWORK_STATE "/><application><activity android:name=" Com.tencent.connect.common.AssistActivity " android:theme=" @android: Style/theme.translucent.notitlebar " android:screenorientation= "Portrait"/><activity android:name= "Com.tencent.tauth.AuthActivity" android:nohistory= "true" android:launchmode= "Singletask" > <intent-filter> <action Android:name= "Android.intent.action.VIEW"/><category android:name= "Android.intent.category.DEFAULT"/> <category android:name= "Android.intent.category.BROWSABLE"/> <data android:scheme= "Tencent your AppID"/ > </intent-filter></activity><application>
Where you have added "Android.permission.INTERNET" and "Android.permission.ACCESS_NETWORK_STATE" permissions, you do not need to add them again.
and "Your AppID" to replace the specific application of AppID, such as your AppID is "222222", then the <data> tag should be:
<data android:scheme= "tencent222222"/>
3. Writing Android Code
String text = (string) tittle.gettext (); Qqauth Mqqauth = qqauth.createinstance ("10000000", Mcontext); 10000000 the App_id,mcontext applied for you is the context WPA MWPA = new WPA (this, Mqqauth.getqqtoken ()); String ESQ = "512821255"; 512821255 QQ number for customer service int ret = mwpa.startwpaconversation (ESQ, "Hello, I am happy to see this commodity ~\n" +text); Customer service QQIF (ret! = 0) {//if RET is not 0, it means that the calling SDK has an error toast.maketext (Getapplicationcontext (), "Sorry, there was an error in contacting customer Service ~." ERR: "+ ret, Toast.length_long). Show ();}
Text in the content I get is the Product Details page of the title text, do contact customer service opening Tips