Updating Channels in Amazon Pinpoint - AWS SDK for Java 1.x

We announced the upcoming end-of-support for AWS SDK for Java (v1). We recommend that you migrate to AWS SDK for Java v2. For dates, additional details, and information on how to migrate, please refer to the linked announcement.

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