protected synchronized void restore ( ) { try { SharedPreferences prefs = WonderPushConfiguration . getSharedPreferences ( ) ; String jsonString = prefs . getString ( getPrefName ( ) , "[]" ) ; JSONArray jsonArray = new JSONArray ( jsonString ) ; mQueue . clear ( ) ; for ( int i = 0 ; i < jsonArray . length ( ) ; i ++ ) { try { mQueue . add ( new InternalJob ( jsonArray . getJSONObject ( i ) ) ) ; } catch ( JSONException ex ) { Log . e ( TAG , "Failed to restore malformed job" , ex ) ; } catch ( Exception ex ) { Log . e ( TAG , "Unexpected error while restoring a job" , ex ) ; } } } catch ( JSONException e ) { Log . e ( TAG , "Could not restore job queue" , e ) ; } catch ( Exception e ) { Log . e ( TAG , "Could not restore job queue" , e ) ; } }
Restores the job queue from its on - disk version .