跳至内容
wiki
用户工具
登录
站点工具
工具
显示页面
修订记录
反向链接
最近更改
媒体管理器
网站地图
登录
最近更改
媒体管理器
网站地图
您的足迹:
分享:技术:原生:android:android分享-sdk集成
本页面只读。您可以查看源文件,但不能更改它。如果您觉得这是系统错误,请联系管理员。
====== Android分享 SDK集成 ====== [[http://www.mob.com/#/downloadDetail/ShareSDK/android|SDK下载]] - 官方网站 [[http://www.mob.com/#/index|]] 集成参考:[[http://bbs.mob.com/forum.php?mod=viewthread&tid=8212|链接]] ===== 1.下载和安装ShareSDK的Android版本 ===== 下载和安装SDK的安装包。 ===== 2.集成SDK ===== Windows下 首先确定已安装JDK,并正确配置JAVA_HOME和PATH系统变量,双击QuickIntegrater启动程序,复制生成的文件到项目中 tips: 1.添加jar包:选择project,进入lib目录,然后‘右键’add to library。自动注册到app.iml。 2.ShareSDK.xml文件需要在 工程app/src/main下创建 assets目录。创建后在app.iml上会自动添加 <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" /> ===== 3.配置AndroidManifest.xml ===== ==== 1)、添加权限 ==== <code> <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"/> <!-- 蓝牙分享所需的权限 --> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> </code> ==== 2)、添加activity信息 ==== <code> <activity android:name="com.mob.tools.MobUIShell" 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> <!--微信分享回调 --> <activity android:name=".wxapi.WXEntryActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="true" android:screenOrientation="portrait" /> <!--易信分享回调 --> <activity android:name=".yxapi.YXEntryActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="true" android:screenOrientation="portrait" /> <!-- QQ客户端回调 --> <activity android:name="cn.sharesdk.tencent.qq.ResultReceiver" android:launchMode="singleTask" android:noHistory="true"> <!-- 如果集成QQ分享,或者使用QQ客户端来进行QQ空间的分享,须要在此处添加一个对ACTION_VIEW 事件的过滤器,其中的scheme是“tencent”前缀再开发者应用的加上appId。如果此过滤器不设置, 则分享结束以后不能得到正确的回调 --> <intent-filter android:priority="1000" > <data android:scheme="tencent100371282" /> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter> </activity> <!-- 支付宝分享回调 --> <activity android:name=".apshare.ShareEntryActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboardHidden|orientation|screenSize" android:exported="true"/> </code> ==== 3)、在ShareSDK.xml文件中替换mob后台申请的Appkey与各个平台申请的key ==== <code> 1、表格中的第一项<ShareSDK AppKey="api20" /> 是必须的,其中的AppKey是您在ShareSDK上注册的开发者帐号的AppKey 2、所有集成到您项目的平台都应该为其在表格中填写相对应的开发者信息,以新浪微博为例: <SinaWeibo Id="1" SortId="1" AppKey="568898243" AppSecret="38a4f8204cc784f81f9f0daaf31e02e3" RedirectUrl="http://www.mob.com" Enable="true" /> 其中的SortId是此平台在分享列表中的位置,由开发者自行定义,可以是任何整型数字,数值越大 越靠后AppKey、AppSecret和RedirectUrl是您在新浪微博上注册开发者信息和应用后得到的信息 Id是一个保留的识别符,整型,ShareSDK不使用此字段,供您在自己的项目中当作平台的识别符。 Enable字段表示此平台是否有效,布尔值,默认为true,如果Enable为false,即便平台的jar包 已经添加到应用中,平台实例依然不可获取。 各个平台注册应用信息的地址如下: 新浪微博 http://open.weibo.com 腾讯微博 http://dev.t.qq.com QQ空间 http://connect.qq.com/intro/login/ 微信好友 http://open.weixin.qq.com Facebook https://developers.facebook.com Twitter https://dev.twitter.com 人人网 http://dev.renren.com 开心网 http://open.kaixin001.com 搜狐微博 http://open.t.sohu.com 网易微博 http://open.t.163.com 豆瓣 http://developers.douban.com 有道云笔记 http://note.youdao.com/open/developguide.html#app 印象笔记 https://dev.evernote.com/ Linkedin https://developer.linkedin.com FourSquare https://developer.foursquare.com/ 搜狐随身看 https://open.sohu.com/ Flickr http://www.flickr.com/services/ Pinterest http://developers.pinterest.com/ Tumblr http://www.tumblr.com/developers Dropbox https://www.dropbox.com/developers Instagram http://instagram.com/developer# VKontakte http://vk.com/dev 易信好友 http://open.yixin.im/ 明道 http://open.mingdao.com/ Line http://media.line.me/zh-hant/ Pocket http://getpocket.com/developer/apps/new </code> ===== 添加分享代码 ===== 在代码中调用此方法,即可进行分享 <code java> private void showShare(){ ShareSDK.initSDK(context); OnekeyShare oks = new OnekeyShare(); // 分享时Notification的图标和文字 //oks.setNotification(R.drawable.ic_launcher, getString(R.string.app_name)); oks.setText("我是分享文本"); oks.setImageUrl("http://f1.sharesdk.cn/imgs/2014/05/21/oESpJ78_533x800.jpg"); // 启动分享GUI oks.show(context); } </code> {{:分享:技术:原生:android:share.jpg|}}
分享/技术/原生/android/android分享-sdk集成.txt
· 最后更改: 2016/03/30 10:47 由
gxx
页面工具
显示页面
修订记录
反向链接
回到顶部