

The Amazon SDK for Java 1.x reached end-of-support on December 31, 2025. We recommend that you migrate to the [Amazon SDK for Java 2.x](https://docs.amazonaws.cn/sdk-for-java/latest/developer-guide/home.html) to continue receiving new features, availability improvements, and security updates.

# Updating Channels in Amazon Pinpoint
<a name="examples-pinpoint-update-channel"></a>

A channel defines the types of platforms to which you can deliver messages. This example shows how to use the APNs channel to send a message.

## Update a Channel
<a name="update-a-channel"></a>

Enable a channel in Amazon Pinpoint by providing an app ID and a request object of the channel type you want to update. This example updates the APNs channel, which requires the [APNSChannelRequest](https://docs.amazonaws.cn/sdk-for-java/v1/reference/com/amazonaws/services/pinpoint/model/APNSChannelRequest.html) object. Set these in the [UpdateApnsChannelRequest](https://docs.amazonaws.cn/sdk-for-java/v1/reference/com/amazonaws/services/pinpoint/model/UpdateApnsChannelRequest.html) and pass that object to the AmazonPinpointClient’s `updateApnsChannel` method.

 **Imports** 

```
import com.amazonaws.services.pinpoint.AmazonPinpoint;
import com.amazonaws.services.pinpoint.AmazonPinpointClientBuilder;
import com.amazonaws.services.pinpoint.model.APNSChannelRequest;
import com.amazonaws.services.pinpoint.model.APNSChannelResponse;
import com.amazonaws.services.pinpoint.model.GetApnsChannelRequest;
import com.amazonaws.services.pinpoint.model.GetApnsChannelResult;
import com.amazonaws.services.pinpoint.model.UpdateApnsChannelRequest;
import com.amazonaws.services.pinpoint.model.UpdateApnsChannelResult;
```

 **Code** 

```
APNSChannelRequest request = new APNSChannelRequest()
		.withEnabled(enabled);

UpdateApnsChannelRequest updateRequest = new UpdateApnsChannelRequest()
		.withAPNSChannelRequest(request)
		.withApplicationId(appId);
UpdateApnsChannelResult result = client.updateApnsChannel(updateRequest);
```

See the [complete example](https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/java/example_code/pinpoint/src/main/java/com/example/pinpoint/UpdateChannel.java) on GitHub.

## More Information
<a name="more-information"></a>
+  [Amazon Pinpoint Channels](https://docs.amazonaws.cn/pinpoint/latest/userguide/channels.html) in the Amazon Pinpoint User Guide
+  [ADM Channel](http://docs.aws.amazon.com/pinpoint/latest/apireference/rest-api-adm-channel.html) in the Amazon Pinpoint API Reference
+  [APNs Channel](http://docs.aws.amazon.com/pinpoint/latest/apireference/rest-api-apns-channel.html) in the Amazon Pinpoint API Reference
+  [APNs Sandbox Channel](http://docs.aws.amazon.com/pinpoint/latest/apireference/rest-api-apns-sandbox-channel.html) in the Amazon Pinpoint API Reference
+  [APNs VoIP Channel](http://docs.aws.amazon.com/pinpoint/latest/apireference/rest-api-apns-voip-channel.html) in the Amazon Pinpoint API Reference
+  [APNs VoIP Sandbox Channel](http://docs.aws.amazon.com/pinpoint/latest/apireference/rest-api-apns-voip-sandbox-channel.html) in the Amazon Pinpoint API Reference
+  [Baidu Channel](http://docs.aws.amazon.com/pinpoint/latest/apireference/rest-api-baidu-channel.html) in the Amazon Pinpoint API Reference
+  [Email Channel](http://docs.aws.amazon.com/pinpoint/latest/apireference/rest-api-email-channel.html) in the Amazon Pinpoint API Reference
+  [GCM Channel](http://docs.aws.amazon.com/pinpoint/latest/apireference/rest-api-gcm-channel.html) in the Amazon Pinpoint API Reference
+  [SMS Channel](http://docs.aws.amazon.com/pinpoint/latest/apireference/rest-api-sms-channel.html) in the Amazon Pinpoint API Reference