zoukankan      html  css  js  c++  java
  • 第三方登陆

    首先在AndroidManifest.xml中加上一系列权限

       <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" />

    导入第三方库 删除本项目libs包下的v4包

    然后给  application  添加 name 找到自定义的application类

    添加    key值

    <meta-data
                android:name="UMENG_APPKEY"
                android:value="ZIpppsYuaMyfvdS705RuySvd" >
            </meta-data>

    然后      微信

    <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.umeng.WXEntryActivity"
                android:configChanges="keyboardHidden|orientation|screenSize"
                android:exported="true"
                android:screenOrientation="portrait"
                android:theme="@android:style/Theme.Translucent.NoTitleBar" />

     <!-- qq -->
            <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="tencent1105184367" />
                </intent-filter>
            </activity>
            <activity
                android:name="com.tencent.connect.common.AssistActivity"
                android:screenOrientation="portrait"
                android:theme="@android:style/Theme.Translucent.NoTitleBar" />

    <!-- 微博 -->
            <activity
                android:name=".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>

    创建application类  继承Application  记得修改ID与key

    public class App extends Application {
        @Override
        public void onCreate() {
            // TODO Auto-generated method stub
            super.onCreate();
            // 微信 appid appsecret
            PlatformConfig.setWeixin("wx967daebe835fbeac",
                    "5bb696d9ccd75a38c8a0bfe0675559b3");
            // 新浪微博 appkey appsecret
            PlatformConfig.setSinaWeibo("3921700954",
                    "04b48b094faeb16683c32669824ebdad");
            // QQ和Qzone appid appkey
            PlatformConfig.setQQZone("1105184367", "ZCN06OCGTUy0ePpq");

        }
    }

    如果有微信创建WXEntryActivity类   继承WXCallbackActivity就行了  啥也不用写

  • 相关阅读:
    用醋泡脚有什么好处
    用姜泡脚有什么好处
    坚持跑步与读书,方不辜负此生
    干货!几招教你降低论文重复率!!
    Android Handler 源码分析(详细)
    教你控制 RecyclerView 滑动的节奏
    鸟哥的Linux私房菜:基础学习篇 —— 第六章笔记
    鸟哥的Linux私房菜:基础学习篇 —— 第五章笔记
    synchronized(this) 与synchronized(class) 之间的区别
    Android 扩大 View 的点击区域
  • 原文地址:https://www.cnblogs.com/cuizhe/p/5282468.html
Copyright © 2011-2022 走看看