xamarin.android

Setting android theme to follow system does not change to current system theme

做~自己de王妃 提交于 2020-06-17 10:09:08
问题 In the settings of my app i have it so that you are able to switch the theme off the app between Light, Dark and following the system. Switching between them is fine and i have that all setup however when switching to follow system from one of the other themes it does not change to the systems theme if the theme before was different to the system. I am using this code to switch the theme: { Spinner spinner = (Spinner)sender; string selectedSpinnerItem = spinner.GetItemAtPosition(e.Position)

Setting android theme to follow system does not change to current system theme

浪尽此生 提交于 2020-06-17 10:08:32
问题 In the settings of my app i have it so that you are able to switch the theme off the app between Light, Dark and following the system. Switching between them is fine and i have that all setup however when switching to follow system from one of the other themes it does not change to the systems theme if the theme before was different to the system. I am using this code to switch the theme: { Spinner spinner = (Spinner)sender; string selectedSpinnerItem = spinner.GetItemAtPosition(e.Position)

WebView How to run even when app is in background/closed (foreground service active)

一个人想着一个人 提交于 2020-06-17 09:38:19
问题 I'm building an app which will scrape some data from a website and shows a notification when some criteria are met. Everything works well without problems when the app is open (because the WebView is being rendered) but when I close the app the WebView is disabled so I cannot use it to scrape data anymore. The scraping code is inside a class called from a ForegroundService. I've already looked on the internet but I'm unable to find a solution or a substitute to WebView, do you have any ideas?

Xamarin Forms CollectionView doesn't show properly

廉价感情. 提交于 2020-06-17 09:32:48
问题 I have a problem. I created a CollectionView with a custom ViewPage to place a grid with rowspan. The ItemSource is set using a ViewModel. Now when I scroll in the CollectionView the rows are randomly placed on the screen, even inside each other. Here is my xaml code: <CollectionView ItemsSource="{Binding agentOrderList}" Margin="5,0,5,0" HeightRequest="450"> <CollectionView.ItemsLayout> <LinearItemsLayout Orientation="Vertical" ItemSpacing="0"/> </CollectionView.ItemsLayout> <CollectionView

How to convert Xamarin Forms view to a Native view iOS/Android with the same size?

匆匆过客 提交于 2020-06-17 09:31:07
问题 I am using the example here, but I am struggeling to fill in the right size parameter here so that it represents the same size as the forms view. https://michaelridland.com/xamarin/creating-native-view-xamarin-forms-viewpage/ public static UIView ConvertFormsToNative(Xamarin.Forms.View view, CGRect size) { var renderer = RendererFactory.GetRenderer(view); renderer.NativeView.Frame = size; renderer.NativeView.AutoresizingMask = UIViewAutoresizing.All; renderer.NativeView.ContentMode =

How to resolve Xamarin Android linking problem

孤者浪人 提交于 2020-06-17 07:55:11
问题 My Xamarin Forms Android app works fine in Debug. But in Release, when deployed to either the emulator or to a device, the app is "stopped" after showing the splash screen. The debug log shows these errors, indicating that it can't find class FitWindowsLinearLayout... 10-23 22:24:59.270 14008 14008 E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #14: Binary XML file line #14: Error inflating class android.support.v7.widget.FitWindowsLinearLayout 10-23 22:24:59

Turn on Airplane mode using AccessibilityService Class in Xamarin

大城市里の小女人 提交于 2020-06-17 05:52:28
问题 I want to turn on or off airplane mode using AccessibilityService . Any idea how we can do it? 回答1: Kamal you’re not going to be able to do it. It doesn’t seem like you’re doing iOS, but iOS has a lot of limitations due to privacy and security purposes that won’t allow you to do this. You can see more details here stackoverflow.com/q/20469425/11104068 Also android blocked being able to do this from Android 4.2 onwards. Only system apps can make changes to Airplane mode, as you can see here

FFImageLoading: How to add authentication?

感情迁移 提交于 2020-06-17 01:51:52
问题 I'm trying to use FFImageLoading in my Xamarin.iOS and Xamarin.Android apps to load images from url. All the url's require authentication.. Also I'm using modernhttpclient for all other Rest Calls. For modernhttpclient this is how I'm adding authentication var cookieHandler = new NativeCookieHandler (); var messageHandler = new NativeMessageHandler (false, false, cookieHandler); cookieHandler.SetCookies (RestApiPaths.cookies); using (var client = new HttpClient (messageHandler)) { client

“SocketException: Could not resolve host” when connecting to SFTP server with SSH.NET

走远了吗. 提交于 2020-06-08 13:15:52
问题 Trying to upload file to SFTP server in my local. Hit error when connect SFTP. System.Net.Sockets.SocketException: Could not resolve host 'sftp://localhost' I've tried using command-line and FileZilla to connect. It can connected. string host = "sftp://localhost"; int port = 22; string username = "gth"; string password = "1234"; using (SftpClient client = new SftpClient(host, port, username, password)) { client.Connect(); } It show me error below: Loaded assembly: System.Threading.Tasks.dll

Discover Nearby Smartphone Devices on Android

假如想象 提交于 2020-05-28 04:33:07
问题 Problem Statement I am trying to make an application for Android that can detect nearby smartphone devices. I need to discover smartphone devices regardless of their connection to a WLAN or their operating system. The only requirement is that their bluetooth or wifi setting is enabled. I am trying to capture the MAC Address and maybe RSSI of these devices. An example of an application I am trying to emulate is Meshlium. Methods Already Considered Android Classic Bluetooth: I have followed the