Since a few new features are used the latest Automagic release 1.24 is required. Although I named it "SmartUnlock" the flows will never actually unlock your phone. The flows will merely keep your phone unlocked while it is safe to do so.
"Safe" or "trusted" states are WiFi or Bluetooth connections, locations and such. The phone will not lock itself while at least one trusted state is present.
If the last trusted state is lost the phone will be automatically locked 5 minutes after the screen is switched off.
Once your is locked you need to unlock it yourself (enter the PIN), even if a trusted state is present. From then on it will be kept unlocked until the last trusted state is lost.
I developed the flows on a "Nexus 4" and a "Nexus 5" phone and find they work quite satisfactory
So, for example, the phone will not lock itself if:
- you are connected to your home Wifi in the morning, phone is unlocked
- then drive your car to work (phone automatically connects to car via Bluetooth)
- at work the phone automatically connects to your work WiFi
Notification Icon
The current state of SmartUnlock is displayed as permanent notification icon. If the lock in the status bar is closed no trusted state is present. The notification drawer will display more info about the current state.
If you expand the SmartLock notification you can access the settings menu "Settings", lock the phone immediately with "Lock" (even if a trusted state is present) or unlock it permanently with "Unlock".
To later switch back to automatic mode select "Auto". Installation
I tried to make the installation as easy as possible:
- Download and import the attached xml file.
This will create a group "SmartUnlock" with all flows. - Do not enable any of the flows manually, the startup flow will enable all flows that need to be enabled at the time.
- Edit the flow SmartUnlock_setPIN to set the PIN number to unlock your phone.
You may also use any other unlock method, but it depends on your phone and Android version if they work properly when set by Automagic. - Manually execute the flow SmartUnlock_initSmartUnlock.
All global variables used by SmartUnlock have the prefix "global_SmartUnlock_" and all flows start with "SmartUnlock_".
Shortcuts
A few shortcuts are provided to access the settings menu or lock/unlock the phone. They are all named with the prefix "Shortcut: SmartUnlock_".
Settings menu
All options can be set from the settings menu. You can access it either from the expanded notification icon or from a Shortcut. I hope the menu structure pretty much explains itself
The numbers denote how many items are in the corresponding list.
Only enabled trusted states are listed here and can be edited.
To enable or disable a trusted state like "WiFi" or "Bluetooth" go to "SmartUnlock settings" and then to "Select available trusted states".
Available trusted states
- WiFi connections
SmartUnlock stores the ssid of trusted WiFi connections. While the phone is connected to any WiFi in the list it will not lock itself.
To configure a new trusted WiFi connection you need to connect to the WiFi, then navigate through the SmartUnlock menu to "Add new WiFi connection". - Bluetooth connections
SmartUnlock stores the device address of trusted Bluetooth devices. While the phone is connected to one or more devices from the list it will not lock itself.
To configure a new trusted Bluetooth device you need to connect to the device, then navigate through the SmartUnlock menu to "Add new Bluetooth device". - Locations
The phone will be kept unlocked while it is near a defined location. You can configure as many locations as you like.
NOTE: the accuracy depends on the hardware of your phone and your location settings!
Since Automagic only supports fixed locations within a location trigger or condition SmartUnlock will "clone" a new location flow when a new location is defined.
For details look into the flow "SmartUnlock_cloneLocationTrigger". So for each new location you'll automatically get a new flow with a "fixed" location
To add a new location navigate through the SmartUnlock menu to "Add new trusted location". The phone will use your current location with a radius of 500m.
If possible it will automatically get the street address from Google.
You can later adjust latitude and longitude if you like. - Running Apps
While any of the configured Apps is running in the foreground the phone will not lock itself. An example would be a shopping list which keeps your phone unlocked while you're walking through the aisles in the supermarket.
To add a new trusted App navigate through the SmartUnlock menu to "Add new trusted App", then select the App from the list of installed Apps. - Timed unlock
Keeps your phone unlocked for a certain amount of time (15 minutes, 30 minutes, 1 hour etc.) or until a certain time is reached (e.g. 19:30h).
To set a new timeout select "Timed unlock" from the SmartUnlock main menu and then either select a duration like 15 minutes or a fixed time.
The duration is rounded off to the nearest five or fifteen minutes, depending on duration length.
If a timed unlock is set you can cancel it from the main menu. - Charging
Keeps your phone unlocked while it is being charged with an AC charger, wireless (QI) or USB. You can select from the settings menu which charging methods are trusted.