Skip to content

Commit ad69e63

Browse files
author
oleg
committed
BKNDLSS-17823 Remove all unregisterDeviceOnServer as well as registerDeviceOnServer methods
1 parent ade2b5a commit ad69e63

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

src/com/backendless/Messaging.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@
6565
public final class Messaging
6666
{
6767
private final static String MESSAGING_MANAGER_SERVER_ALIAS = "com.backendless.services.messaging.MessagingService";
68-
public final static String DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS = "com.backendless.services.messaging.DeviceRegistrationService";
68+
private final static String DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS = "com.backendless.services.messaging.DeviceRegistrationService";
6969
private final static String EMAIL_MANAGER_SERVER_ALIAS = "com.backendless.services.mail.CustomersEmailService";
7070
private final static String DEFAULT_CHANNEL_NAME = "default";
71-
public final static String OS;
72-
public final static String OS_VERSION;
71+
private final static String OS;
72+
private final static String OS_VERSION;
7373
private static final Messaging instance = new Messaging();
7474
private static final ChannelFactory chanelFactory = new ChannelFactory();
7575

@@ -131,6 +131,21 @@ public static String getDeviceId()
131131
return DeviceIdHolder.id;
132132
}
133133

134+
public static String getDeviceRegistrationManagerServerAlias()
135+
{
136+
return DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS;
137+
}
138+
139+
public static String getOS()
140+
{
141+
return OS;
142+
}
143+
144+
public static String getOsVersion()
145+
{
146+
return OS_VERSION;
147+
}
148+
134149
static Messaging getInstance()
135150
{
136151
return instance;

src/com/backendless/push/DeviceRegistrationUtil.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ public String registerDeviceOnServer( String deviceToken, final List<String> cha
3131

3232
DeviceRegistration deviceRegistration = new DeviceRegistration();
3333
deviceRegistration.setDeviceId( Messaging.getDeviceId() );
34-
deviceRegistration.setOs( Messaging.OS );
35-
deviceRegistration.setOsVersion( Messaging.OS_VERSION );
34+
deviceRegistration.setOs( Messaging.getOS() );
35+
deviceRegistration.setOsVersion( Messaging.getOsVersion() );
3636
deviceRegistration.setDeviceToken( deviceToken );
3737
deviceRegistration.setChannels( channels );
3838
if( expiration != 0 )
3939
deviceRegistration.setExpiration( new Date( expiration ) );
4040

41-
return Invoker.invokeSync( Messaging.DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS, "registerDevice", new Object[] { deviceRegistration } );
41+
return Invoker.invokeSync( Messaging.getDeviceRegistrationManagerServerAlias(), "registerDevice", new Object[] { deviceRegistration } );
4242
}
4343

4444
public void registerDeviceOnServer( String deviceToken, final List<String> channels, final long expiration, final AsyncCallback<String> responder )
@@ -50,14 +50,14 @@ public void registerDeviceOnServer( String deviceToken, final List<String> chann
5050

5151
DeviceRegistration deviceRegistration = new DeviceRegistration();
5252
deviceRegistration.setDeviceId( Messaging.getDeviceId() );
53-
deviceRegistration.setOs( Messaging.OS );
54-
deviceRegistration.setOsVersion( Messaging.OS_VERSION );
53+
deviceRegistration.setOs( Messaging.getOS() );
54+
deviceRegistration.setOsVersion( Messaging.getOsVersion() );
5555
deviceRegistration.setDeviceToken( deviceToken );
5656
deviceRegistration.setChannels( channels );
5757
if( expiration != 0 )
5858
deviceRegistration.setExpiration( new Date( expiration ) );
5959

60-
Invoker.invokeAsync( Messaging.DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS, "registerDevice", new Object[] { deviceRegistration }, new AsyncCallback<String>()
60+
Invoker.invokeAsync( Messaging.getDeviceRegistrationManagerServerAlias(), "registerDevice", new Object[] { deviceRegistration }, new AsyncCallback<String>()
6161
{
6262
@Override
6363
public void handleResponse( String response )
@@ -83,21 +83,21 @@ public void handleFault( BackendlessFault fault )
8383

8484
public boolean unregisterDeviceOnServer()
8585
{
86-
return (Boolean) Invoker.invokeSync( Messaging.DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS, "unregisterDevice", new Object[] { Messaging.getDeviceId() } );
86+
return (Boolean) Invoker.invokeSync( Messaging.getDeviceRegistrationManagerServerAlias(), "unregisterDevice", new Object[] { Messaging.getDeviceId() } );
8787
}
8888

8989
public void unregisterDeviceOnServer( final AsyncCallback<Boolean> responder )
9090
{
91-
Invoker.invokeAsync( Messaging.DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS, "unregisterDevice", new Object[] { Messaging.getDeviceId() }, responder );
91+
Invoker.invokeAsync( Messaging.getDeviceRegistrationManagerServerAlias(), "unregisterDevice", new Object[] { Messaging.getDeviceId() }, responder );
9292
}
9393

9494
public int unregisterDeviceOnServer( List<String> channels )
9595
{
96-
return (int) Invoker.invokeSync( Messaging.DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS, "unregisterDevice", new Object[] { Messaging.getDeviceId(), channels } );
96+
return (int) Invoker.invokeSync( Messaging.getDeviceRegistrationManagerServerAlias(), "unregisterDevice", new Object[] { Messaging.getDeviceId(), channels } );
9797
}
9898

9999
public void unregisterDeviceOnServer( List<String> channels, final AsyncCallback<Integer> responder )
100100
{
101-
Invoker.invokeAsync( Messaging.DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS, "unregisterDevice", new Object[] { Messaging.getDeviceId(), channels }, responder );
101+
Invoker.invokeAsync( Messaging.getDeviceRegistrationManagerServerAlias(), "unregisterDevice", new Object[] { Messaging.getDeviceId(), channels }, responder );
102102
}
103103
}

0 commit comments

Comments
 (0)