@@ -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 ;
@@ -191,64 +206,6 @@ private void checkChannelName( String channelName )
191206 throw new IllegalArgumentException ( ExceptionMessage .NULL_CHANNEL_NAME );
192207 }
193208
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-
252209 public void unregisterDevice ()
253210 {
254211 unregisterDevice ( (List <String >) null );
@@ -269,26 +226,6 @@ public void unregisterDevice( final List<String> channels, final AsyncCallback<I
269226 FCMRegistration .unregisterDevice ( ContextHandler .getAppContext (), channels , callback );
270227 }
271228
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-
292229 public boolean refreshDeviceToken ( String newDeviceToken )
293230 {
294231 return Invoker .invokeSync ( DEVICE_REGISTRATION_MANAGER_SERVER_ALIAS , "refreshDeviceToken" , new Object [] { getDeviceId (), newDeviceToken } );
0 commit comments