{"id":13644637,"url":"https://github.com/xiong-it/AutoInputAuthCode","last_synced_at":"2025-04-21T10:33:55.053Z","repository":{"id":98977340,"uuid":"90151474","full_name":"xiong-it/AutoInputAuthCode","owner":"xiong-it","description":"[DEPRECATED]A library for inputing the verification code into EditText automatically in Android.Android开发中实现自动填写验证码的开源库。","archived":false,"fork":false,"pushed_at":"2017-07-07T02:29:31.000Z","size":168,"stargazers_count":126,"open_issues_count":4,"forks_count":21,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-09T17:42:03.676Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xiong-it.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-05-03T13:22:30.000Z","updated_at":"2023-08-03T07:10:01.000Z","dependencies_parsed_at":"2023-04-12T04:48:01.393Z","dependency_job_id":null,"html_url":"https://github.com/xiong-it/AutoInputAuthCode","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiong-it%2FAutoInputAuthCode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiong-it%2FAutoInputAuthCode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiong-it%2FAutoInputAuthCode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiong-it%2FAutoInputAuthCode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xiong-it","download_url":"https://codeload.github.com/xiong-it/AutoInputAuthCode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250040562,"owners_count":21365130,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:02:09.901Z","updated_at":"2025-04-21T10:33:50.027Z","avatar_url":"https://github.com/xiong-it.png","language":"Java","readme":"# AutoInputAuthCode\n[![License](https://img.shields.io/badge/license-Apache%202-green.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n[ ![Download](https://api.bintray.com/packages/xiong-it/AndroidRepo/AutoInputAuthCode/images/download.svg) ](https://bintray.com/xiong-it/AndroidRepo/AutoInputAuthCode/_latestVersion)  \nAndroid开发中自动填写验证码功能库。  \n相关博客：  \n[AutoInpuAuthCode使用介绍](http://blog.csdn.net/xiong_it/article/details/71451922)\n[Android开发:实现APP自动填写注册验证码功能](http://blog.csdn.net/xiong_it/article/details/50997084)\n\n# Compile\n打开你的app module中的build.gradle,添加依赖：\n```groovy\ncompile 'tech.michaelx.authcode:authcode:1.0.1'\n```\n\n# Sample\n示例代码如下：\n```java\nCodeConfig config = new CodeConfig.Builder()\n                        .codeLength(4) // 设置验证码长度\n                        .smsFromStart(133) // 设置验证码发送号码前几位数字\n                        //.smsFrom(1690123456789) // 如果验证码发送号码固定，则可以设置验证码发送完整号码\n                        .smsBodyStartWith(\"百度科技\") // 设置验证码短信开头文字\n                        .smsBodyContains(\"验证码\") // 设置验证码短信内容包含文字\n                        .build();\nAuthCode.getInstance().with(context).config(config).into(EditText);\n\n@Override\nprotected void onDestroy() {\n    super.onDestroy();\n    // 防止未读取到验证码导致内存泄露，手动回收内存\n    AuthCode.getInstance().onDestroy();\n}\n```\n1. 通过单例获取一个AuthCode对象;\n2. 提供一个上下文对象给AuthCode，放心，我会妥善处理你的上下文;\n3. 提供一个你的验证码特征描述;\n4. 告诉AuthCode你想将验证码写入哪个EditText.\n\n搞定，收工！\n\n# 效果图\n这里模拟演示了一个自动填写验证码的过程\n1. 点击获取验证码(使用另一个手机发送一个仿真验证码短信到该手机)\n2. 接收到验证码\n3. AutoInputAuthCode替你自动填写验证码  \n![自动填写验证码演示](http://oler3nq5z.bkt.clouddn.com/authcode2.gif)\n\n\n# 注意事项\n自动填写验证码需要读取短信权限，请在清单中添加权限：\n```xml\n\u003cuses-permission android:name=\"android.permission.RECEIVE_SMS\"/\u003e\n\u003cuses-permission android:name=\"android.permission.READ_SMS\"/\u003e\n```\n\n由于读取短信在API 23（Android 6.0）上权限级别是**dangerous**。所以还需要动态申请权限，但是申请权限需要依赖于Activity或者Fragment中的onRequestPermissionsResult()回调，所以需要开发者自己实现。  \n动态申请权限可参考中sample的代码。\n\n# changelog\nv1.0.1  \n添加一个共有api防止未读取到验证码导致内存泄露  \n完善demo  \n\nv1.0.0  \n实现短信验证码读取功能  \n实现演示demo  \n","funding_links":[],"categories":["表单"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiong-it%2FAutoInputAuthCode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiong-it%2FAutoInputAuthCode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiong-it%2FAutoInputAuthCode/lists"}