The server knows the construct of a "push app":
package org.jboss.aerogear.push.api;
import java.util.List;
/**
* Server side abstraction of a "AeroGear Unified Push" application.
*
* This representation can be configured to have several/different/multiple
* mobile applications, to receive messages.
*
*/
public interface PushApplication {
// some name/desc....
void setName(String name);
String getName();
void setDescription(String description);
String getDescription();
/**
* Returns the App-Key, generated by the AG server.
* The App-Key is used to send messages to a server application,
* which broadcasts them to the (desired) mobile application that
* are associated with the app
*/
// app id key, generated by the AG server
String getApplicationKey();
/**
* List of all mobile variations for this server side abstraction
* (e.g. one iOS app and/oe one Android app)
*/
List<MobileApplication> getMobileApplications();
/**
* Adds a new {@link MobileApplication} to the server abstraction;
* @param mobileApp
*/
void addMobileApplication(MobileApplication mobileApp);
/**
* Removes a {@link MobileApplication} to the server abstraction;
*/
void removeMobileApplication(MobileApplication mobileApp);
}
The push app can have different mobile applications, e.g. an iOS version, an Android version or a Windows version:
package org.jboss.aerogear.push.api;
import java.util.List;
/**
* Abstraction of a mobile application
* (e.g. iOS, Android Application or Mobile Web(JS)).
*
* One instance of this type represents EXACTLY one application
* (e.g. Twitter-iOS What's App-Android)
*
*/
public interface MobileApplication {
/**
* Returns a generated ID to represent this mobile application.
* The ID can be used to send messages to a single mobile app
* (e.g. only iOS users receive a push message)
*/
String getAeroGearMobileAppId();
/**
* Returns complete list of all installed instances
* of this mobile application
*/
List<MobileApplicationInstance> getInstances();
void addInstance(MobileApplicationInstance instance);
void removeInstance(MobileApplicationInstance instance);
}
Every MobileApplication
can have several installations:
- Matthias has twitter on iPhone
- Matthias has twitter on iPad
- Bruno has twitter on Android
Each installation is represented here:
package org.jboss.aerogear.push.api;
/**
* Each instance represents exactly one installation, per phone
*/
public interface MobileApplicationInstance {
/**
* The device token (iOS) or registration-id (Android),
* generated by the actual device
*/
void setDeviceToken(String token);
String getDeviceToken();
/**
* The name of the actual OS, used by this "Installation" (e.g. iOS)
*/
void setMobileOperatingSystem(String os);
String getMobileOperatingSystem();
/**
* The device type of the actual device (e.g. iPad )
*/
void setDeviceType(String type);
String getDeviceType();
/**
* The version of the actual OS, used by this "Installation" (e.g. 6.1.3)
*/
void setVersion(String version);
String getVersion();
}