Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 91519 articles
Browse latest View live

Android Foreground Service Preventing Memory Release?

$
0
0

I created an android application with a foreground service that is always running. Initially, when the application is completely shut down (both process and service is not running), I try to use a broadcast to wake up the service, then my application take up 36MB of memory.
Next, I open the application and the memory usage grow up to 121MB. Finally, I tried to swipe out to kill the app, OnDestroy() method in MainActivity get called and I manually called GC.Collect() within this method, however, it's still take up 109MB of memory

My foreground service is just listening to step detector sensor and store the result to 'SharedPreferences' so I believe it won't take over hundred MB. Is there anyway to release more memory when the app is swiped out by user? Thank you.


Google Login doesn't redirect back to app

$
0
0

Well, First then nothing, I don't speak english very well..

My problem is the next, I'm trying to implement a Google Login in my app, with next two references:
1. https://jorgediegocrespo.wordpress.com/2018/12/19/login-en-google-desde-xamarin-forms/
2. timothelariviere.com/2017/09/01/authenticate-users-through-google-with-xamarin-auth/

Well, when I select a google account the next page that appear "google.com", and I dontn't knows why.

First: OPEN THE NATIVE BROSER

Seccond: com.companyname.Auth, is my package android name in the AndroidManifest.xml

Next, When I select an account appear this page with a label "Espera un momento ~ Wait a moment"

And for last appear the Google homepage and don't return to my App :(

When I close the Navigation native Browser appear this Message

In Google Developer Console my OAth Consent Screem is this:

When I call the OAth2 Constructor the redirect URL than i use is this:
com.companyname.Auth:/oauth2redirec

My Source is the same than the first url reference:

I used in one moment the video tutorial of Houssem Dellai...

https://youtube.com/watch?v=AgFIsVr26zg

In his tutorial he uses a webview in the shared code, but i readed that google don't admit this solution now, and when i run the webview i have another error from Google.

I don't understand what is my problem.. i have several days trying this :( please help!!

How should I set the position of CarouselView in runtime?

$
0
0

I want to change Position of CarouselView in runtime.

For example I have 10 element in CarouselView and my current position index is 2.
I change Position to 8 programmatically, but after that swipe mechanism doesn't work well.

First swipe after changing the Position to 8 doesn't change Postion to 7 or 9 but change it to 1 or 3.
The same situation is when I change CurrentItem or when I use ScrollTo method.

Should I set something more to achieve the correct behaviour?

UserPasswordCredentials In AcquireTokenAsync not supported with AD 5.2

$
0
0

With current AD version AcquireTokenAsync is accecpting onlu UserCredential which allows userid . Is there a way to pass password as well in XamarinForms app?

Loading menus on Catalina

$
0
0

Hi

