CircleAccessLock is a simple Android library for displaying a lock screen using Circle Technology in your application. It is built in Kotlin and distributed as an AAR file.
Features
- Automatically locks the app when the user leaves or when the app becomes inactive
- Can be enabled or disabled programmatically
Installation
- Download the CircleAccessLock.arr file from the library folder in this repository.
- Copy the AAR file to the libs folder in your Android project. If the folder doesn't exist, create it.
- Add the following code to your app's build.gradle file:
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
implementation files('libs/CircleAccessLock.aar')
}
Usage
To use CircleAccessLock in your Android project, follow these steps:
1. Import the library in your Kotlin or Java code:
import ai.circlesecurity.circleaccesslock.CircleAccessLock
2. Initialize a CircleAccessLock object in your "MainActivity" or any other "Activity" where you want to show the lock screen:
class MainActivity : AppCompatActivity() {
private lateinit var circleAccessLock: CircleAccessLock
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
circleAccessLock = CircleAccessLock(this)
circleAccessLock.onCreate()
}
}
3. Open the "AndroidManifest.xml" file in your app's "src/main" directory. Add the "CircleActivity" declaration inside the "<application>" tag:
<activity
android:name="ai.circlesecurity.circleaccesslock.CircleActivity"
android:exported="false" />
4. To enable or disable the lock screen, use the following methods:
circleAccessLock.enable()
circleAccessLock.disable()
5. To enable or disable the lock screen, use the following methods:
<uses-permission android:name="android.permission.INTERNET" />
Sample app
A sample app is provided in the sample folder of GitHub to demonstrate how to integrate and use CircleAccessLock in your Android project.