[How to] [Tasker][Marshmallow] Unlock when connected to WiFi

Status
Not open for further replies.

Golfdriver97

Trusted Member Team Leader
Moderator
Dec 4, 2012
35,365
110
63
Visit site
If you are like me, you want to have a security screen on your phone when you are out and about. But what about at home? I mean...you're at home, so why have a PIN enabled? There has to be a way to have a PIN outside the house, but just be able to pick up your phone and not fuss with a lockscreen. There is a way to do so based on your WiFi connection.

You can set up your phone to enable and disable your PIN depending on your connection to your WiFi?

Yep. This is simple for Tasker to handle.

Why would someone want to do this?

I set this up because even though Android now has an unlock per location, for me it would disconnect and reconnect randomly even with high accuracy settings on. I wanted something more consistent.

I do have this up and running on my G4, and it works perfectly.

[NOTE]Passwords work for this as well, but for simplicity, I will only be typing PIN[/NOTE]
[INFO]No need for a PIN/Password already set up in settings.[/INFO]
In order for Tasker to do this, this is what you need to do:
Download Tasker
Download Secure Settings

Once you have both apps installed, we can get to work setting up your PIN bypass.

[INFO]Tasker needs Secure Settings in order for the PIN to work.
Set up secure settings as a device administrator (Settings>security>phone administrator)
To ensure no glitches, I would suggest to enable Tasker as an admin.[/INFO]

First off, open Tasker. You will see a couple starting screens. You can read them over and click the check icon at the top.

Once open, you will see a screen that looks like this:
Screenshot_20150803-083921.jpg
Tasker always opens on the Profile screen. For the next few steps, we need to be one screen over to the Action screen. You may swipe or tap the tab to get there.


To begin, you will want to tap the '+' icon at the bottom.
1.jpg

You can then name the task whatever you would like. In this case, I chose the title 'Lock'
(I already had this set up, but I made a screen shot to show what it would look like).
2.jpg
Tap the check icon to finalize the name. It can be edited later.
Next, we need to add an action. To do so, we will click the '+' icon at the bottom:
3.jpg

We then need to tell Tasker how we want this set up:
4.jpg
Selecting the plug in option brings the next screen up.
This is where Secure Settings comes into play:
5.jpg
And click on Secure Settings.
Clicking the edit button...
6.jpg
That button will take us to the next screen.
Choose Device Administration Actions, and select Password/PIN
7.jpg

And follow to the next screen. Click Enabled.
8.jpg
This is where either a password or PIN can be entered. For a PIN, tap the bullet and enter your desired PIN.
There is the classic entry and confirm lines.
Once done, click Save, and you will be brought back to the Action Edit screen a few panels back.
9.jpg

At this point, you should be able to click back, and everything is saved.
 
Last edited:

Golfdriver97

Trusted Member Team Leader
Moderator
Dec 4, 2012
35,365
110
63
Visit site
Part one is done. We have the apps partly set up. Now on to the next piece of the puzzle.

Now we need to do the same thing as a separate task but for when there is a connection to WiFi.
Starting all over again, we will make a new task:
10.jpg

And I called this one 'Safe'.
Click the check icon to save the name:
11.jpg

Click to add an action:
12.jpg

This time, we leave the button Disabled. This is what will kill the PIN requirement.
13.jpg
My own personal thing here: I activated the option for entering the PIN once after the connection to WiFi is complete. This is like a last ditch thing in case my phone is separated from me away from my house, but won't just unlock if near my router. This option is not required for the set up to work; I am just explaining why i did what I did.

That being said, if you elected not to have an unlock once option enabled, you will not see the '/Wait for unlock'.
14.jpg
You can click back to exit.
Now, step two is done. The next series of steps will bring everything together:
On the Profile screen, click the add icon:
IMG_3.jpg

And click the State option.
IMG_2.jpg

Choose Net,
17.jpg

Then WiFi connected.
18.jpg

Click the search icon to find your router name:
19.jpg

And select the name when it comes up. It should list in order of strength:
20.jpg