I have a Xamarin Forms app that has run perfectly on macos for many years. The menu functionality is loaded in the AppDelegate.DidFinishLaunching function. However, since Catalina I've had problems. We've tried on 4 macs, 3 are ok but one (a paying user so I can't get his machine and take it apart) fails. And it always fails while loading the menu functions. It happily does all the other jobs in DidFinishLaunching, but crashes completely if I try to add anything to the menu.

MainWindowController mainWindowController1 = mainWindowController = new MainWindowController();
    mainWindowController1.Window.MakeKeyAndOrderFront(this);
    mainWindowController1.Window.ViewsNeedDisplay = true;
mainWindowController1.Window.rdv.SetNeedsDisplayInRect(mainWindowController.Window.rdv.Frame);
mainWindowController1.Window.Menu.ItemAt(0).Menu.ItemAt(1).Submenu.ItemAt(0).Activated += ModMain2.NewCase; 
mainWindowController1.Window.Menu.ItemAt(0).Menu.ItemAt(1).Submenu.ItemAt(1).Activated += mainWindowController.Window.OpenCase;

Has anyone else come across this or have any suggestions?

Thanks, Neil

Is it possible to use 2 resx file at the same time?

$
0
0

I need to have, in a Page, two labels

LableA
LableB (translaction of A)

For example

Autore
Author

is it possible with resx files to manage this situation?
Should I have in the resx files two strings (for example, in AppResource_it I should have "strAutore" = "Autore" and "strAutoreTranslation" = "Author") or can I have in

AppResource_it "strAutore" = "Autore"
AppResource_en "strAutore" = "Author"

and manage these in my Page?

Other solutions?

Thanks

why navigation between pages in xamarin forms is slow on Android

How can my app keep connected to a network without internet connection?

$
0
0

Hello,

My app must connect to a network (which don't have access to internet) programatically, how ever the smartphone go back the last network automatically. How can I avoid that?

It seems that priority is not working.

Edit: I'm using xamarin.forms, but i'm having this issue just with android.
Best Regards,


ListView inside CarouselView scroll vertical is almost impossible.

$
0
0

I have a collection of listviews inside a horizontal CarouselView. When im trying to scroll vertically through the listview in focus, if make any tiny movement horizontally, the carousels horizontal scrolling "takes over" and makes scrolling vertically almost impossible. Anyway i can "prioritize" the listviews scrolling?

Hope it makes sense :)

Xamarin forms: Image entry is not working as expected in android.

$
0
0

I follow this blog for adding an image inside of an entry. It was working fine in android and IOS initially.

But when I changed the android target version and target framework to 9.0 this feature start breaking. Please see the following screenshot.

enter image description here

The image inside entry is zoomed in and not showing as expected. I have updated all the android SDK but no change in the output. Should I do anything else for solving this issue in android?

If I downgrade the version from 9.0(pie) to 8.1(oreo), the UI will work as expected. Why in 9.0 it is not working?

Simpe WebApi Call

$
0
0

Hi, I'm new in Xamarin.
I created new application Xamarin.Form just to try a simple call Restfull using public json placeholder, but not works. So the result is always null. here the code:

HttpClient client = new HttpClient();
HttpResponseMessage Resp = await client.GetAsync("jsonplaceholder.typicode.com/posts/1");

Resp is null.

Please note that I removed the https:// because I am new user and the forum doesn't allow me to write full http address. But in the code it is correct.

thanks for helping me!

How can I connect to our internal IIS server from VS debug session?

$
0
0

I've written and deployed an asp.net core 3 web api REST service to our server on our network, which is hosted in IIS, and sending HTTP requests to the service works using Postman. Now I am writing a Xamarin app which needs to connect to this service. All this will be from within our network, so the server is referenced by name and its IP address is always an internal one. When debugging the app in Visual Studio, I cannot reach the server.

The Xamarin project is UWP and Android, and so far I've only been testing on UWP. I can get a response from google.com, but not from our internal server either by name or internal IP address.

Help With Crash Error?

$
0
0

Okay guys, I'm baffled - and I can't figure out what's going on with the app I'm writing.

At launch the app opens as expected, pages load and close with no issues, but I have one page that can only be opened once, and if you navigate away and try to go back it crashes with the error below.

Background:
The app is built with Xamarin.Forms Shell, and all navigation requests use: await Current.Shell.GoToAsync("pagename", true);

I'm thinking it has something to do with either the Entry or DatePicker based on what I think the StackTrace is showing me, but I'm not sure what's going on because it only happens on the 2nd time I try to navigate to the page - even if I navigate to a dozen other pages in between the 1st and 2nd time to this page. Any thoughts on how I can debug this any further without trying to rebuild the entire page?

ERROR:
System.ArgumentNullException has been thrown
Value cannot be null.
Parameter name: value

STACK TRACE:
at MaterialComponents.TextInputControllerBase.set_InlinePlaceholderColor (UIKit.UIColor value) [0x00003] in <5ea3f71d824c4ee79e20a123731c7acf>:0
at Xamarin.Forms.Material.iOS.MaterialTextManager.ApplyTheme (Xamarin.Forms.Material.iOS.IMaterialTextField textField, Xamarin.Forms.Material.iOS.IMaterialEntryRenderer element) [0x00059] in D:\a\1\s\Xamarin.Forms.Material.iOS\MaterialTextManager.cs:51
at Xamarin.Forms.Material.iOS.MaterialTextManager.Init (Xamarin.Forms.Material.iOS.IMaterialEntryRenderer element, Xamarin.Forms.Material.iOS.IMaterialTextField textField, Xamarin.Forms.Internals.IFontElement fontElement) [0x0004d] in D:\a\1\s\Xamarin.Forms.Material.iOS\MaterialTextManager.cs:26
at Xamarin.Forms.Material.iOS.MaterialTextField..ctor (Xamarin.Forms.Material.iOS.IMaterialEntryRenderer element, Xamarin.Forms.Internals.IFontElement fontElement) [0x00006] in D:\a\1\s\Xamarin.Forms.Material.iOS\MaterialTextField.cs:18
at Xamarin.Forms.Material.iOS.MaterialEntryRenderer.CreateNativeControl () [0x00000] in D:\a\1\s\Xamarin.Forms.Material.iOS\MaterialEntryRenderer.cs:10
at Xamarin.Forms.Platform.iOS.EntryRendererBase1[TControl].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs1[TElement] e) [0x00020] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\EntryRenderer.cs:107
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x00122] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:277 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:144
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:99
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:48
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x000de] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:264 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:144
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:99
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:48
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x000de] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:264 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:144
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:99
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:48
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x000de] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:264 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:144
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:99
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:48
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x000de] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:264 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:144
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:99
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:48
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x000de] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:264 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:144
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:99
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:48
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x000de] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:264 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:144
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:99
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:48
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x000de] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:264 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:144
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:99
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:48
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x000de] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:264 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:144
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:99
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:48
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x000de] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:264 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:144
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:99
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:48
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x000de] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:264 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:144
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:99
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:48
at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidLoad () [0x0008f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:238
at (wrapper managed-to-native) ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper(intptr,intptr)
at UIKit.UIViewController.get_View () [0x0002a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/UIViewController.g.cs:3171
at Xamarin.Forms.Platform.iOS.PageRenderer.get_NativeView () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:104
at Xamarin.Forms.Platform.iOS.PageRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0003d] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:120
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188
at Xamarin.Forms.Platform.iOS.ShellSectionRenderer.PushPage (Xamarin.Forms.Page page, System.Boolean animated, System.Threading.Tasks.TaskCompletionSource1[TResult] completionSource) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ShellSectionRenderer.cs:379 at Xamarin.Forms.Platform.iOS.ShellSectionRenderer.OnPushRequested (Xamarin.Forms.Internals.NavigationRequestedEventArgs e) [0x00014] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ShellSectionRenderer.cs:298 at Xamarin.Forms.Platform.iOS.ShellSectionRenderer.OnNavigationRequested (System.Object sender, Xamarin.Forms.Internals.NavigationRequestedEventArgs e) [0x00024] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ShellSectionRenderer.cs:234 at Xamarin.Forms.ShellSection.OnPushAsync (Xamarin.Forms.Page page, System.Boolean animated) [0x00065] in D:\a\1\s\Xamarin.Forms.Core\Shell\ShellSection.cs:491 at Xamarin.Forms.ShellSection.GoToAsync (Xamarin.Forms.NavigationRequest request, System.Collections.Generic.IDictionary2[TKey,TValue] queryData, System.Boolean animate) [0x00200] in D:\a\1\s\Xamarin.Forms.Core\Shell\ShellSection.cs:285
at Xamarin.Forms.Shell.GoToAsync (Xamarin.Forms.ShellNavigationState state, System.Boolean animate, System.Boolean enableRelativeShellRoutes) [0x001df] in D:\a\1\s\Xamarin.Forms.Core\Shell\Shell.cs:444
at HthApp.Api.HthApi.ItemSearchOpenAsync () [0x0002a] in /Users/matthew.bailey/Projects/hthapp/HthApp/Api/HthApi.cs:1519
at HthApp.Api.HthApi+<>c.b__53_3 () [0x00019] in /Users/matthew.bailey/Projects/hthapp/HthApp/Api/HthApi.cs:330
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0 (System.Object state) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/Foundation/NSAction.cs:178

Anyone successfully passed cookies to WkWebView?

$
0
0

I have been working on a Custom WebView that on iOS uses the native WkWebView instead of the default.
My pain is that passing cookies to it from a HttpClient does not always sent those cookies on first request.
The intention is that the user, already being logged in using a HttpClient, opens a page showing the webpage of our service. By reusing the cookies, the user does not need to authenticate again. But by using the WkWebView, I sometimes end up on the loginpage, as a result of cookies not being passed properly.

This is my iOS Custom Renderer for the WebView:

public class CustomWebViewRenderer : ViewRenderer<CustomWebView, WKWebView>
{
    protected override async void OnElementChanged(ElementChangedEventArgs<CustomWebView> e)
    {
        base.OnElementChanged(e);

        if (e.NewElement != null)
        {
            if (Control == null)
            {
                var config = new WKWebViewConfiguration();

                var jCookies = Appl.FlurlClient.Cookies.Values;

                NSHttpCookie[] nsHttpCookies = jCookies.Where(c => c != null).Select(c => new NSHttpCookie(c)).ToArray();

                foreach (var c in nsHttpCookies)
                {
                    await config.WebsiteDataStore.HttpCookieStore.SetCookieAsync(c);
                }

                var webView = new WKWebView(Frame, config);
                SetNativeControl(webView);
            }
            Control.LoadRequest(new NSUrlRequest(new NSUrl(Element.Uri)));
        }
    }
}

Xamarin.Forms TimePicker with 15 minutes Intervals?

$
0
0

how to pass min interval in the Xamarin Forms TimePicker.

I had solution for the renderer iOS:

[assembly: ExportRenderer(typeof(TimePicker), typeof(TimePickerRenderers))]
namespace Anjep_Toolbox.MobileApp.iOS.Renderer
{
public class TimePickerRenderers : TimePickerRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs e)
{
base.OnElementChanged(e);
if(e.NewElement != null)
{
var timePicker = (UIDatePicker)Control.InputView;
timePicker.Locale = new NSLocale("no_nb");
timePicker.MinuteInterval = new nint(15);
}

  //if (Control != null)
  //{
  //  Control.Text = DateTime.Now.ToString("HH:mm");
  //}
}

}
}

