Search code examples
androidxmldevice-admin

No place to put device_admin.xml


I know that device_admin.xml should be put in my /res/xml folder but I have not a xml folder under the res folder. Where should I put it?

device_admin.xml:

<device-admin xmlns:android="http://schemas.android.com/apk/res/android">

<uses-policies>
    <limit-password/>

    <watch-login/>
</uses-policies>

Here is my screen shot:

enter image description here

EDIT: I am new so I could not add the xml folder. Please tell me what can I do here. (I right clicked on res folder) enter image description here


Solution

  • Android studio can do that for you:

    1. Add the link in the Manifest:

    <meta-data android:name="android.app.device_admin" android:resource="@xml/device_admin" />

    1. The studio will write it in red as it has no such resource. Then just click at it and press Alt+Enter. The first option will be to create such resource file.