attachPrincipalPolicy method is deprecated, documentation says that we should use attachPolicy, however AttachPolicyRequest does not have setPrincipal method to associate arn certificate.
Do you have an alternative code example?
com.amazonaws:aws-android-sdk-iot:2.8.4
@logo17 you can use attachPolicy to set principal policy as follows :
import com.amazonaws.services.iot.AWSIotClient;
import com.amazonaws.services.iot.model.AttachPolicyRequest;
AttachPolicyRequest attachPolicyReq = new AttachPolicyRequest();
attachPolicyReq.setPolicyName("myIOTPolicy"); // name of your IoT AWS policy
attachPolicyReq.setTarget(AWSMobileClient.getInstance().getIdentityId());
AWSIotClient mIotAndroidClient = new AWSIotClient(AWSMobileClient.getInstance());
mIotAndroidClient.setRegion(Region.getRegion("MyRegion")); // name of your aws region such as "us-east-1"
mIotAndroidClient.attachPolicy(attachPolicyReq);
This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.
thanks, it works..
Most helpful comment
@logo17 you can use attachPolicy to set principal policy as follows :