protected static void sendLogsToServer ( boolean setSentTime ) { long timeSent = new Date ( ) . getTime ( ) ; String appFeedBackSummary = Utility . convertFileToString ( "AppFeedBackSummary.json" ) ; if ( "" . equals ( appFeedBackSummary ) || "{}" . equals ( appFeedBackSummary ) ) { return ; } else { try { JSONObject appFeedBacksummaryJSON = new JSONObject ( appFeedBackSummary ) ; JSONArray savedArray = ( JSONArray ) appFeedBacksummaryJSON . get ( "saved" ) ; HashMap < String , String > timeSentMap = new HashMap <> ( ) ; //Add timeSent to all the json file's which are not set with timeSent for ( int i = 0 ; i < savedArray . length ( ) ; i ++ ) { String instanceName = ( String ) savedArray . get ( i ) ; String screenFeedBackJsonFile = Utility . getJSONfileName ( instanceName ) ; String actualTimeSent = Utility . addAndFetchSentTimeFromScreenFeedBackJson ( screenFeedBackJsonFile , timeSent , setSentTime ) ; if ( actualTimeSent != null ) { timeSentMap . put ( instanceName , actualTimeSent ) ; } } //Iterate each feedback element which is not yet sent for ( int i = 0 ; i < savedArray . length ( ) ; i ++ ) { String instanceName = ( String ) savedArray . get ( i ) ; String screenFeedBackJsonFile = Utility . getJSONfileName ( instanceName ) ; String actualTimeSent = timeSentMap . get ( instanceName ) ; String zipFile = Utility . storageDirectory + instanceName + "_" + actualTimeSent + ".zip" ; List < String > fileList = new ArrayList <> ( ) ; fileList . add ( Utility . getImageFileName ( instanceName ) ) ; fileList . add ( screenFeedBackJsonFile ) ; Utility . createZipArchive ( fileList , zipFile ) ; LogPersister . sendInAppFeedBackFile ( zipFile , new FeedBackUploadResponseListener ( instanceName , zipFile , actualTimeSent ) ) ; } } catch ( JSONException je ) { } } }
Send Logs to Server