Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all 204402 articles
Browse latest View live

How to set the Selected Item of a Picker Control through View Model (MVVM)

$
0
0

Hi there,

I will try to explain this as best I can so please bare with me:

Background:

I have two pages that interact with each other - a customer page (CustomerPage) which stores a listing of customers and an edit page (CustomerEditPage) used to add new customers or edit customers passed in from the customer page list. I am able to pass the Customer class of the selected customer in the customer page to the edit customer page without issue. I am also able to set all of the Entry controls to the values through passing the values. In addition to the Entry controls I also have a Picker control used to store location name values (e.g. 123 West St, 85 George St, etc.). It has an ItemSource that loads successfully through the view model. However I have an issue when trying to specify the selected item from a value passed to the view model on load. The bound property fires and shows it being set, but the control does not show anything selected after load in the application. If I click on the control, my values are there but again nothing is selected.

Can someone help me explain how I can set the selected item?

Things I have tried:

  • Ensuring the ItemSource is loaded before the SelectedItem value is set
  • Put a break-point on the Handles_ItemSelected event to see when it is firing (*Note it only fires when I select an item from the list and NOT when set through code in the view model)
  • Adding an ID column to the CustomerLocation class to see if the Picker needed a key value

Item Selected from ListView in CustomerViewModel.cs

        ItemSelectedCommand = new Command(async () =>
        {
            await navigationService.NavigateModelAsync(PageNames.CustomerEditPage, Customer, true, false);
        });

This works as expected

Picker Control from CustomerEditPage.xaml

        <Picker ItemsSource="{Binding Locations}" 
                ItemDisplayBinding="{Binding LocationName}"
                SelectedItem="{Binding CustLocation, Mode=TwoWay}"
                SelectedIndexChanged="Handle_SelectedIndexChanged"/>

*Note that the SelectedIndexChanged was only set so I can see when it was firing

CustomerEditPage.xaml.cs

    public CustomerEditPage(CustomerEntry customer)
    {
        var vm = new ViewModels.CustomerEditViewModel(App.NavigationService);
        BindingContext = vm;

        if (customer != null || customer.ID > 0)
        {
            vm.EditCustomer = customer;
            vm.SetEditCustomer();
        }

        InitializeComponent();
    }

    void Handle_SelectedIndexChanged(object sender, System.EventArgs e)
    {
        //Testing to see if we get to this break-point
    }

As you can see, I take in the CustomerEntry class object. I check if it is not null and has an ID > 0 and if so passes to the ViewModel to set the controls. Again, the Handle_SelectedIndexChange is only fired for testing purposes (using a breakpoint).

CustomerEditViewModel.cs

    private CustomerEntry editCustomer;
    public CustomerEntry EditCustomer
    {
        get { return editCustomer; }
        set
        {
            editCustomer = value;
            OnPropertyChanged("EditCustomer");
        }
    }

    private ObservableCollection<CustomerLocation> locations = new ObservableCollection<CustomerLocation>();
    public ObservableCollection<CustomerLocation> Locations
    {
        get { return locations; }
        set 
        {
            locations = value;
            OnPropertyChanged("Locations");
        }
    }

    private CustomerLocation custLocation;
    public CustomerLocation CustLocation
    {
        get { return custLocation; }
        set
        {
            custLocation = value;
            OnPropertyChanged("CustLocation");
        }
    }

    public CustomerEditViewModel(INavigationService navigationService)
    {
        SubmitCommand = new Command(async () =>
        {
            await OnSubmit();
            await navigationService.NavigateModelAsync(PageNames.CustomerPage, null, true, true);
        });

        CancelCommand = new Command(async () =>
        {
            await navigationService.GoBack();
        });

        LoadLocations();
    }

    public async Task LoadLocations()
    {
        List<CustomerLocation> loadLocations = await App.Database.GetLocationsAsync();
        Locations = new ObservableCollection<CustomerLocation>(loadLocations);
    }

    public void SetEditCustomer()
    {
        ID = EditCustomer.ID;
        CustomerName = EditCustomer.CustomerName;
        CustLocation = new CustomerLocation() 
        { 
            LocationName = EditCustomer.LocationName
        };
        Email = EditCustomer.Email;
        Notes = EditCustomer.Notes;
    }

