public void unregister ( final MFPPushResponseListener < String > listener ) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder ( applicationId ) ; if ( this . deviceId == null ) { this . deviceId = MFPPushUtils . getContentFromSharedPreferences ( appContext , applicationId + DEVICE_ID ) ; } String path = builder . getUnregisterUrl ( deviceId ) ; logger . debug ( "MFPPush:unregister() - The device unregister url is: " + path ) ; MFPPushInvoker invoker = MFPPushInvoker . newInstance ( appContext , path , Request . DELETE , clientSecret ) ; invoker . setResponseListener ( new ResponseListener ( ) { @ Override public void onSuccess ( Response response ) { logger . info ( "MFPPush:unregister() - Successfully unregistered device. Response is: " + response . toString ( ) ) ; isTokenUpdatedOnServer = false ; listener . onSuccess ( "Device Successfully unregistered from receiving push notifications." ) ; } @ Override public void onFailure ( Response response , Throwable throwable , JSONObject jsonObject ) { logger . error ( "MFPPush: Error while unregistered device" ) ; listener . onFailure ( getException ( response , throwable , jsonObject ) ) ; } } ) ; invoker . execute ( ) ; }
Unregister the device from Push Server