title: Prevent Android App from getting installed on multiple users
body: <p>When I run my app from Android Studio and install it on the primary user on a device, I notice that it gets installed on the secondary user as well.</p>
  
  <p>In the first place, why is this happening? The <a href="https://developer.android.com/reference/android/R.attr.html#requiredForAllUsers" rel="nofollow noreferrer"><code>android:requiredForAllUsers</code></a> flag is <code>false</code> by default, and in any case can only be used by system apps or pre-installed apps.</p>
  
  <p>Or is it the case that this happens only for debug-mode apps installed via Android Studio?</p>
  
  <blockquote>
    <p><strong>How can I prevent this from happening?</strong></p>
  </blockquote>
  
  <p>It is critical for my app that it be installed on one user only. I have already read the following documents:</p>
  
  <p><a href="https://source.android.com/devices/tech/admin/multi-user" rel="nofollow noreferrer">Supporting Multiple Users</a></p>
  
  <p><a href="https://developer.android.com/work/dpc/dedicated-devices/multiple-users" rel="nofollow noreferrer">Manage multiple users</a></p>
  
  <p>Neither of those documents has any explanation of whether and how the installation process is affected by the multi-user feature.</p>
  
  <p>There must surely be some manifest or build setting that permits or prevents installation on multiple users. Why isn't it easier to find? And why isn't this question more common on SO?</p>