For the most authoritative learning materials, visit the official website and the demo provided on the official website. Basically, you can use it directly. This is the official website: http://open.weixin.qq.com /.
In the sharing process, the following problems are encountered: The first time you can share a file, you will not be able to call the sharing dialog box in the future. This is not a program issue, but a review is required. The sharing dialog box can be called up only after the review is passed. Don't believe it? Then, you can quit and click share again. Then, the Login Dialog Box will pop up, and there will be no sharing dialog box after login. It's no problem for you.
In addition, when sharing and developing the Android version, the application signature (the signature generation tool provided on the official website is recommended) is determined by the digital certificate used for packaging. Don't believe it? Uninstall the program first, and then rename your application package name. Do not change the digital certificate and run it. Use this signature generation tool to obtain the application signature, which is exactly the same. Therefore, it is better to generate a digital certificate for the official application release. If the signature is not very understandable, see my previous article: http://blog.csdn.net/qianfu111/article/details/9113887
The following is the program source code for simple text sharing. Of course, you also need to import the jar package:
Package COM. example. share; import android. app. activity; import android. OS. bundle; import android. view. menu; import android. view. view; import android. widget. button; import COM. haifei. share. r; import COM. tencent. mm. SDK. openapi. iwxapi; import COM. tencent. mm. SDK. openapi. sendmessagetowx; import COM. tencent. mm. SDK. openapi. wxapifacloud; import COM. tencent. mm. SDK. openapi. wxmediamessage; import COM. tencent. mm. SDK. openapi. wxtextobject; public class mainactivity extends activity {private final string app_id = "wxbd8d9e9f2e348364"; @ override public void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentview (R. layout. activity_main); button sharebtn = (button) findviewbyid (R. id. button1); Final iwxapi API = wxapifacloud. createwxapi (getapplicationcontext (), app_id, true); API. registerapp (app_id); sharebtn. setonclicklistener (new view. onclicklistener () {@ overridepublic void onclick (view V) {// todo auto-generated method stub // share to your circle of friends // initialize a wxtextobject object string text = "share our application"; wxtextobject textobj = new wxtextobject (); textobj. TEXT = text; wxmediamessage MSG = new wxmediamessage (textobj); MSG. mediaobject = textobj; MSG. description = text; sendmessagetowx. REQ Req = new sendmessagetowx. req (); req. transaction = string. valueof (system. currenttimemillis (); req. message = MSG; API. sendreq (req) ;}}) ;}@ override public Boolean oncreateoptionsmenu (menu) {getmenuinflater (). inflate (R. menu. activity_main, menu); Return true ;}}
Here: http://blog.csdn.net/dengbodb/article/details/7840113