echo "# xamarin" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/mikerains/xamarin.git
git push -u origin master
- https://blogs.msdn.microsoft.com/devops/2014/11/12/introducing-visual-studios-emulator-for-android/
- https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/debug-on-emulator/visual-studio-android-emulator/
- https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/debug-on-device/
- https://developer.xamarin.com/guides/android/getting_started/installation/set_up_device_for_development/
- General USB Drivers https://developer.android.com/studio/run/oem-usb.html#Drivers
- Kyocera Phone USB Drivers http://www.kyoceramobile.com/support/drivers/
-
Troubleshooting the Visual Studio Emulator for Android https://msdn.microsoft.com/en-us/library/mt228282.aspx
-
http://dotnetbyexample.blogspot.hu/2016/02/fix-for-could-not-connect-to-debugger.html
-
Configure Hyper-V Machine to "Migrate to Different Physical Processor"
-
Configure Android Project to not do the "Fast Deployment"
-
Make sure Studio Project Proeprties - Build - that Optimize Code is not checked.
-
Also in Android Options, I have needed to
- checkmark Enable developer instrumentation ( Debugging Tooling, and set ) ,
- set Debugger to .Net/Xamarin, and Linking to "Sdk and User Assemblies"
- Uncheck "Optimize code"
- Android Phone needs to trust the Local Certificate
- In Android - Settings - Security - Install From SD Card
- I exported the certificate in Windows Cert Manager, copied over USB to my phone, and then installed in settings
- https://stackoverflow.com/questions/29279486/how-to-resolve-enter-the-password-for-credential-storage-issue
- About Certificates: http://info.ssl.com/article.aspx?id=12149
- More about certs: https://stackoverflow.com/questions/642284/apache-with-ssl-how-to-convert-cer-to-crt-certificates
- In Android - Settings - Security - Install From SD Card
- Command prompt in android-srd\platf0rm-tools> adb logcat AndroidRuntime:E *:S
System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: TrustFailure (The authentication or decryption has failed.) ---> System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: Error while sending TLS Alert (Fatal:InternalError): System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code: 0xffffffff800b010f at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (System.IAsyncResult asyncResult) [0x0000c] in :0 ---> System.IO.IOException: Unable to write data to the transport connection: Connection reset by peer. ---> System.Net.Sockets.SocketException: Connection reset by peer at System.Net.Sockets.Socket.EndSend (System.IAsyncResult asyncResult) [0x00012] in :0 ... --- End of inner exception stack trace --- at Mono.Net.Security.Private.LegacySslStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x0000e] in :0 ... at Hatcx.Services.UserManagement.Client.UserManagementOperations +d__10.MoveNext () [0x001b9] in :0 --- End of stack trace from previous location where exception was thrown --- at Hatcx.Services.UserManagement.Client.UserManagementOperationsExtensions+d__3.MoveNext () [0x00075] in :0 +d__10.MoveNext () [0x001b9] in :0 --- End of stack trace from previous location where exception was thrown --- ... at Hatcx.Mobile.Cost.Services.DataProvider+d__20.MoveNext () [0x00153] in C:\hatcxgit\HATCXCost\src\HatcxCost\Services\DataProvider.cs:263
Diagnosis: When .Net is running on a Windows machine, it has access to the certificate store, and knows about local certificates installed there. MONO does not have access to the store, so we need to handle untrusted certificates in the ServicePointManager callback.
In HatcxCostDroid's LaunchActivity.OnCreate:
//ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback((sender, certificate, chain, policyErrors) => { return true; });
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, policyErrors) =>
{
string[] allowThumbprints = .....; //get from config somewhere
if (errors == SslPolicyErrors.None) return true;
// get the thumbprint of the certificate that is being validated
var currentCertificateThumbprint = (certificate as X509Certificate2)?.Thumbprint;
// determine if any of the allowed thumbprints matches the current thumbprint
return !string.IsNullOrWhiteSpace(currentCertificateThumbprint)
&& allowedThumbprints.Any(thumbprint => thumbprint.Equals(currentCertificateThumbprint, StringComparison.InvariantCultureIgnoreCase));
};
First of all, I got into these samples from working through Xamarin.com's "Application Fundamentals", and the first sample app is from https://developer.xamarin.com/guides/android/application_fundamentals/services/creating-a-service/bound-services/