Hello everyone
Today I am presenting my Auth extension
Features
This extension can be used to check if a user has enabled passcode lock on his/her device
Use
If you want to integrate authentication using device lock in your app you can easily do it by using this intent as discovered by @ShanmugaNathan2023
But it has a great limitation well detected by @TIMAI2 that
The extension aims to resolve this issue by checking if the user has a passcode lock set up on his/her device
Then you can use the intent to ask for password lock. Issue Resolved
Blocks Function
This procedure is to be called to get the status of Passcode lock in your device
Events
This event is called when Passcode lock is setup on the device
This event is called when Passcode lock is not setup on the device
Note: Passcode lock refers to any type of lock- Pin/Pattern/Fingerprint/Face etc.
Tested on emulator running android 10.
Download the latest aix io.auth.aix (3.4 KB) 20/09/24
Past Releases
Version 1.0 : io.auth.aix (3.4 KB) 18/09/24
Support the project
If you liked the extension then do make a small funding starting from 0.5$ so I can continue to make such extensions for free.
Usage Policy- Important
I Sarthak Gupta authorize that you can use this extension in any of your projects and even publish them on the Play Store as long as you give me credit like this
Extension by Sarthak Gupta and a link to this post
Spent a while creating this code snippet.
So what it does
When button is clicked it checks if the device has a passcode lock
If passcode is enabled
The app asks for the device credentials. Now the most important question, what happens if the user clicks the back button or the recent apps button. The activity fails and the activity is called again. kind of like a loop. So the user wonβt be able to login until the password is entered.
When the password is entered correctly the block in the after activity is executed and the label is changed to success. You can change it and execute any other block obviously
If passcode is disabled
If passcode is disabled then the notifier will show an alert that Lock Disabled
Updated the license now you can use the extension for free as long as you give credit me and this post. If you want to support the project then please contribute on the link given above. It will surely motivate me to make more such extensions for free in the future.
meaning of free is to get it simple free without giving or doing anything
if giving credit is compulsory how is it free if its take extension give credit its give and take not free!
i understand we appreciate giving credit but making it compulsory dont make it free
the meaning for free is different
if its compulsory its not free you need to give something(credit)
Yes but as per the license of this extension giving credit is compulsory only if you are releasing the app on app stores.
PS Free doesnβt mean that it has no restrictions
@DesignerComponent(
version = 1,
description = βAn extension to check if a device has passcode lock (PIN, pattern, or password) enabled.β,
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = βimages/extension.pngβ
) @SimpleObject(external = true)
public class AuthExtension extends AndroidNonvisibleComponent {
private Context context;
// Constructor
public AuthExtension(ComponentContainer container) {
super(container.$form());
this.context = container.$context();
}
// Method to check if passcode lock is enabled
@SimpleFunction(description = "Returns true if a passcode lock (PIN, pattern, or password) is enabled on the device.")
public boolean IsPasscodeEnabled() {
KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
return keyguardManager.isKeyguardSecure();
}
}
Does this work too if you build a aix? I am just curious, because this would be great if you could build extensions in seconds nearly without any knowlegde (like me )