android 一键接入新浪微博,腾讯微博,人人网,QQ空间,微信好友圈 (只需5分钟)

时间:2022-05-14 09:10:40

前言

        目前的移动产品,必须整合第三方分享功能,利用其关系链进行病毒式传播。。。


正文

    

       由于已经封装了一个分享SDK,所以开发者需要的操作是:


1. 申请各个平台的App_Key,App_Secret等应用的一些信息。


2.并在OpenAppConstant.java文件中将他们替换即可。


package com.open.share;

/**
 * 
 * 应用在第三方平台的相关信息,比如App_Key,App_Secret等信息
 * 
 * @author yanglonghui
 *
 */
public class OpenAppConstant 
{
        /*
         * 新浪开发相关信息
         * App Key: 2085605553 
         * App Secret: d4e6c096864a3282ce1eedf9dbd40d89
         */
        public static final String SINA_App_Key="";
        public static final String SINA_App_Secret="";
        public static final String SINA_URL_CALLBACK_CONFRIMPAGE="";//确定授权回调
        public static final String SINA_URL_CALLBACK_CANCELPAGE="";//取消授权回调
        
        /*
         * 腾讯开发相关信息
         * App Key:801143182
         * App Secret:a8d8351e1f99596adb58e2c9c1723c9f
         */
        public static final String Tencent_APP_KEY="";
        public static final String Tencent_App_Secret="";
        public static final String Tencent_URL_CALLBACK="";//回调页面
        
        
        /*
         * 人人网
         * 应用ID:198696
         * API Key:550900cbddb644528f7ad0759c71994b
         * Secret Key:928feff901614cea9f02cf0a6da50b61
         */
        public static final String RENREN_APP_ID = "";
        public static final String RENREN_API_KEY = "";
        public static final String RENREN_SECRET_KEY = "";
        public static final String RENREN_URL_CALLBACK = "";//回调页
        
        
        /*
         * QQ空间相关信息
         * App Key:100282939
         * App Secret:4f85116d0abbdf66d05951daf809930b
         */
        public static final String QQZONE_APP_ID="";
        public static final String QQZONE_APP_KEY="";
        public static final String QQZONE_URL_CALLBACK="";//回调页
        public static final String QQZONE_SCOPE="";//授权权限列表
        
        /*
         * 豆瓣
         * App 43a2f13c340a00aa
         * App 0475e962d98a67400d61bc288c9f35c0
         */
        public static final String DOUBAN_APP_KEY="";
        public static final String DOUBAN_KEY_SECRET="";
        public static final String DOUBAN_URL_CALLBACK="";
        public static final String DOUBAN_SCOPE="";
        
        /*
         * 微信
         * App wx3945ec3991782833
         * App Secret:bd5dfe28a80afee10d05e06a4fa57c3d
         */
        public static final String WEIXIN_APP_ID="";
        public static final String WEIXIN_APP_KEY="";
        
        
        //默认的关注用户
        public static final String DEFAULT_SINA_APP_UID="";
        public static final String DEFAULT_Tencent_App_UID="";
}

3.在您的主工程AndroidManifest.xml文件中添加如下代码(即可马上测试了。。。):


         <activity
             android:name= "com.open.share.AuthorizeActivity"
             android:windowSoftInputMode= "adjustResize|stateHidden"
             android:screenOrientation= "portrait" />
            
          <!-- QQ空间 -->
          <activity
android:name= "com.tencent.tauth.AuthActivity"
android:noHistory= "true"
android:launchMode= "singleTask" >
<intent-filter>
<action android:name= "android.intent.action.VIEW" />
<category android:name= "android.intent.category.DEFAULT" />
<category android:name= "android.intent.category.BROWSABLE" />
<data android:scheme= "tencent100282939" />
</intent-filter>
</activity>
 
         <!-- 微信接入 -->
        <activity
             android:name= ".wxapi.WXEntryActivity"
             android:exported= "true" >
         </activity>
        
         <receiver
             android:name= ".wxapi.AppRegister"
             android:permission= "com.tencent.mm.plugin.permission.SEND" >
             <intent-filter>
                 <action android:name= "com.tencent.mm.plugin.openapi.Intent.ACTION_REFRESH_WXAPP" />
             </intent-filter>
         </receiver>
效果图如下: android 一键接入新浪微博,腾讯微博,人人网,QQ空间,微信好友圈 (只需5分钟) Demo可参见github: https://github.com/zz7zz7zz/android-openshare csdn: http://download.csdn.net/detail/zz7zz7zz/5887863

邮箱zz7zz7zz@163.com

微博 http://weibo.com/u/3209971935