为什么我得到这个错误
Unhandled Exception: Twitterizer.TwitterizerException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.Net.WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010a
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] …Run Code Online (Sandbox Code Playgroud) 我遇到了奇怪的问题DownloadManager,下载成功但文件未存储。
这是我的代码:
try {
DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE);
request.setAllowedOverRoaming(false);
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);
request.setDestinationInExternalFilesDir(context, /temp/, "test.mp4");
final long downloadId = manager.enqueue(request);
boolean downloading = true;
while (downloading) {
DownloadManager.Query query = new DownloadManager.Query();
query.setFilterById(downloadId);
Cursor cursor = manager.query(query);
cursor.moveToFirst();
int status = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS));
int bytesDownloaded = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR));
int bytesTotal = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES));
if(status==DownloadManager.STATUS_SUCCESSFUL){
Log.i("Progress", "success");
downloading = false;
}
final int progress = (int) ((bytesDownloaded * 100l) / bytesTotal);
cursor.close();
subscriber.onNext(progress);
}
subscriber.onCompleted(); …Run Code Online (Sandbox Code Playgroud)