xamarin.android

Bug in Mono !? WebRequest to a HTTPS resource with proxy fails to work

孤人 提交于 2019-12-11 09:21:55
问题 I have a proxy(Fiddler) setup and I created an Android app on Windows 10 x64 with latest Xamarin stable as of today, with the following code: IWebProxy proxy = new WebProxy("http://192.168.1.100:8888/"); proxy.Credentials = new NetworkCredential("johndoe", "1234567890"); WebRequest.DefaultWebProxy = proxy; var req = WebRequest.CreateHttp("https://www.google.com"); req.GetResponse(); throws exception: Unhandled Exception: System.Net.WebException: Error: Success If I change the request to non

Creating Xamarin button with gradient colour and curved edges

时间秒杀一切 提交于 2019-12-11 09:19:58
问题 I have a xamarin Android button with curved edges (Border radius). There I want to make colour as gradient. If I try to make it by painting the canvas (as a custom renderer) it will disappear curved edges as follows by overriding the ButtonRenderer's DispatchDraw function. protected override void DispatchDraw(Canvas canvas) { var gradient = new Android.Graphics.LinearGradient(0, 0, Width, Height, this.StartColor.ToAndroid(), this.EndColor.ToAndroid(), Android.Graphics.Shader.TileMode.Clamp);

Xamarin MonoAndroid DeviceAdmin

混江龙づ霸主 提交于 2019-12-11 09:14:21
问题 I am using Visual Studio 2017, to develop an Android Single-View application. The application should be a kiosk app. I am targeting API 21, on an Emulator provided by Visual Studio (AVD Device). The issue I am having is that I cannot seem to make a valid DeviceAdminReceiver. I used this link as my guide: Android Kiosk Mode The sample works, but my code does not. The sample is for java. This is how my DeviceAdmiReceiver.cs: [BroadcastReceiver(Permission = "android.permission.BIND_DEVICE_ADMIN"

FusedLocationProviderClient - type or namespace could not be found (error)

痴心易碎 提交于 2019-12-11 09:02:07
问题 So sorry if this is really simple (also failing to install google play services on Marshmallow emulator, and getting a tad wound up!). I am aiming to get GPS data in a Xamarin Android C# project on Visual Studio 2017 (15.6.3). I am following the Xamarin Location Services walkthrough (https://docs.microsoft.com/en-gb/xamarin/android/platform/maps-and-location/location#using-the-fused-location-provider) and source code examples. I have tried targeting Android 6.0 (my preferred) and also 7.1 and

Change Status Bar color during runtime on android in Xamarin.Forms

守給你的承諾、 提交于 2019-12-11 08:40:56
问题 I would like to change the colour of the status bar during run-time programatically. I have tried this: if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { Window.ClearFlags(WindowManagerFlags.TranslucentStatus); Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); Window.SetStatusBarColor(Android.Graphics.Color.Blue); } but it only works in the MainActivity.cs class. I would like to change it during runtime. 回答1: Dependency Interface: public interface IStatusBarColor { void

MvvmCross - Change Hamburger menu to back button

感情迁移 提交于 2019-12-11 08:37:04
问题 I'm using the XPlatformMenus sample Android project available at https://github.com/MvvmCross/MvvmCross-Samples/tree/master/XPlatformMenus What I want to do is, when the user navigates to the InfoFragment, that the Hamburger menu icon change to a back arrow and when pressed the app navigates to the previous view/fragment, which in this case is the HomeFragment. I've seen a method called ShowBackButton on the MainActivity, but it is not called from anywhere, so I've added it's code to the

How to give multi-device support in Xamarin Forms

混江龙づ霸主 提交于 2019-12-11 08:26:04
问题 I am newbie to Xamarin development. In android we have different values folder for multi-device support. But In Xamarin forms how we give multi-device support for Android & iOS? Anyone don't know about what is multi-device support pls check the sample document by Android https://developer.android.com/guide/practices/screens_support.html I want similar like this for Xamarin forms. Note: I am asking about Xamarin forms not in native code. Any suggestions or ideas are welcome. Thanks for your

Customizing spinner's item background color

允我心安 提交于 2019-12-11 08:25:34
问题 I am making an app to calculate resistor value out of its color bands. Everything works fine on the pure programming side. At the moment for selcting color bands I am using a spinner filled with list of colors. I really want to make it look better. I want to be able to set background color of each item in the spinner to its corresponding color: What should I do to achive this? Here is part of my code: Array used for spinner: <string-array name="FourBandResistorFullColor"> <item>Black</item>

Unable to send email using Mailkit from a xamarin.android app

♀尐吖头ヾ 提交于 2019-12-11 08:19:36
问题 I am not able to send email from a xamarin.android app using MailKit library of jstedfast. I am using the following code : try { //From Address string FromAddress = "from_sender@gmail.com"; string FromAdressTitle = "Email Title"; //To Address string ToAddress = "to_receiver@gmail.com"; string ToAdressTitle = "Address Title"; string Subject = "Subject of mail"; string BodyContent = "Body of email"; //Smtp Server string SmtpServer = "smtp.gmail.com"; //Smtp Port Number int SmtpPortNumber = 587;

Is AOT (ahead of time) compilation available (or planned) in mono for android?

≯℡__Kan透↙ 提交于 2019-12-11 08:17:03
问题 I was wondering if there is any AOT compilation options for the mono for android platform (or anything planned?). I am asking this because I will port a game using mono for android, and performance is really important, this is why I wanted to know if AOT compilation is available (or any other compilation option that can produce better performances) I know that Monotouch uses AOT compilation, and that it can optionally use llvm as compiler in order to make some optimisations. So, I am