ShareLoginLib

repository·master·Indexed 20 days ago

https://github.com/lingochamp/shareloginlib

An Android utility library for sharing images, text, or music and implementing social logins for WeChat, Weibo, and QQ. It provides managers for WeChat sharing and login, and supports both local and remote image sharing for WeChat and QQ Space.

Tokens
699
Snippets
5
Records
6
Agent score
22%

What's inside shareloginlib

  1. Perform WeChat login

    master

    To implement WeChat login, use WechatLoginManager and provide a PlatformActionListener to handle the login lifecycle: onComplete (returns user info in a HashMap<String, Object>), onError, and onCancel.

    ILoginManager iLoginManager = new WechatLoginManager(MainActivity.this);
    iLoginManager.login(new PlatformActionListener() {
        @Override
        public void onComplete(HashMap<String, Object> userInfo) {
            // Handle successful login with userInfo
        }
    
        @Override
        public void onError() {
            // Handle error
        }
    
        @Override
        public void onCancel() {
            // Handle user cancellation
        }
    });
  2. Share content to WeChat

    master

    To share content to WeChat, instantiate a WechatShareManager and call the share method with a ShareContentWebpage object. You can specify the share type using WechatShareManager.WEIXIN_SHARE_TYPE_TALK.

    IShareManager iShareManager = new WechatShareManager(context);
    iShareManager.share(new ShareContentWebpage("title", "content", "dataUrl", "imageUrl", WechatShareManager.WEIXIN_SHARE_TYPE_TALK));
  3. Initialize ShareLoginLib with third-party keys

    master

    Before using sharing or login features, you must initialize the library with your application credentials for WeChat, Weibo, and QQ using ShareBlock.getInstance().initShare().

    ShareBlock.getInstance().initShare(wechatAppid, weiboId, qqId, wechatSecret);