Pin for opening app in lockdown

M
MartinsKl
ICA Gruppen AB

Hi,

Im migrating devices to new server and thought i could add stage now as a additional backup if need to ask user to scan something, but dont want to just allow access to stage now willy nilly as i dont have certificate for using stage now barcodes.
I thought I could add script that before opening asks to enter pin. I can create Java script for that, but as far as I know it cant be added in lockdown icon. Would it be possible to place it in cmd file like legacy script or how to add java script in lockdown icon?

4 years ago
Android Scripting
ANSWERS
RS
Rafael Schäfer
4 years ago

Why just use the admin password for leaving lockdown to get stage now available?

M
MartinsKl
4 years ago (edited 4 years ago)

Because explaining user to hold down back button, enter password and find stage now application would take 3x the time (we have done that) and also it could be useful in future for other scripts.
Also with this could maybe just add script to do what is needed and possibly do without stage now.

RS
Rafael Schäfer
4 years ago (edited 4 years ago)

So, i think your problem is only on devices currently not connected to the console, right?

I mean, the pin or password you are asking for is nothing security related because they will rmemeber it and then use it when they need to... so it's the same as you would just provide stage now in lock down mode.

M
MartinsKl
4 years ago

No, right now they are connected, but im afraid, that when migrating they could disconnect from both environments. Thats why I would like to configure this before moving them. 

Short question is - Can you run JavaScripts from device lockdown?

RS
Rafael Schäfer
4 years ago

We don't use that, sorry can't help you with that.

But you could install a out of contact profile which runs a script (will be stored on the device and i think there you can use both).

There you can define for example to start the stage now app (don't know if it will be displayed over the lock screen).

W
Waldemar
6 months ago

Also looking for a method to block an app throug a PIN. What I´ve done so far, an approach but unfortunately not a solution.

LOCK

script


<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>PIN-geschützter App-Start (Debug)</title>
  <style>
    body {
      font-family: sans-serif;
      text-align: center;
      padding: 50px;
      background-color: #f5f5f5;
    }
    input[type="password"] {
      font-size: 20px;
      padding: 10px;
      margin: 10px;
      width: 200px;
    }
    button {
      padding: 10px 20px;
      font-size: 18px;
      background-color: #007acc;
      color: white;
      border: none;
      border-radius: 8px;
      cursor: pointer;
    }
    .error {
      color: red;
      margin-top: 10px;
    }
  </style>
</head>
<body>
  <h2>📲 App starten – PIN erforderlich</h2>
  <input type="password" id="pin" placeholder="PIN eingeben">
  <br>
  <button onclick="checkPIN()">Starten</button>
  <div class="error" id="errorMsg"></div>

  <script>
    const correctPIN = "1234"; // <-- PIN hier anpassen

    function checkPIN() {
      const enteredPIN = document.getElementById("pin").value;
      if (enteredPIN === correctPIN) {
        console.log("PIN korrekt eingegeben");
        if (typeof MobiControl !== "undefined" && typeof mobicontrol.app.start === "function") {
          console.log("MobiControl-API gefunden – App wird gestartet...");
          mobicontrol.app.start("de.chris.android.AMSMobile");
        } else {
          console.log("MobiControl nicht verfügbar oder startApplication nicht definiert.");
          document.getElementById("errorMsg").innerText = "❌ Fehler: MobiControl-API nicht verfügbar!";
        }
      } else {
        document.getElementById("errorMsg").innerText = "Falscher PIN!";
      }
    }
  </script>
</body>
</html>

After starting the "app" I got this