LoKi - πŸ”’ Add a passcode lock feature to your android applications hassle-free.

Overview

LoKi


πŸ”’ Add a passcode lock feature to your android applications hassle-free.

License API Build Status

Download

Go to the Releases to download the demo APK.

Screenshots

Including in your project

Maven Central

Gradle

Add below codes to your root build.gradle file (not your module build.gradle file).

allprojects {
    repositories {
        mavenCentral()
    }
}

And add a dependency code to your module's build.gradle file.

dependencies {
    implementation "io.github.joelromanpr:loki:1.0.0"
}

Usage

LoKi

Here is a basic example of implementing a LoKi workflow.
Any activity that you wish to protect with a passcode must inherit a LokiActivity

class MainActivity : LokiActivity() {}

To prompt the user to setup their passcode for the first time call the launch function within PasscodeSetupActivity

PasscodeSetupActivity.launch(this@MainActivity)

It is common to show the "enable passcode" state with a view such as a Switch from your app Settings screen. Here is one way to approach it:

class MainActivity : LokiActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
		findViewById<SwitchCompat>(R.id.enable_pin).apply {
            this.isChecked = Loki.isEnabled(this@MainActivity)
            this.setOnCheckedChangeListener { _, isChecked ->
                when (isChecked) {
                    true -> PasscodeSetupActivity.launch(this@MainActivity)
                    else -> Loki.disable(this@MainActivity)
                }
            }
        }
    }
}

Loki Customization

You can customize certain aspects of LoKi by calling overwriteConfig on the Loki singleton object. You want to most likely do this from your Application class since it serves as the first entrypoint to it.

class DemoApp : Application() {
    override fun onCreate() {
        super.onCreate()
        Loki.overwriteConfig(
            LokiConfig(
                appName = "LoKi Demo",
                maxAttempts = 1,
                passcodePinActiveCircleColor = android.R.color.holo_blue_dark
            )
        )
    }
}

Internals

  • Loki will place your app in a "disable" state if the user fails the passcode unlock workflow. Currently users must wait 1 minute before trying again
  • LoKi's PasscodeManager is in charge of encoding (using a salt) the user's passcode
  • Behavior might change on newer versions. Make sure to reference docs.

Additional 🎈

LoKi is a fast-track way of adding a passcode lock to your applications, you can also use it in production apps, however it was designed for quick experimentation and allow teams to satisfy a passcode lock need as quick as possible. Feel free to contribute and submit ideas on how it can be improved!

Find this library useful? ❀️

Support it by joining stargazers for this repository. ⭐
And follow me for my next creations! 🀩

License

Copyright 2021 joelromanpr (Joel R. Sosa)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You might also like...
A News Application Shows Breaking News of the Country with a feature to save News for future Use.
A News Application Shows Breaking News of the Country with a feature to save News for future Use.

A News Application Shows Breaking News of the Country with a feature to save News for future Use.You can search news on any topic.Used all latest stuffs in android like Navigation Component, MVVM Architecture, Retrofit, Room DataBase, Kotlin Corutines etc

Paint-me Is a simple painting app. Feel free to show your artistic talent on the wide canvas provided!

Kicking Off Hacktoberfest with ACM-VIT! PaintMe PaintMe Is a simple one screen-canvas painting app. Feel free to show your artistic talent on the wide

An open source application to make your own android applications without coding!
An open source application to make your own android applications without coding!

Stif An Open source project for building Android Application at a go both with and without coding. This project was inspired from Scratch and Sketchwa

AnimApp is an app that recommends you random anime and you can add it to your favourite if you like it.
AnimApp is an app that recommends you random anime and you can add it to your favourite if you like it.

