Skip to content

Commit

Permalink
fix(pinpoint): Remove GCM service as target class usage as it is no l…
Browse files Browse the repository at this point in the history
…onger allowed in Android 12. (#3110)

* Remove GCM service class usage as it is no longer allowed in Android 12.
  • Loading branch information
tylerjroach authored Dec 6, 2022
1 parent da2b058 commit 094d097
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ public CampaignPushResult handleFCMCampaignPush(final String from,
*
* @param from the from string received by the GCM service
* @param data the bundle received from the GCM service
* @param serviceClass the class extending GCMListenerService that handles
* receiving GCM messages.
* @param serviceClass No longer used due to Android 12 restrictions
* @return {@link PushResult}.
*
* @deprecated Use {@link #handleCampaignPush(NotificationDetails)} instead.
Expand All @@ -195,7 +194,6 @@ public CampaignPushResult handleGCMCampaignPush(final String from, final Bundle
NotificationDetails.builder()
.from(from)
.bundle(data)
.serviceClass(serviceClass)
.intentAction(GCM_INTENT_ACTION);
return handleCampaignPush(notificationDetailsBuilder.build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ public static NotificationDetailsBuilder builder() {
* new NotificationDetails.builder()
* .from(from)
* .bundle(bundle)
* .serviceClass(serviceClass)
* .intentAction(NotificationClient.GCM_INTENT_ACTION)
* .build();
*
Expand All @@ -111,7 +110,6 @@ public static NotificationDetailsBuilder builder() {
* ADM example:
* new NotificationDetails.builder()
* .intent(intent)
* .serviceClass(serviceClass)
* .intentAction(NotificationClient.ADM_INTENT_ACTION)
* .build();
*
Expand All @@ -123,7 +121,6 @@ public static NotificationDetailsBuilder builder() {
public static class NotificationDetailsBuilder {
private String from;
private Bundle bundle;
private Class<? extends Service> serviceClass;
private String intentAction;
private Map<String, String> mapData;
private Intent intent;
Expand Down Expand Up @@ -156,11 +153,12 @@ public NotificationDetailsBuilder bundle(Bundle bundle) {
/**
* The Android Service class that received the push notification.
* @param serviceClass Android service class that received the push notification
* @deprecated The set value is no longer used due to Android 12 restrictions
* @return {@link NotificationDetailsBuilder}
*/
@SuppressWarnings("checkstyle:hiddenfield")
@Deprecated
public NotificationDetailsBuilder serviceClass(Class<? extends Service> serviceClass) {
this.serviceClass = serviceClass;
return this;
}

Expand Down Expand Up @@ -229,7 +227,7 @@ public NotificationDetails build() {
if (NotificationClient.GCM_INTENT_ACTION.equals(intentAction)) {
notificationDetails.setFrom(from);
notificationDetails.setBundle(bundle);
notificationDetails.setTargetClass(serviceClass);
notificationDetails.setTargetClass(PinpointNotificationActivity.class);
notificationDetails.setIntentAction(intentAction);
notificationDetails.setNotificationChannelId(notificationChannelId);
}
Expand Down

0 comments on commit 094d097

Please sign in to comment.