6565public final class Messaging
6666{
6767 private final static String MESSAGING_MANAGER_SERVER_ALIAS = "com.backendless.services.messaging.MessagingService" ;
68- private final static String DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS = "com.backendless.services.messaging.DeviceRegistrationService" ;
68+ public 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- private final static String OS ;
72- private final static String OS_VERSION ;
71+ public final static String OS ;
72+ public final static String OS_VERSION ;
7373 private static final Messaging instance = new Messaging ();
7474 private static final ChannelFactory chanelFactory = new ChannelFactory ();
7575
@@ -191,64 +191,6 @@ private void checkChannelName( String channelName )
191191 throw new IllegalArgumentException ( ExceptionMessage .NULL_CHANNEL_NAME );
192192 }
193193
194- public String registerDeviceOnServer ( String deviceToken , final List <String > channels , final long expiration )
195- {
196- if ( deviceToken == null )
197- throw new IllegalArgumentException ( ExceptionMessage .NULL_DEVICE_TOKEN );
198-
199- DeviceRegistration deviceRegistration = new DeviceRegistration ();
200- deviceRegistration .setDeviceId ( getDeviceId () );
201- deviceRegistration .setOs ( OS );
202- deviceRegistration .setOsVersion ( OS_VERSION );
203- deviceRegistration .setDeviceToken ( deviceToken );
204- deviceRegistration .setChannels ( channels );
205- if ( expiration != 0 )
206- deviceRegistration .setExpiration ( new Date ( expiration ) );
207-
208- return Invoker .invokeSync ( DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS , "registerDevice" , new Object [] { deviceRegistration } );
209- }
210-
211- public void registerDeviceOnServer ( String deviceToken , final List <String > channels , final long expiration ,
212- final AsyncCallback <String > responder )
213- {
214- try
215- {
216- if ( deviceToken == null )
217- throw new IllegalArgumentException ( ExceptionMessage .NULL_DEVICE_TOKEN );
218-
219- DeviceRegistration deviceRegistration = new DeviceRegistration ();
220- deviceRegistration .setDeviceId ( getDeviceId () );
221- deviceRegistration .setOs ( OS );
222- deviceRegistration .setOsVersion ( OS_VERSION );
223- deviceRegistration .setDeviceToken ( deviceToken );
224- deviceRegistration .setChannels ( channels );
225- if ( expiration != 0 )
226- deviceRegistration .setExpiration ( new Date ( expiration ) );
227-
228- Invoker .invokeAsync ( DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS , "registerDevice" , new Object [] { deviceRegistration }, new AsyncCallback <String >()
229- {
230- @ Override
231- public void handleResponse ( String response )
232- {
233- if ( responder != null )
234- responder .handleResponse ( response );
235- }
236-
237- @ Override
238- public void handleFault ( BackendlessFault fault )
239- {
240- if ( responder != null )
241- responder .handleFault ( fault );
242- }
243- } );
244- }
245- catch ( Throwable e )
246- {
247- if ( responder != null )
248- responder .handleFault ( new BackendlessFault ( e ) );
249- }
250- }
251-
252194 public void unregisterDevice ()
253195 {
254196 unregisterDevice ( (List <String >) null );
@@ -269,26 +211,6 @@ public void unregisterDevice( final List<String> channels, final AsyncCallback<I
269211 FCMRegistration .unregisterDevice ( ContextHandler .getAppContext (), channels , callback );
270212 }
271213
272- public boolean unregisterDeviceOnServer ()
273- {
274- return (Boolean ) Invoker .invokeSync ( DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS , "unregisterDevice" , new Object [] { getDeviceId () } );
275- }
276-
277- public void unregisterDeviceOnServer ( final AsyncCallback <Boolean > responder )
278- {
279- Invoker .invokeAsync ( DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS , "unregisterDevice" , new Object [] { getDeviceId () }, responder );
280- }
281-
282- public int unregisterDeviceOnServer ( List <String > channels )
283- {
284- return (int ) Invoker .invokeSync ( DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS , "unregisterDevice" , new Object [] { getDeviceId (), channels } );
285- }
286-
287- public void unregisterDeviceOnServer ( List <String > channels , final AsyncCallback <Integer > responder )
288- {
289- Invoker .invokeAsync ( DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS , "unregisterDevice" , new Object [] { getDeviceId (), channels }, responder );
290- }
291-
292214 public boolean refreshDeviceToken ( String newDeviceToken )
293215 {
294216 return Invoker .invokeSync ( DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS , "refreshDeviceToken" , new Object [] { getDeviceId (), newDeviceToken } );
0 commit comments