zoukankan      html  css  js  c++  java
  • 分享功能

    //各个平台的配置,建议放在全局Application或者程序入口
        {
            //微信    wx12342956d1cab4f9,a5ae111de7d9ea137e88a5e02c07c94d
            PlatformConfig.setWeixin("wx967daebe835fbeac", "5bb696d9ccd75a38c8a0bfe0675559b3");
            //豆瓣RENREN平台目前只能在服务器端配置
            //新浪微博
            PlatformConfig.setSinaWeibo("3921700954", "04b48b094faeb16683c32669824ebdad");
            //易信
            PlatformConfig.setYixin("yxc0614e80c9304c11b0391514d09f13bf");
            PlatformConfig.setQQZone("100424468", "c7394704798a158208a74ab60104f0ba");
            PlatformConfig.setTwitter("3aIN7fuF685MuZ7jtXkQxalyi", "MK6FEYG63eWcpDFgRYw4w9puJhzDl0tyuqWjZ3M7XJuuG7mMbO");
            PlatformConfig.setAlipay("2015111700822536");
            PlatformConfig.setLaiwang("laiwangd497e70d4", "d497e70d4c3e4efeab1381476bac4c5e");
            PlatformConfig.setPinterest("1439206");
        }

    //调出分享面板
        public void open(View v) {
    //        UMImage image = new UMImage(this, "http://www.umeng.com/images/pic/social/integrated_3.png");
          UMVideo video = new UMVideo("http://video.sina.com.cn/p/sports/cba/v/2013-10-22/144463050817.html");
          
          
            new ShareAction(this).setDisplayList(SHARE_MEDIA.SINA,SHARE_MEDIA.QQ/*,SHARE_MEDIA.QZONE,SHARE_MEDIA.WEIXIN,SHARE_MEDIA.WEIXIN_CIRCLE*/)
            
            .withText("来自友盟分享面板")
    //        .withMedia(image)
            .withTargetUrl("http://www.baidu.com")
            .setCallback(umShareListener)
            .open();
            
            /*
             * new ShareAction(this) .setPlatform(SHARE_MEDIA.QQ)
             * .setCallback(umShareListener) .withText("Hello 豆瓣") .withMedia(image)
             * .share();
             */
        }

        public void qq (View v){
            
             new ShareAction(this) .setPlatform(SHARE_MEDIA.QQ)
              .setCallback(umShareListener) .withText("Hello qq") .withTitle("标题").withTargetUrl("http://www.baidu.com")
             .share();
        }
       

      //  必须实现
        private UMShareListener umShareListener = new UMShareListener() {
            @Override
            public void onResult(SHARE_MEDIA platform) {

                Toast.makeText(MainActivity.this, platform + " 分享成功啦",
                        Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onError(SHARE_MEDIA platform, Throwable t) {
                Toast.makeText(MainActivity.this, platform + " 分享失败啦",
                        Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onCancel(SHARE_MEDIA platform) {
                Toast.makeText(MainActivity.this, platform + " 分享取消了",
                        Toast.LENGTH_SHORT).show();
            }
        };
      // 必须调用回调方法
        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            UMShareAPI.get(this).onActivityResult(requestCode, resultCode, data);
        }

    分享微博  写一个Activity  继承  WBShareCallBackActivity

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
        <uses-permission android:name="android.permission.READ_PHONE_STATE" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.READ_LOGS" />
        <uses-permission android:name="android.permission.CALL_PHONE" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
        <uses-permission android:name="android.permission.GET_TASKS" />
        <uses-permission android:name="android.permission.SET_DEBUG_APP" />
        <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
        <uses-permission android:name="android.permission.GET_ACCOUNTS" />
        <uses-permission android:name="android.permission.USE_CREDENTIALS" />
        <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />

    <activity
                android:name="com.umeng.socialize.editorpage.ShareActivity"
                android:excludeFromRecents="true"
                android:theme="@style/Theme.UMDefault" />
            <activity
                android:name="com.umeng.soexample.wxapi.WXEntryActivity"
                android:configChanges="keyboardHidden|orientation|screenSize"
                android:exported="true"
                android:screenOrientation="portrait"
                android:theme="@android:style/Theme.Translucent.NoTitleBar" />
            <activity
                android:name="com.example.shard.WBShareActivity"
                android:configChanges="keyboardHidden|orientation"
                android:screenOrientation="portrait" >
                <intent-filter>
                    <action android:name="com.sina.weibo.sdk.action.ACTION_SDK_REQ_ACTIVITY" />

                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>
            <activity
                android:name="com.sina.weibo.sdk.component.WeiboSdkBrowser"
                android:configChanges="keyboardHidden|orientation"
                android:exported="false"
                android:windowSoftInputMode="adjustResize" >
            </activity>

            <service
                android:name="com.sina.weibo.sdk.net.DownloadService"
                android:exported="false" >
            </service>

            <activity
                android:name="com.tencent.tauth.AuthActivity"
                android:launchMode="singleTask"
                android:noHistory="true" >
                <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="tencent100424468" />
                </intent-filter>
            </activity>
            <activity
                android:name="com.tencent.connect.common.AssistActivity"
                android:screenOrientation="portrait"
                android:theme="@android:style/Theme.Translucent.NoTitleBar" />

            <meta-data
                android:name="UMENG_APPKEY"
                android:value="4eaee02c527015373b000003" >
            </meta-data>
              <meta-data
                android:name="UMENG_CHANNEL"
                android:value="Umeng" >
            </meta-data>

  • 相关阅读:
    微信Jssdk 认证签名
    枚举的变换
    mysql 事务
    Java中的堆和栈
    mysql-索引
    mysql-事务隔离 为什么你改了我还看不见
    mysql 一次更新语句是如何执行的
    mysql-一条sql的执行过程
    随笔
    设计模式之装饰者
  • 原文地址:https://www.cnblogs.com/cuizhe/p/5326848.html
Copyright © 2011-2022 走看看