Now, both Elysium, and Elysium5 are mine. I don't want it to disconnect if I change, so i add them both. Adding another name you would have to click the search icon again.
21.jpg
Clicking back will prompt to choose a task. Select Safe.

Here is the finished profile.
IMG_1.jpg
Tasker is now set up for when you are connected to your specific router, you will not need to enter your PIN. Now a profile needs to be created to set up the opposite.

For those familiar with Tasker, yes, an exit task can be set up, but I have found it to be a little buggy in this case, and I do not know why.

What does work for me is setting up a new profile to enable everything when disconnected. Starting again, we click the add icon, with State:
IMG_2.jpg

Choose Net,
17.jpg

And you guessed it....WiFi connected:
18.jpg

Yep..again, select your routers. But, here is the difference. At the bottom, select the invert option:
Screenshot_2015-08-03-10-13-57.jpg
What this does is tells Tasker that upon disconnection from WiFi, it is to ask for your PIN to enter your phone.
 
Last edited:

Golfdriver97

Trusted Member Team Leader
Moderator
Dec 4, 2012
35,365
110
63
Visit site
As of this writing, this does not work on M. The reason is Secure settings crashes. Hopefully the developer gets it fixed for the new update. But for right now, it does cover almost everyone.

Other notes...this most likely won't work with other security features enabled...finger prints, Knock codes, etcc.
 
Last edited:
Feb 20, 2013
5
0
0
Visit site
On Lollipop 5.0.1, for whatever reason, the only secure setting config that works is: Device Setting> (Setting Table) System > automatic_unlock > (setting value) 1 for for Unlock and 0 for Lock.
 

Golfdriver97

Trusted Member Team Leader
Moderator
Dec 4, 2012
35,365
110
63
Visit site
Update: I have this up and running, with no issues on my Nexus 5X. This now does work with Marshmallow.
 

Topher Petty

New member
Dec 24, 2015
3
0
0
Visit site
Unlock seems to work fine on my new ZenPad 8.0 (Z380CX/P022), however, locking doesn't happen. The variable set suggestion by a previous reply doesn't exist on my new tablet. Any suggestions on getting this to properly work on this device would be appreciated.
 

Golfdriver97

Trusted Member Team Leader
Moderator
Dec 4, 2012
35,365
110
63
Visit site
Unlock seems to work fine on my new ZenPad 8.0 (Z380CX/P022), however, locking doesn't happen. The variable set suggestion by a previous reply doesn't exist on my new tablet. Any suggestions on getting this to properly work on this device would be appreciated.

Did you try the method outlined in the guide?
 

Golfdriver97

Trusted Member Team Leader
Moderator
Dec 4, 2012
35,365
110
63
Visit site
I'm going to be honest.... Not sure what can be wrong.
Mine is set on a timer, and works quite well that way.
 

joelstitch

Member
Sep 26, 2011
10
0
0
Visit site
Anyone gotten this to work with pattern lock? I have a rooted Samsung S7 Edge and am trying to do the same thing but with pattern lock instead of Pin. Haven't been able to find a way that truly works. Even the Xposed Module called "No Lock Home is not doing it for me.
 

Golfdriver97

Trusted Member Team Leader
Moderator
Dec 4, 2012
35,365
110
63
Visit site
Anyone gotten this to work with pattern lock? I have a rooted Samsung S7 Edge and am trying to do the same thing but with pattern lock instead of Pin. Haven't been able to find a way that truly works. Even the Xposed Module called "No Lock Home is not doing it for me.
Part of the issue is secure settings. It doesn't go into pattern locks.
 

billouetaudrey

New member
Oct 4, 2016
1
0
0
Visit site
Hi, when I set password, I have this message...
Any idea ? (android 7)

6f2dbb566f28d0598c43e23c8f4df191.jpg
 

skyraven_ro

New member
Oct 15, 2012
3
0
0
Visit site
Same error for me also.
CM13 on Oneplus 3
Before I had an older Cyanogenmod where it worked...so something broke it at some point..
Hope it gets fixed.
 
Status
Not open for further replies.

Trending Posts

Forum statistics

Threads
942,987
Messages
6,916,741
Members
3,158,762
Latest member
Dominic Haar