Actual combat QQ demo source code (this application is included in this example)
Server-side download : http://download.csdn.net/download/knight_black_bob/9822551
android eclipse version : http://download.csdn.net/download/knight_black_bob/9822553
android stdio version : http://download.csdn.net/download/knight_black_bob/9822556
The test application has not been reviewed and cannot share pictures on the Internet. . . . .
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("[from fitnesschat]"); oks.setText("Test onekeyshare "); oks.setImageUrl("sdcard/123.png"); oks.show(MainActivity.this); } }); } }
permission
<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"/> <!-- Permissions required for Bluetooth sharing--> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
add an 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> <!-- Call Sina native SDK, need to register callback 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>
Modify asserts/sharesdk.xml
<ShareSDK AppKey = "150e292ef27a4"/> <!-- Change it to the appkey of the app you registered in the sharesdk background"--> <!-- ShareByAppClient identifies whether to use Weibo client to share, the default is false --> <SinaWeibo Id="1" SortId="1" AppKey="1643128983" AppSecret="b6c5c8165e890aa64b9df13db81dbfe8" RedirectUrl="http://www.sharesdk.cn" ShareByAppClient="true" Enable="true" />
Paste src/code, and res
Donate to developers
Driven by interest, I write 免费
something with joy and sweat. I hope you like my work and can support it at the same time. Of course, if you have money to support a money field (the love sign in the upper right corner, support Alipay and PayPal donations), if you have no money to support a personal field, thank you.
Thank you for your sponsorship, I will do better!