[General Accessories] Sichroteph:
This method will allow you to lock your phone as soon as your connected accessory (smartband, fitness tracker, smartwatch) is away.

So you can now use your phone unlocked and it will automatically protect itself in case of theft -- The same way Xiaomi does with their fitness band.

Root NOT needed.

Description

This method consume no battery since it doesn't track the device itself, but only the notification android makes when the device is connected/disconnected.

It can work with virtually every device, (bluetooth, low energy bluetooth, wifi, usb ...) in the condition there is a notification on the taskbar when connecting / disconnecting

It is build to be secure but I am open to your suggestions or improvements.

It is made for the Sony SmartBand, you can easily adapt it to the notification you have with your connected device.

Apps needed

What you need first :

- Tasker

- Autonotification tasker plugin (you need the full version : 1-2$)

- SecureSettings

Installation :

- Install SecureSettings

Activate "device administrator" in the secure settings parameters

Make sure the right option is checked inside the app :

Options -> Dev Admin Actions -> Lock Device

Options -> Dev Admin Actions -> Password/Pin

- Install Autonotification

- Install the Autonotification unlock key

Open the app and click on "Enable Notification Intercept"

It should now be unlocked, ready to intercept and linked to tasker.

- Install Tasker

Now import the profiles like this:

Download Tasker_profiles_v3.zip, copy/unpack NotifLock.prf.xml and then open it. A popup will appear that the profile is now available in Tasker. Go to Tasker, and then long-press/release on the Profiles-tab for a menu item allowing you to Import appear. (Thanks Xordef)

If you have a Sony SmartBand

- Edit the task of NotifLock (The first profile) to your needs:

You need to change the line 1 and 4:

If your phone is in English just change :

Mode jour

Accessoire smartband déconnecté

with :

Day mode

SmartBand disconnected

If you dont have a Sony Smartband :

You first need to explain to autonotification wich app you need to track for :

The easiest way to find back the exact name is to raise a notification from your device connection/disconnection, then :

Edit the state of NotifLock (by clicking just under the title and then on the pen) --> Fill from last --> Notification App

Done.

Now :

- Edit the task of NotifLock by changing the IF lines to the text you want to track :

You need to track the ticker text, the one bellow the title (Mode Jour in the Printscreen)

Versions

19.07 : Initial version

29.07 : V2

The scripts are now simplier yet more efficient and reliable

It now only wake up only when the smartwear connects/disconnects

The scripts now always detect when the phone is near the device again

29.07 : V3

The script is now very simple yet more effective.

It doesn't use anymore the combination tasker keyguard + secure settings pattern lock

It now use the device admin secure setting pin lock, compatible with non root devices and reliable.

Plus when the device is away, the device screen is turned off and locked instantly with se SS lock function

Remarks :

You can change the lock screen code in Tasker --> NotifLock, search for the line " Secure Settings" Configuration Set Pin -> click on the pen

(If you don't, the code is 6824)

Some users reported that changing the password is required for Tasker to work properly the first time.

You can have two configuration depending on what you prefer :

(Device away) Pattern lock < - - - - > Swipe to unlock (Device here)

Or

(Device away) Pattern lock No screen lock at all (Device here)

By simply changing the unlocked lockscreen (Swipe or Nothing) when your device is connected.

Troubleshooting :

If you use the sony smartband and want to try the scripts by turning the smartband off, it will first raise the "Night Mode" script then disconnect, these two closed in time notification can fool the scripts and prevent the phone to lock.

Not a big deal in real life, but I will search a workaround when I will have time.

Please send me your questions or comments or improvment suggestions.