Have you tried your code by merging the changes above into your code?
AfariaServicePolicy.PolicyInfo _newPolicyandroid = newAfariaServicePolicy.PolicyInfo();
should become:
AfariaServicePolicy.PolicyInfo _newPolicyandroid = svc1.GetPolicyInfo(state_android);
and
AfariaServicePolicy.EnrollmentPolicySettingsAndroid_enrollSettandroid = newAfariaServicePolicy.EnrollmentPolicySettingsAndroid(state_android);
should become:
AfariaServicePolicy.EnrollmentPolicySettingsAndroid_enrollSettandroid = (EnrollmentPolicySettingsAndroid)svc1.EnrollmentGetPolicySettings(state_android);
For the application policy, it is also likely that you have to get the policy settings by calling:
AfariaServicePolicy.AppIndirectlyHostedPolicySettingsAndroidV002 _appInd = svc1.ApplicationGetPolicySettingsV002(policystate);
instead of calling:
AfariaServicePolicy.AppIndirectlyHostedPolicySettingsAndroidV002 _appInd =newAppIndirectlyHostedPolicySettingsAndroidV002();
and
AfariaServicePolicy.PolicyInfo _newPolicyApp = newAfariaServicePolicy.PolicyInfo();
instead of:
AfariaServicePolicy.PolicyInfo _newPolicyApp = svc1.GetPolicyInfo(policystate)