Official website of Android-shareSDK and sharesdk
1. When Data:
Address: http://sharesdk.mob.com/Download
2. Integrated Data:
Doscommand: java-jar QuickIntegrater. jar (enter your project name and package name)
Copy the compiled code into your project,
Modify ShareSDK. xml in assets, for example, display a shared class.
3. Add Permissions
<Uses-permission android: name = "android. permission. GET_TASKS"/>
<Uses-permission android: name = "android. permission. INTERNET"/>
<Uses-permission android: name = "android. permission. ACCESS_WIFI_STATE"/>
<Uses-permission android: name = "android. permission. ACCESS_NETWORK_STATE"/>
<Uses-permission android: name = "android. permission. CHANGE_WIFI_STATE"/>
<Uses-permission android: name = "android. permission. WRITE_EXTERNAL_STORAGE"/>
<Uses-permission android: name = "android. permission. READ_PHONE_STATE"/>
<Uses-permission android: name = "android. permission. MANAGE_ACCOUNTS"/>
<Uses-permission android: name = "android. permission. GET_ACCOUNTS"/>
4. Add activity information
<Activity
Android: name = "cn. sharesdk. framework. ShareSDKUIShell"
Android: theme = "@ android: style/Theme. Translucent. NoTitleBar"
Android: configChanges = "keyboardHidden | orientation | screenSize"
Android: screenOrientation = "portrait"
Android: windowSoftInputMode = "stateHidden | adjustResize">
<Intent-filter>
<Data android: scheme = "tencent100371282"/>
<Action android: name = "android. intent. action. VIEW"/>
<Category android: name = "android. intent. category. BROWSABLE"/>
<Category android: name = "android. intent. category. DEFAULT"/>
</Intent-filter>
</Activity>
If you have integrated, you also need to add the Activity
<! -- Share callback -->
<Activity
Android: name = ". wxapi. WXEntryActivity"
Android: theme = "@ android: style/Theme. Translucent. NoTitleBar"
Android: configChanges = "keyboardHidden | orientation | screenSize"
Android: exported = "true"
5. Share the code (modify it by yourself)
Private void showShare (){
ShareSDK. initSDK (this );
OnekeyShare oks = new OnekeyShare ();
// Disable sso authorization
Oks. disableSSOWhenAuthorize ();
// Notification icons and text during sharing
Oks. setNotification (R. drawable. ic_launcher, getString (R. string. app_name ));
// Title, Evernote, email, information, Renren and QQ space
Oks. setTitle (getString (R. string. share ));
// TitleUrl is the network link of the title, which is only used in Renren's network and QQ space.
Oks. setTitleUrl ("http://sharesdk.cn ");
// Text is the shared text, which is required by all platforms
Oks. setText ("I am sharing text ");
// ImagePath is the local path of the image, which is supported by platforms other than Linked-In.
Oks. setImagePath ("/sdcard/test.jpg ");
// The url is only used in (including friends and friends)
Oks. setUrl ("http://sharesdk.cn ");
// Comment is my comment on this article, which is only used by Renren and QQ.
Oks. setComment ("I'm a test comment ");
// Site is the name of the website that shares the content. It is only used in the QQ space.
Oks. setSite (getString (R. string. app_name ));
// SiteUrl is the address of the website that shares the content. It is only used in the QQ space.
Oks. setSiteUrl ("http://sharesdk.cn ");
// Start the sharing GUI
Oks. show (this );
}
6. Cannot share:
1. The test is not packaged.
2. the packaged keystore is inconsistent with that on the open platform, resulting in inconsistent MD5 codes.
Test the packaged md5 check> https://open.weixin.qq.com/zh_CN/htmledition/res/dev/download/sdk/Gen_Signature_Android.apk
Address: https://open.weixin.qq.com/
3. Incorrect sharing Parameters
4. Application not approved
5. The package name is inconsistent with that on the open platform.