java - Amazon s3 Upload Progress calculation in android for Transfer Manager -
I am using a high level API to upload Amazon S3 and withdrawing calls for a progress , But the method upload.getprogress (). GetPercentageTransferred () sometimes gives up to 100 percent .. Why does it show above 100? Is there a necessary change
Basic acceptances lAwsCredentials = new BasicAWSCredentials (constant. ACCESS_KEY_ID, Constants.SECRET_KEY); Amazon S3 Client s3Client = New Amazon S3 Client (L'Evers Credentials); Transfer Manager TM = New Transfer Manager (S3 Client); File lFile = new file (mFilePath); PutObjectRequest putRequest = new PutObjectRequest (mBucketName, mKeyName, lFile); MUpload = tm.upload (putRequest, new S3ProgressListener) (Executioner service lExecutor = Exporter. NewfixedThreadPool (1); @ Override by changing public blank progress (ProgressEvent RGR) {// log.V (tag, "Transfer:" + mUpload.getDescription ()); // Log.v (TAG, "- Percent:" // + mUpload.getProgress (). GetPercentTransferred (); double lprrogress = mUpload.getProgress () .getPercentTransferred (); int lProgressInteger = (int) L Progress; if (lProgressInteger% 10 == 0) {Log D. (Tag, "File ID:" + mLocalFileId + "==== Transfer:" + mUpload.getDescription () + "==== Percent:" + MAYUPLoad .getProgress () GetPercentTransferred (); Publishing Progress (lProgressInteger); }} Override Persistent Transfer on Public Zero (Last Continuous Transfer Transable Transfer) {lExecutor.submit (New Runnabal) ({Override Public Wired Run}} {File F = New File (Environmental .getExternalStorage Directory ()) "/ Restart Do "); Try (! F.exists ()) {f.createNewFile (); FileOutputStream Foss; Fos = New FileOutputStream (f); PersistableTransfer.serialize (FOS); Fos.close (); } Hold (FileNotFoundException E) {// TODO Auto generated blocking block e.printStackTrace (); } Grip (IOException E) {// TODO Auto-Generated Catch Block e.printStackTrace (); }}}); }});
Comments
Post a Comment