title: How to enforce policy from maas360 mdm to my android app
body: <p>I am trying to enforce a policy on android app and my app is not able to understand that policy.
  I have written a simple code where I am asking for a string from maas360 mdm.
  Following is my Android manifest code snippet:</p>
  
  <pre><code>&lt;receiver android:name=".GetRestrictionReceiver"
      android:enabled="true"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.APPLICATION_RESTRICTIONS_CHANGED"&gt;&lt;/action&gt;      
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>
  
  <p>And following is my broadcast receiver:</p>
  
  <pre><code>public void onReceive(Context context, Intent intent) {
      Log.d("Get Restriction", "on receive");
      RestrictionsManager restrictionsManager = (RestrictionsManager) context.getSystemService(Context.RESTRICTIONS_SERVICE);
      Bundle b = restrictionsManager.getApplicationRestrictions();
      if(b.containsKey("siteName")) {
              Log.d("Get Restriction", "Site name= "+b.getString("siteName"));
      }
      //String value = intent.getStringExtra("siteName");
  }
  </code></pre>
  
  <p>Following is my app_restriction xml:</p>
  
  <pre><code>&lt;restrictions xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;restriction
          android:key="siteName"
          android:title="SiteName"
          android:restrictionType="string"
          android:defaultValue="English"&gt;
      &lt;/restriction&gt;
  &lt;/restrictions&gt;
  </code></pre>
  
  <p>Unfortunately my broadcast is not receiving my policy from maas360 mdm.</p>
  
  <p>Would you help me understand what am I missing from my code that will get me the policy?</p>