The EditCustomer, Locations and CustLocation properties all fire. Properties for ID, CustomerName,Email and Note omitted for brevity.

Locations are loaded from a SQLiteAsyncConnection (database is located on device)

CustomerLocation.cs

public class CustomerLocation
{
    public string LocationName { get; set; }
}

As mentioned above, I put a mock ID column in this class (I didn't actually designate it as a key now that I think about it - I am not sure if that makes a difference).

CustomerEntry.cs

public class CustomerEntry
{
    [PrimaryKey, AutoIncrement]
    public int ID { get; set; }

    public string CustomerName { get; set; }
    public string LocationName { get; set; }
    public string Email { get; set; }
    public string Notes { get; set; }
    public DateTime TimeStamp { get; set; }
}

CustomerEntry class here for reference purposes.


What is the best back-end web development language?

$
0
0

What is the best back-end web development language?

Invalid Symbol

$
0
0

Hi there,

My Android project in Xamarin keeps failing to build due to below error

invalid symbol :"default" default.png res/drawable/default.png

not sure what is causing this to happen.

Any help will be greatly appreciated.

Thanks

Ravi

Xamarin Forms not Debugging and ZXing freezing all the application

$
0
0

Hey you guys,

I made an application to read some QR Codes using Zxing on Xamarin. Days before yesterday, it was working good, but since yesterday I have this problem:

I put a breakpoint in OnAppearing() method, but it's ignored, Ok... When I click in the Zxing button, to open the scanner, the application stops, but don't show nothing, only freeze, no errors, no messages, no debug, nothing. My code is the same as when it was working, nothing changed. If anybody could help me, I'll be grateful.

Thanks

How can I make a local storage storage file for mobile app

$
0
0

I'm building a Xamarin CrossPlatform app all of its database is in cloud api's, but I want a local storage file in mobile which stores all login credentials whenever someone is login.

Kindly help me through this!

Xamarin Forms Cross Platform using Polly

$
0
0

Hi Guys,

I'm getting the below error when i execute my policy.

"08-10 01:57:31.434 F/ ( 6684): /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/mono/mini/debugger-agent.c:4897: Could not execute the method because the containing type is not fully instantiated. assembly: type: member:(null) signature:"

Here is the sample code.

var responseMessage = await Policy
.Handle(ex =>
{
Debug.WriteLine($"{ex.GetType().Name + " : " + ex.Message}");
return true;
})
.WaitAndRetryAsync
(
5,
retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt))
)
.ExecuteAsync(async () => await httpClient.PostAsync(uri, content));

I'm using .net standard 2.0 and Polly 6.1.
I'm just a week in to mobile development so I probably just missing something here.

Any kind of help will be much appreciated. Thanks!

Firebase Messaging (FCM) OnMessageReceived Running Twice

$
0
0

Good day

I am using Firebase Messaging to send/Receive Push Notification on Android.

I've got the following implementation which is triggering OnMessageReceived twice on Android v 8.0, after rebooting the phone once, opening the app, rebooting the phone again and then sending myself a push notification.

Any ideas on what is causing this? I've looked online and found suggestions on removing any old GCM references which I have done already. The first time the app is built and deployed to the device, it doesn't happen and all subsequent push notifications seem fine. This just happens when the phone goes through the above mentioned reboot procedure. It may happen in other cases too but this has been my method to re-create the issue.

The App is compiled using

  • Xamarin.Forms 3.4.0.1008975
  • Xamarin.Firebase.Messaging 60.1142.1

If any further information is required, please ask me.

The code is as follows:

MainActivity.cs

using System.Threading.Tasks;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Gms.Common;
using Android.OS;
using Android.Views;
using Plugin.Permissions;
using Android.Util;
using Android.Gms.Common.Apis;
using Android.Gms.Drive;
using Android.Runtime;
using System;

namespace App.Droid
{
    [Activity(Label = "App", Icon = "@drawable/launch_icon", LaunchMode = LaunchMode.SingleTop, Theme = "@style/MyTheme", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]

    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity, GoogleApiClient.IConnectionCallbacks, GoogleApiClient.IOnConnectionFailedListener, IResultCallback
    {
        const string TAG = "MainActivity";
        const int REQUEST_CODE_RESOLUTION = 3;
        public static GoogleApiClient googleApiClient;
        public static byte CurrentGoogleDriveState = 0x00;

        internal static readonly string CHANNEL_ID = "default";
        internal static readonly int NOTIFICATION_ID = 100;

        protected override void OnCreate(Bundle bundle)
        {

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
                LoadApplication(new App("", ""));

            IsPlayServicesAvailable();
            CreateNotificationChannel();
        }

        void CreateNotificationChannel()
        {
            if (Build.VERSION.SdkInt < BuildVersionCodes.O)
            {
                // Notification channels are new in API 26 (and not a part of the
                // support library). There is no need to create a notification
                // channel on older versions of Android.
                return;
            }

            var channel = new NotificationChannel(CHANNEL_ID,
                                                  "FCM Notifications",
                                                  NotificationImportance.Default)
            {

                Description = "Firebase Cloud Messages appear in this channel"
            };

            var notificationManager = (NotificationManager)GetSystemService(Android.Content.Context.NotificationService);
            notificationManager.CreateNotificationChannel(channel);
        }

        public bool IsPlayServicesAvailable()
        {
            int resultCode = GoogleApiAvailability.Instance.IsGooglePlayServicesAvailable(this);
            if (resultCode != ConnectionResult.Success)
            {
                return false;
            }
            return true;
        }
    }
}

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="--Redacted--" android:versionCode="--Redacted--" android:versionName="--Redacted--">
    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="26" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.FLASHLIGHT" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-feature android:name="android.hardware.screen.landscape" />
    <uses-feature android:name="android.hardware.wifi" android:required="false" />
    <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
    <application android:label="--Redacted--" android:icon="@drawable/logo_cropped" android:allowBackup="true" android:largeHeap="true">
        <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
        <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                <category android:name="${applicationId}" />
            </intent-filter>
        </receiver>
        <meta-data android:name="android.max_aspect" android:value="2.1" />
    </application>
</manifest>

FirebaseRegistration.cs

using Android.App;
using Firebase.Iid;
using Android.Util;
using System;
using System.IO;
using Android.Content;

namespace App.Droid
{
    [Service]
    [IntentFilter(new[] { "com.google.firebase.INSTANCE_ID_EVENT" })]
    public class MyFirebaseIIDService : FirebaseInstanceIdService
    {
        const string TAG = "MyFirebaseIIDService";
        public override void OnTokenRefresh()
        {
            base.OnTokenRefresh();

            var refreshedToken = FirebaseInstanceId.Instance.Token;
            Log.Debug(TAG, "Refreshed token: " + refreshedToken);
            SendRegistrationToServer(refreshedToken);

        }

        /// <summary>
        /// Sends the token to server.
        /// </summary>
        /// <param name="token">Token.</param>
        void SendRegistrationToServer(string token)
        {
            // My code to send the push notification ID to our backend
        }
    }
}

FirebaseMessaging.cs

using System;
using System.Globalization;
using Android.App;
using Android.Content;
using System.Linq;
using Firebase.Messaging;
using System.Collections.Generic;
using System.Threading.Tasks;
using Android.OS;
using static Android.App.ActivityManager;
using Android.Support.V4.App;

namespace App.Droid
{
    [Service]
    [IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
    public class MyFirebaseMessagingService : FirebaseMessagingService
    {
        const string TAG = "MyFirebaseMsgService";

        async public override void OnMessageReceived(RemoteMessage message)
        {
            base.OnMessageReceived(message);

            Console.WriteLine("["+this.GetType().FullName+"]\t\t\t\t Push Notification Received! \n\n" + Newtonsoft.Json.JsonConvert.SerializeObject(message));
        }
    }
}

Validation for number and decimal point

$
0
0

Hi,

I want to validate only numbers and decimal point in Xamarin forms. In entry field i kept Keyboard="Numeric"
and in Validation class
public class ValidationBehavior : Behavior
{
//const string passwordRegex = @^[1-9]\d*(.\d+)?$;
protected override void OnAttachedTo(Entry bindable)
{
base.OnAttachedTo(bindable);
bindable.TextChanged += BindableOnTextChanged;
}

    protected override void OnDetachingFrom(Entry bindable)
    {
        base.OnDetachingFrom(bindable);
        bindable.TextChanged -= BindableOnTextChanged;
    }



    private void BindableOnTextChanged(object sender, TextChangedEventArgs e)
    {
        //var number = e.NewTextValue;
        //var numberPattern = "5";
        //var entry = sender as Entry;
        //if (numberPattern.Contains(number))
        //{
        //    entry.TextColor = Color.Red;
        //}
        //else if (number == null)
        //{
        //    entry.BackgroundColor = Color.Red;
        //}

        if (!string.IsNullOrWhiteSpace(e.NewTextValue))
        {
            bool isValid = e.NewTextValue.ToCharArray().All(x => char.IsDigit(x));


                ((Entry)sender).Text = isValid ? e.NewTextValue : e.NewTextValue.Remove(e.NewTextValue.Length - 1);
                //((Entry)sender).TextColor = isValid ? Color.Default : Color.Red;


        }



    }

If i use this I cant access decimal.Please help me with this


Android Emulator taking good amount of time to launch the application

$
0
0

Installing the Mono shared runtime (debug - 1545409236)...

is taking good amount of time to restart android emulator.
On the screen of emulator it shows "Android Restarting".

Am I missing any settings ?

Thanks,
Manjushree

How to Work With Xam.Plugin.PushNotification

$
0
0

Severity Code Description Project File Line Suppression State
Warning NU1701 Package 'Newtonsoft.Json 8.0.3' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. test C:\Users\ssc\source\repos\test\test\test\test.csproj 1

Why would OnPause and OnResume get called while the app is still the currently active app?

$
0
0

I'm running into an oddity where the OnPause and OnResume methods are being called after the app has been sitting, unused, for about 55-60 seconds or so. The screen isn't locking and the app isn't being backgrounded. It calls the OnPause method followed immediately by a OnResume call. Now this is a problem for the application because it's not uncommon to leave the app running on the phone. Much of the functionality limits what a user is able to do until the GPS has been able to accurately assess their location and detect that they are within a certain range of a pre-determined location. For some phones this can take a while, especially if they don't have a particularly good signal. When OnResume gets executed, it performs a couple of tasks to check some things and a loading screen is displayed. What ends up happening now is the loading screen is presented to the user after 20 seconds or so not doing anything. Depending on the connection, it can take a minute for everything to be analyzed and the loading screen to go away. I won't go into detail but this delay can present some problems for the user.

It's worth noting that we recently updated the SDK and are in the process of updating the APP to work with the latest tools. I don't recall anything like this occurring before the update. Is this normal behavior for Android?

ZXing.Net into standard .net 2.0 library and Xamarin application

$
0
0

Hi,
I'm new to Xamarin and this whole .NET, I,m starting a new project and I was creating .NET library 2.0 to put the commun code. I have a need to extract multiple barcode from an image and was using ZXing as demo on Window with full .NET Framework 4.7. Now I would like to port this to Xamarin and I'm having some trouble to integrate it into my library. Here's my project structure:

  • GF-Trace.Android (Xamarin Android)

    • Reference to:
      • GF-Trace
      • NuGet packages:
      • Xamarin.Forms
      • ZXing.Net
        * Android.*
  • GF-Trace (.Net Standard 2.0 lib)

    • Build Dependencies:

      • GF-Imaging
    • NuGet packages:

      • Xamarin.Forms
      • ZXing.Net
  • GF-Imaging (.Net Standard 2.0 lib)

    • NuGet packages:
      • Xamarin.Forms
      • ZXing.Net

I have some hard time to make it work properly. The compiler complain about missing reference.

Severity    Code    Description Project File    Line    Suppression State
Error       Can not resolve reference: `zxing`, referenced by `GF-Trace`. Please add a NuGet package or assembly reference for `zxing`, or remove the reference to `GF-Trace`.  GF-Trace.Android        

Under UWP, it does compile but when running I get a method missing exception error:

System.MissingMethodException
  Message=Method not found: 'ZXing.Result[] ZXing.BarcodeReader.DecodeMultiple(Byte[])'.
  Source=GF-Trace
  StackTrace:
   at GF_Trace.Views.XyMeasurementPage.ExtractQRCodeMessageFromImage(Byte[] bitmap) in ...\GF-Trace\GF-Trace\Views\Debug\XyMeasurementPage.xaml.cs:line 128
...

So I wonder how I should be doing this? GF-Imaging is a reusable lib that implement function to manipulate images and could do some processing to recover barcode with ZXing. GF-Trace is the common application library that also can use some ZXing types. GF-Trace.Android or GF-Trace.UWP consume the GF-Trace.

The ZXing.Net said it support .Net Standard 2.0 and Xamarin.Android. What is wrong or how does one ensure the function and lib are present for a given platform?

NOTE I did select ZXing.Net and not the mobile version because the image can come from different source and not only from the camera as stand still image. So I tried to avoid the ZXing.Net.Mobile which wrap all into a Form GUI.

Thanks, Maybe I'm doing something wrong into my setup, but I have no clue why it doesn't found the lib or the methods.

Master-Detail Page as a Navigation drawer?

$
0
0

I need a side navigation drawer in the application, the functionality provided by the Master-Detail Page is not compatible with my needs,
I need to have the drawer in the MainPage only and to behave like a NavigationPage: when any item in the master page is clicked, then replacing the hamburger button with a back button that navigate to the previous page.. is it possible with the Xamarin's Master-Detail page?

What I've tried so far:

  • setting
    MainPage = new NavigationPage(new MainPage()); //where MainPage is a MasterDetailPage

then set the NavigationPage.HasNavigationBar of the main page to False.

but I have two initial problems:
1- the title is beneath the back button.
2- when I navigate back, the menu is still opened.

There might be another problems of this workaround, that I'm not aware of at the moment

How to set up the input method correctly für the phone input panel?

$
0
0

Hi there,

I am having problems with the "phone" input type. If i choose this the input panel looks right for my purpose, but I could not enter any characters. So they are inactive and I could only use the numbers. As for the user should only input a few characters and way more numbers, I thought the "phone" input type is the right one.

The system I am using runs under Android 4.4.

May this be the problem?

Thank you in advance

Xamarinion

WebView error TLS 1.2 - Help

$
0
0

I have an application with WebView, on Android it works perfectly but in IOS I'm getting a TLS 1.2 error.

2019-01-25 22:30:17.686174-0200 CIPLAN.iOS[3765:60722] SecTaskLoadEntitlements failed error=22 cs_flags=200, pid=3765
2019-01-25 22:30:17.686458-0200 CIPLAN.iOS[3765:60722] SecTaskCopyDebugDescription: CIPLAN.iOS[3765]/0#-1 LF=0
2019-01-25 22:30:17.742595-0200 CIPLAN.iOS[3765:60758] SecTaskLoadEntitlements failed error=22 cs_flags=200, pid=3765
2019-01-25 22:30:17.742875-0200 CIPLAN.iOS[3765:60758] SecTaskCopyDebugDescription: CIPLAN.iOS[3765]/0#-1 LF=0
2019-01-25 22:30:17.872320-0200 CIPLAN.iOS[3765:60758] [BoringSSL] boringssl_context_alert_callback_handler(3718) [C1.1:2][0x7fdf72e23390] Alert level: fatal, description: protocol version
2019-01-25 22:30:17.872801-0200 CIPLAN.iOS[3765:60758] [BoringSSL] boringssl_context_error_print(3670) boringssl ctx 0x600001402560: 140597682873608:error:100000f0:SSL routines:OPENSSL_internal:UNSUPPORTED_PROTOCOL:/BuildRoot/Library/Caches/com.apple.xbs/Sources/boringssl_Sim/boringssl-109.220.4/ssl/handshake_client.cc:557:
2019-01-25 22:30:17.873197-0200 CIPLAN.iOS[3765:60758] [BoringSSL] boringssl_context_get_error_code(3575) [C1.1:2][0x7fdf72e23390] SSL_AD_PROTOCOL_VERSION
2019-01-25 22:30:17.894320-0200 CIPLAN.iOS[3765:60758] TIC TCP Conn Failed [1:0x600002333d80]: 3:-9836 Err(-9836)
2019-01-25 22:30:17.897862-0200 CIPLAN.iOS[3765:60758] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9836)
2019-01-25 22:30:17.898090-0200 CIPLAN.iOS[3765:60758] Task <1A29C422-B713-4E6D-8F4A-A956D9D240E2>.<0> HTTP load failed (error code: -1200 [3:-9836])
2019-01-25 22:30:17.898278-0200 CIPLAN.iOS[3765:60757] NSURLConnection finished with error - code -1200


Xamarin.Android CI Builds on VSO

$
0
0

Anyone has success stories to share? I have my Xamarin.Android in VSO and I am trying to setup a build definition.

First I was getting this error
The specified solution configuration "Debug|BWS" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration.

I resolved it and now I am getting this
The target "PackageForAndroid" does not exist in the project.

What am I missing? I am able to build the same SLN locally just fine.

Thanks in advance,
Pranav

ChangeCanExecute is not working, why?

$
0
0

Hello there!

I have some commands on my ViewModels, and I realized that I can them multiple times at the same time, and is getting me some troubles with updating data from a WebApi.

The basic structure I have is something like:

        private Command _LoadCommand;
        public Command LoadCommand
        {
            get { return _LoadCommand ?? (_LoadCommand = new Command(async() => await ExecuteLoad())); }
        }

        private async Task ExecuteLoad ()
        {
                IsBusy = true;
                SendSignatureToSAP.ChangeCanExecute();

                await DoSomething();

                SendSignatureToSAP.ChangeCanExecute();
                IsBusy = false;
        }

I read about ChangeCanExecute and some documentation about Commands. It doesn't reccoment to call CanExecute(false) because it doesn't trigger an event or something like that. Also, I read that since a not-so-recent version of XF, it can have the value "null" and ChangeCanExecute only puts it into null again, but I don't know if this is true or if it makes sense.

So, what should I do to know if it's doing it right or not?
It's also allowing pages to trigger OnSizeAllocated when I'm in a child page, atop of it.

Thank you!

UWP Project throws error after random amount of time

$
0
0

Hi folks

Since the very beginning of Xamarin.Forms every now and then I had this weird issue where the UWP Project, after weeks or months without changes but relatively frequent builds and rebuilds, would just throw an error on build and no amount of rebuild, restarting of VS or deleting of bin and obj folders or even restarting the machine would solve it.

Right now, as last time it broke, it throws this error:
x:Class type 'YourApp.UWP.MaintPage' is not found in 'YourApp'

Every time this happened I started a new project, copied everything over from the old one, made sure that it was working, and then moved the whole folder back, overwriting everything in the process. Looking at Git, nothing's changed, but it works again.

Is there something like clearing a cache that I can do instead? It's quite the pain (and timeconsuming of course) to do this every time.

How to fix a nuget package installation error

$
0
0

Hello everyone

My problem is about installing nuget Xamarin.Essentials package for Android.
To isolate the error I started a new empty Xamarin project that I called "test".
I am installing this package directly from Visual Studio and I have the error:

**All packages are compatible with MonoAndroid, Version = v8.1.
Package restore failed. Rolling back package changes for 'test.Android'.
**
I did not find a solution to my problem on the internet.
Can someone help me and tell me where this error comes from and how to solve it.

Thank you for your answers
YC

Mandatory app privileges

$
0
0

Hi, I'd like to double check something, please correct me if I'm wrong:
Using a NuGet package that has code that use camera (in my case ZXing.NET.Mobile that is able to scan barcodes), my assumption is that I do have to set the CAMERA privileges even if don't use these functionalities (i.e. if in my Xamarin Forms app I do not scan barcodes but only show them on screen), because when publishing to stores (in my case Google Play and Apple Store) the code is detected and the privilege required.

So here's my question: Is it mandatory to add the CAMERA privilege because of the code in the plugin even if in my app I do not use that functionality?

Viewing all 204402 articles
Browse latest View live


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