but not found any working solution for the android platform.

so guys kindly let me know if you have a solution.

Please help me!


Changing View from public to internal with XAML (x:ClassModifier)

$
0
0

Hi,

I have a question regarding the internal XAML Class Modifier.

I tried to set it to x:ClassModifier="internal" or x:ClassModifier="NotPublic"
But by doing so I get the compiler error CS0262 (Partial declarations of 'type' have conflicting accessibility modifiers)
because I have already changed my codebehind file to internal also.

By looking at the *.g.cs File I see that the generated code is public partial class … so I think it is not respecting
that x:ClassModifier Keyword or I am doing something wrong here ?

LinearItemsLayout ignores ItemSpacing property on UWP

$
0
0

I'm using a CollectionView with a LinearItemsLayout. I set the ItemSpacing to zero which works on Android and iOS but it doesn't work on UWP - there is always a spacing between items. The orientation property doesn't make any difference - the problem is there for vertical and horizontal views.

<CollectionView.ItemsLayout>

</CollectionView.ItemsLayout>

Is there a fix for this?

Can we send whatsapp's messages from a xamarin forms app?

$
0
0

I mean, in the same way you can send SMS from android's messenger service I want to do the same but sending whatsapps from my xamarin forms app. That's possible?

Have to clean/rebuild project every time

$
0
0

Hi,

I've just started to use Xamarin Forms and every time I want to run an iOS application in the simulator I have to clean/rebuild the solution. If I don't then it appears to still compile, but always runs the previously cleaned/built version... Am I missing something? From Googling it seems I'm the only one with this issue! Tried 2 separate PCs and a fresh install of everything. Also tried going back a few versions of Xamarin Forms but no luck

It's incredibly annoying and rendering it almost unusable.

Thanks!

VS 2019 16.1.6
Xamarin Forms 4.1.0.581479

data is getting differnt from one version of android to another version in xaamrin form s

$
0
0

Can any one help me on this
Data is getting from API is differnt from one version of android to another version of android device in xamarin forms. Per example Data changes happens from 6 version to 7 version of android, 6 th version working fine but 7 version of android device .
Please help me on this .

Viewing all 91519 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>