Updating Channels in Amazon Pinpoint - Amazon SDK for Java 1.x
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

The Amazon SDK for Java 1.x has entered maintenance mode as of July 31, 2024, and will reach end-of-support on December 31, 2025. We recommend that you migrate to the Amazon SDK for Java 2.x to continue receiving new features, availability improvements, and security updates.

Updating Channels in Amazon Pinpoint

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

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 object. Set these in the UpdateApnsChannelRequest 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 on GitHub.

More Information