Support for receiving "canonical id" update events from pushserver.
// FREEBIE
This commit is contained in:
		
							parent
							
								
									456164fc24
								
							
						
					
					
						commit
						e69e395b25
					
				| 
						 | 
				
			
			@ -11,6 +11,9 @@ public class UnregisteredEvent {
 | 
			
		|||
  @NotEmpty
 | 
			
		||||
  private String registrationId;
 | 
			
		||||
 | 
			
		||||
  @JsonProperty
 | 
			
		||||
  private String canonicalId;
 | 
			
		||||
 | 
			
		||||
  @JsonProperty
 | 
			
		||||
  @NotEmpty
 | 
			
		||||
  private String number;
 | 
			
		||||
| 
						 | 
				
			
			@ -26,6 +29,10 @@ public class UnregisteredEvent {
 | 
			
		|||
    return registrationId;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public String getCanonicalId() {
 | 
			
		||||
    return canonicalId;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public String getNumber() {
 | 
			
		||||
    return number;
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,7 +76,13 @@ public class FeedbackHandler implements Managed, Runnable {
 | 
			
		|||
              event.getTimestamp() > device.get().getPushTimestamp())
 | 
			
		||||
          {
 | 
			
		||||
            logger.info("GCM Unregister Timestamp matches!");
 | 
			
		||||
            device.get().setGcmId(null);
 | 
			
		||||
 | 
			
		||||
            if (event.getCanonicalId() != null && !event.getCanonicalId().isEmpty()) {
 | 
			
		||||
              logger.info("It's a canonical ID update...");
 | 
			
		||||
              device.get().setGcmId(event.getCanonicalId());
 | 
			
		||||
            } else {
 | 
			
		||||
              device.get().setGcmId(null);
 | 
			
		||||
            }
 | 
			
		||||
            accountsManager.update(account.get());
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue