实战 QQ demo源码(本例中有该应用)
服务器端下载:http://download.csdn.net/download/knight_black_bob/9822551
android eclipse 版:http://download.csdn.net/download/knight_black_bob/9822553
android stdio 版本:http://download.csdn.net/download/knight_black_bob/9822556
该测试应用 未审核,不能分享 外网图片。。。。。
mainactivity
package com.curiousby.demo.sdkshare; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import cn.sharesdk.framework.ShareSDK; import cn.sharesdk.onekeyshare.OnekeyShare; public class MainActivity extends Activity { Button shareBtn = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ShareSDK.initSDK(getApplicationContext()); shareBtn = (Button) findViewById(R.id.b_sharesdk); shareBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { OnekeyShare oks = new OnekeyShare(); oks.setTitle("[来自fitnesschat]"); oks.setText("测试onekeyshare "); oks.setImageUrl("sdcard/123.png"); oks.show(MainActivity.this); } }); } }
权限
<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" />
添加一个activity
<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> <!-- 调用新浪原生SDK,需要注册的回调activity --> <intent-filter> <action android:name="com.sina.weibo.sdk.action.ACTION_SDK_REQ_ACTIVITY" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>
修改asserts/sharesdk.xml
<ShareSDK AppKey = "150e292ef27a4"/> <!-- 修改成你在sharesdk后台注册的应用的appkey"--> <!-- ShareByAppClient标识是否使用微博客户端分享,默认是false --> <SinaWeibo Id="1" SortId="1" AppKey="1643128983" AppSecret="b6c5c8165e890aa64b9df13db81dbfe8" RedirectUrl="http://www.sharesdk.cn" ShareByAppClient="true" Enable="true" />
粘贴 src /代码 ,以及 res
捐助开发者
在兴趣的驱动下,写一个免费
的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(右上角的爱心标志,支持支付宝和PayPal捐助),没钱捧个人场,谢谢各位。
谢谢您的赞助,我会做的更好!