papb-team6 AnimApp is an app that recommends you animes and you can add it to your favourite if you like it. Team members: Firdaus Bisma Suryakusuma (

Money Manager app that helps you to add your daily small incomes and expenses and track them easily.
Money Manager app that helps you to add your daily small incomes and expenses and track them easily.

Simple Money Manager This app is a simple money manager app which helps you to add your daily small incomes and expenses and track them easily. Screen

A news application through which you can learn and browse all the news that interests you by choosing the country and type of news with the ability to browse and add some news to your favorites
A news application through which you can learn and browse all the news that interests you by choosing the country and type of news with the ability to browse and add some news to your favorites

MY-NEWS-Android A news application through which you can learn and browse all the news that interests you by choosing the country and type of news wit

MyDishes - Add your dishes with recipes and photos
MyDishes - Add your dishes with recipes and photos

MyDishes In this application you can add your dishes with recipes and photos. Co

An Android app that lets you download free children's books in different languages from non-profit publisher Book Dash
An Android app that lets you download free children's books in different languages from non-profit publisher Book Dash

Bookdash Android Check out the blog post here: http://riggaroo.co.za/book-dash-android-app/ Download the app: https://play.google.com/store/apps/detai

A Free, Fully Fledged, Open-Source Music Player for Android

Turtle Player Free, Fully Fledged & Open-Source. The Music Player for Android. Turtle Player is designed to be a fun and unique app for playing your m

Releases(1.0.0)
  • 1.0.0(Jul 7, 2021)

Owner
Joel Roman
Full stack engineer currently focused on Android and open source software.β€οΈπŸ€– Digital Nomad. Music, exercising and reading sci-fi πŸ“š.
Joel Roman
A lightweight, feature-rich wrapper for the Telegram Bot API, providing a handy Kotlin DSL to quickly build your bot.

Kotlin Telegram Bot Kotlin based wrapper over Telegram API. Current version of the Telegram Api: 6.0 Principles Annotations Magic. The basic interacti

Jey 61 Dec 27, 2022
Twidere-Android Twidere is a powerful twitter client for Android 1.6+ 1 , which gives you a full Holo experience and nearly full Twitter's feature.

Twidere for Android Material Design ready and feature rich Twitter/Mastodon/Fanfou app for Android 4.1+. Enjoy Fediverse now! Twidere-Android is maint

Twidere Project 2.7k Jan 2, 2023
Android playground project with modularization by feature (android libraries), unit tests, MVVM & MVI.

Movies Movies is a simple project to study and play with some android components, architecture and tools for Android development. Tech Stack This proj

Christopher Elias 333 Dec 30, 2022
Feature toggle library for Android

FeatureToggle Feature toggle library for Android. Overview FeatureToggle library allows to configure features of Android application in runtime using

QIWI 15 Jan 8, 2023
Awesome Kid's Drawing App. It has a click and draws feature.

CanvaKids Overview It's a kid's drawing app which is build for android users. It is built in Kotlin with some very good practices involved.

null 9 Oct 30, 2021
A project for the implementation of the car animation feature in most ride-sharing/ food delivery apps

CarAnimation This is a test project to practice the implementation of the car animation feature in most ride-sharing/ food delivery apps. Slowly build

Samurai 45 Dec 23, 2022
The simplest version of a notepad application with the feature to save pictures on a note.

PhotoNotePad Easy to write, read and organize notes with photo(s). Feature A note has... title content date color pin images Easy to write a note. Pro

seungmin shin 1 Dec 5, 2021
This app contains feature barcode and QR scanner, and video recording in-app.

BarcodeQRScannerAndVideoRecord This app contains feature barcode and QR scanner, and video recording in-app. Scanner using ML Kit and CameraX. Video R

Abdullah Fahmi 1 Dec 23, 2021
DroidFish is a feature-rich graphical chess user interface, combined with the very strong Stockfish chess engine.

Introduction DroidFish is a feature-rich graphical chess user interface, combined with the very strong Stockfish chess engine. DroidFish is primarily

Peter Γ–sterlund 233 Jan 4, 2023
Shotify aims to improve a largely forgotten about feature of the game: screenshots

A highly advanced screenshot mod. Modrinth β€’ Curseforge Shotify aims to improve a largely forgotten about feature of the game: screenshots. Taking a s

Xander 6 Oct 24, 2022