[Android] sharesd--content sharing and SMS verification

Source: Internet
Author: User

Preface

The new version SHARESDK share and SMS verification, according to the official website of the document, need to add a <Activity></Activity> tag, and share and short-term verification of this tag content is the same. Will conflict.

Workaround: Share with old version, SMS verification with new version. There will be a solution later.


Share

Import engineering See initial Knowledge sharesdk--embedding and landing

<span style= "FONT-SIZE:24PX;" >onekeyshare OKs = new Onekeyshare ();//All SSO is for Sina Weibo doks.disablessowhenauthorize (); Oks.setsilent (true); </ Span>
Ifif no sharing platform is specified, all default platforms will jump out.

Oks.setplatform (PlatformName);

Some notes that need to be noted are very detailed.

<span style= "White-space:pre" ></span><span style= "FONT-SIZE:24PX;" >//share notification icon and text 2.5.9 later versions do not call this method <span style= "White-space:pre" ></span>// Oks.setnotification (R.drawable.ic_launcher, getString (r.string.app_name)); <span style= "White-space:pre" ></span>//title, Evernote, email, information, Renren and QQ space use Oks.settitle (getString ( R.string.share)); <span style= "White-space:pre" ></span>//Titleurl is the title of the network link, only in Renren and QQ space use Oks.settitleurl ("http://sharesdk.cn"); <span style= "White-space:pre" ></span>//text is to share text, all platforms need this field <span style= "White-space:pre" >< /SPAN>//have Word limit oks.settext ("I am sharing text"), <span style= "White-space:pre" ></span>//ImagePath is the local path of the picture, This parameter is supported on platforms other than linked-in (if not locally, subsequent statements will not be executed) <span style= "White-space:pre" ></span>//oks.setimagepath ("/ Sdcard/test.jpg ");//Make sure SDcard has this picture <span style=" White-space:pre "></span>//oks.setimageurl (" = ");// Network path QQ Space sometimes sharing is not successful (permissions issue) <span style= "White-space:pre" >&The lt;/span>//URL only uses Oks.seturl ("http://sharesdk.cn") in (including friends and friends circles); Comment is my comment on this share, only in Renren and QQ space use Oks.setcomment ("I am the test Review text"); Site is the name of the website sharing this content, only in the QQ space use Oks.setsite (getString (r.string.app_name)); SiteURL is to share this content of the website address, only in the QQ space use Oks.setsiteurl ("http://sharesdk.cn"); Set latitude and longitude (can be obtained according to location)//oks.setlatitude (latitude);  Oks.setlongitude (longitude); Start sharing GUI (graphical user interface) Oks.show (this);</span>

SMS Verification

Official website Download SDK



Copy the Smssdk file under the SMS folder into the project and import it as a library.

Add Permissions:

    <uses-permission android:name= "Android.permission.READ_CONTACTS"/>    <uses-permission android:name= " Android.permission.READ_PHONE_STATE "/>    <uses-permission android:name=" android.permission.WRITE_ External_storage "/>    <uses-permission android:name=" Android.permission.ACCESS_NETWORK_STATE "/>    <uses-permission android:name= "Android.permission.ACCESS_WIFI_STATE"/>    <uses-permission android: Name= "Android.permission.INTERNET"/>    <uses-permission android:name= "Android.permission.RECEIVE_SMS"/ >    <uses-permission android:name= "Android.permission.GET_TASKS"/>    <uses-permission android: Name= "Android.permission.ACCESS_FINE_LOCATION"/>

Add code Call:

SMSSDK.INITSDK (This, App_key, App_secret); Registerpage page = new Registerpage ();p age.setregistercallback (new EventHandler () {@Overridepublic void afterevent ( int event, int result, Object data) {if (result = = Smssdk. Result_complete) {hashmap<string,object> Phonemap = (hashmap<string, object>) data; String country = (string) phonemap.get ("Country"); String phone = (string) phonemap.get ("Phone"); To submit user information, this method is to get the action you want to take after the phone. RegisterUser (country, phone); System.out.println (Country+phone);}}); Page.show (this);

SHARESDK new version SMS verification and sharing conflict resolutionbecause in the new version of SHARESDK in the sharing and verification, mainfest in the name is "Com.mob.tools.MobUIShell" in a project will conflict.
Share:the mainfest file node
        <activity            android:name= "Com.mob.tools.MobUIShell"            android:configchanges= "keyboardhidden|orientation |screensize "            android:screenorientation=" Portrait "            android:theme=" @android: style/ Theme.Translucent.NoTitleBar "            android:windowsoftinputmode=" Statehidden|adjustresize ">


instead:
        <activity            android:name= "Cn.sharesdk.framework.ShareSDKUIShell"            android:configchanges= " Keyboardhidden|orientation|screensize "            android:screenorientation=" Portrait "            android:theme=" @android: Style/theme.translucent.notitlebar "            android:windowsoftinputmode=" Statehidden|adjustresize ">


will be share in the Libs
The corresponding 2.6.0 is replaced by theSMS verification is not changed.

[Android] sharesd--content sharing and SMS verification

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.