public void getSubscriptions ( final MFPPushResponseListener < List < String > > listener ) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder ( applicationId ) ; String path = builder . getSubscriptionsUrl ( deviceId , null ) ; if ( path == DEVICE_ID_NULL ) { listener . onFailure ( new MFPPushException ( "The device is not registered yet. Please register device before calling subscriptions API" ) ) ; return ; } MFPPushInvoker invoker = MFPPushInvoker . newInstance ( appContext , path , Request . GET , clientSecret ) ; invoker . setResponseListener ( new ResponseListener ( ) { @ Override public void onSuccess ( Response response ) { List < String > tagNames = new ArrayList < String > ( ) ; try { JSONArray tags = ( JSONArray ) ( new JSONObject ( response . getResponseText ( ) ) ) . get ( SUBSCRIPTIONS ) ; int tagsCnt = tags . length ( ) ; for ( int tagsIdx = 0 ; tagsIdx < tagsCnt ; tagsIdx ++ ) { tagNames . add ( tags . getJSONObject ( tagsIdx ) . getString ( TAG_NAME ) ) ; } listener . onSuccess ( tagNames ) ; } catch ( JSONException e ) { logger . error ( "MFPPush: getSubscriptions() - Failure while getting subscriptions. Failure response is: " + e . getMessage ( ) ) ; listener . onFailure ( new MFPPushException ( e ) ) ; } } @ Override public void onFailure ( Response response , Throwable throwable , JSONObject jsonObject ) { //Error while getSubscriptions. logger . error ( "MFPPush: Error while getSubscriptions" ) ; listener . onFailure ( getException ( response , throwable , jsonObject ) ) ; } } ) ; invoker . execute ( ) ; }
Get the list of tags subscribed to