All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.windowsazure.messaging.AppleRegistration Maven / Gradle / Ivy

Go to download

Azure Notification Hubs Java SDK for interacting with the data and management plane operations.

The newest version!
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------

package com.windowsazure.messaging;

import java.util.Objects;

/**
 * Class representing a native registration for a device using APNs.
 */
public class AppleRegistration extends Registration {
    private static final String APNS_NATIVE_REGISTRATION1 = "";
    private static final String APNS_NATIVE_REGISTRATION2 = "";
    private static final String APNS_NATIVE_REGISTRATION3 = "";

    protected String deviceToken;

    /**
     * Creates a new instance of the AppleRegistration class.
     */
    public AppleRegistration() {
        super();
    }

    /**
     * Creates a new instance of the AppleRegistration class.
     * @param deviceToken The APNS device token for the registration.
     */
    public AppleRegistration(String deviceToken) {
        super();
        this.deviceToken = deviceToken;
    }

    /**
     * Creates a new instance of the AppleRegistration class.
     * @param registrationId The registration ID for the device.
     * @param deviceToken The APNS device token for the registration.
     */
    public AppleRegistration(String registrationId, String deviceToken) {
        super(registrationId);
        this.deviceToken = deviceToken;
    }

    /**
     * Gets the APNS device token for the registration.
     * @return The APNS device token for the registration.
     */
    public String getDeviceToken() {
        return deviceToken;
    }

    /**
     * Sets the APNS device token for the registration.
     * @param value The APNS device token for the registration to set.
     */
    public void setDeviceToken(String value) { deviceToken = value; }

    /**
     * Gets the PNS handle for getting devices by channel.
     * @return The PNS handle for getting devices by channel.
     */
    @Override
    public String getPnsHandle() { return deviceToken; }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        AppleRegistration that = (AppleRegistration) o;
        return Objects.equals(getDeviceToken(), that.getDeviceToken());
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), getDeviceToken());
    }

    @Override
    public String getXml() {
        return APNS_NATIVE_REGISTRATION1 +
            getTagsXml() +
            APNS_NATIVE_REGISTRATION2 +
            deviceToken +
            APNS_NATIVE_REGISTRATION3;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy