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

[Xamarin.Forms .Net/ MVVM(PRISM) project] Which Web Service to use and how to add it ?

$
0
0

Hi everyone, im new on Xamarin and im an internship to develop a Mobile App: kind of micro-social for events with Xamarin.Forms .Net/ MVVM(PRISM) architecture. For the moment i have almost all the view except the chatView and i test my app with local data (exemple: showing list of events) and its work well!

Now i need to use/add a web service to get my data and im totally lost.

I precise that i did a lot of research before to ask help and this why i ask your help
Sorry i can't post any link because i'm just new

One of my co-worker did a asmx web service, i try to add it without sucess. I understand that i need to implement it on every OS and use interface and in my opinion its seems quite long to implement. I try to use the exemple of fabiosilvalima but i have an error at this line:

return new List<ICustomer>(result);
impossible to convert string to int

On this forum i see that asmx is not the best solution.

I watch for REST but i want to heard some advice from the Xamarin community.

So my question is: Which kind of web service i need to use for my project (Xamarin.Forms .Net / MVVM(PRISM)) ?
How to add/use to my project ?

Thanks for your help!

I already read the microsoft.doc article about webservice with child post so please dont send it


Icons in Navigation Toolbar with PageTitle

$
0
0

I read the article of @JamesMontemagno - "Xamarin.Forms - Icons in Navigation Toolbar" and im asking myself if it is possible to have that application-wide image in the NavigationBar in combination with the PageTitle. Because adding an ImageView to the Toolbar.axml like this will hide the PageTitle.

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    android:popupTheme="@style/ThemeOverlay.AppCompat.Light">
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:scaleType="fitCenter"
        android:src="@drawable/xamarin_logo"
        android:layout_gravity="center" />
</android.support.v7.widget.Toolbar>

Does anyone successfully tried having an application-wide Image in combination with the PageTitle?

InitializeComponent does not exist in the current context error

$
0
0

Hi,

The error CS0103 (The name 'InitializeComponent' does not exist in the current context) has started appearing after doing a build of our Xamarin Forms solution. The build, however, appears to have succeeded in spite of this error message?

This started happening after adding the first XAML ContentPage to the PCL project. If I remove the XAML ContentPage then the error disappears.

I've tried installing the latest Alpha channel update on both my Windows (Visual Studio) machine and my Mac build host but it hasn't made any difference.

Please advise ASAP as we would like to use XAML for our ContentPages but may have to revert to using C# code to build the UI if the XAML approach is not viable.

Regards,
Andy

Errors in changing FormsApplicationActivity to FormsAppCompatActivity.

$
0
0

When changing MainAcivity to FormsAppCompatActivity, TabLayoutResource&ToolbarResource should be added. But Layout folder is not avaible under resources.

The "LinkAssemblies" task failed unexpectedly.

$
0
0

I´m trying to reduce the APK size to publish in Play Store.
I´m using VS 2017 and "Linking" in the Android Options

I tried with Sdk and User Assemblies and Sdk Assemblies Only either are not working.

I got the next error:

The "LinkAssemblies" task failed unexpectedly.
Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'System.Diagnostics.CounterCreationData' (defined in assembly 'System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089') with scope 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Diagnostics.CounterCreationData
at Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkField(FieldReference reference)
at Mono.Linker.Steps.MarkStep.InitializeFields(TypeDefinition type)
at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type)
at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type)
at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.MarkStep.Initialize()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
--- End of inner exception stack trace ---
at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() CloudParkingApp.Android

Android IOnMapReadyCallback Forms 2.3.4

$
0
0

My custom renderer is no longer work with Xamarin Forms 2.3.4. The behavior I am seeing is that none of pins are being drawn on the map if I provide a method for the IOnMapReadyCallback method.

It appears as though the interface is explicitly implemented in the standard renderer (recently introduced). I need to be able to get a reference to the NativeMap once the IOnMapReadyCallback method has been invoked. Is there a way I can get a reference to the NativeMap via some event? Do I wait on the property changed for the SetType() call?

Firebase Authentication Support in Xamarin forms

$
0
0

Is there any support of Firebase authentication for Xamarin Forms? Please help

Setting column span for button variable

$
0
0

I have created a grid in my Xamarin application which has 4 rows and 24 columns.

I have 12 buttons that use the same properties, so to save myself creating all 12 separately, I have done it like this

var functionButton = new Style(typeof(Button))
     {
        Setters = {
                new Setter { Property = BackgroundColorProperty, Value = Color.FromHex ("#F0E68C") },
                new Setter { Property = Button.TextColorProperty, Value = Color.Black },
                new Setter { Property = Button.CornerRadiusProperty, Value = 0 },
                new Setter { Property = Button.FontSizeProperty, Value = 10 }
        }
      };

then add them to the grid as below

controlGrid.Children.Add(new Button { Text = "End" + Environment.NewLine + "Sale", Style = functionButton }, 0, 0);
controlGrid.Children.Add(new Button { Text = "Repeat" + Environment.NewLine + "  Last", Style = functionButton }, 1, 0);
controlGrid.Children.Add(new Button { Text = "Void" + Environment.NewLine + "Line", Style = functionButton }, 2, 0);
and so on, until all 12 have been added.

However, I want each button to take up 2 columns.

Usually, if I'd created the buttons separately I could use Grid.SetColumnSpan(Button1, 2);

But that doesn't seem very efficient, as I'd need to create all 12 buttons separately. Is there another way that I can set the column span using this method of creating the buttons that I've currently got?


Using Slider with audio

$
0
0

I need an example to change the position of the audio, but using the slider control?

Firebase Cloud Messaging

$
0
0

Hello,

How to generate FCM topic in xamarin forms app and how can use it.

I am generating FCM topic from two way
```
1) FirebaseMessaging.Instance.SubscribeToTopic("news"); in MainActivity

2) CrossFirebasePushNotification.Current.Subscribe("Managers");

```

Which method correct or not.

OnAppearing() not working anymore

$
0
0

I don't know what else to mention besides this but OnAppearing isn't firing anymore. I am using TabbedPage but I was using TabbedPage before when OnAppearing was working as well.

Anyways here is what I am trying to achieve and maybe there may be another way to implement it.

The master page is a tabbed page containing Page C. Now Page C is an empty carousel page in which its OnAppearing() populates it like so:
Children.Add(new PersonPage()) //run 10 times so Page C is now a carousel page with 10 pages

So now what I am trying to do is when the user is on the 8th page (the 8th PersonPage) in the carousel page, add more pages to the carousel page so that the user does not reach the end of the carousel page. An infinite scrollable carousel page.

I basically added a flag to the 8th page and in the PersonPage() onAppearing(), checked whether the flag is set and then called:
parent.Children.Add(new PersonPage())

This was working but it isn't anymore. It seems to be because the PersonPage() OnAppearing() isn't firing anymore. I tested this by calling a DisplayAlert() which didn't show up.

Has anyone done anything similar?

Required CCAvenue payment Integration for Xamarin form

$
0
0

I have create xamarin application and need for ccavenue payamnt integration for xamarin forms. Please help me for any idea related to payment gateway integration

Why xamarin website is not loading

$
0
0

xamarin website is not loading any reason
developer.xamarin. dotcom/samples-all/

Best practices to download large files in Xamarin.forms app

$
0
0

I have a requirement to download large files (2-3gb's) in my app. Anyone please suggest the best practice to implement.

Plugin.InAppBilling.Abstractions.InAppBillingPurchaseException: Cannot connect to iTunes Store

$
0
0

Getting this error while login with sandbox tester. Can anyone please help me out of this..


AndroidRuntimeException with ZXing.Net.Mobile

$
0
0

I have an app for barcode scanning. It scans successfully for a long time. It scans 100 times with success, then suddenly it crashes.

The exception is AndroidRuntimeException: Only the original thread that created a view hierarchy can touch its views.

Then I don't understand much of the exception. Link to full exception: https://hastebin.com/owerixihag.log

I have made sure to use Device.BeginInvokeOnMainThread() for UI operations.

ScannerPage.xaml

<zxing:ZXingScannerView x:Name="ScannerView"
    Result="{Binding ScanResult, Mode=OneWayToSource}"
    ScanResultCommand="{Binding ScanResultCommand}"
    IsScanning="{Binding IsScanning}"
    IsAnalyzing="{Binding IsAnalyzing}" />
<zxing:ZXingDefaultOverlay x:Name="ScannerOverlay"
    BottomText="Scanning will happen automatically"
    ShowFlashButton="False"/>

ScannerPageViewModel.cs (stripped of irrelevant parts)

[PropertyChanged.AddINotifyPropertyChangedInterface]
internal class ScannerPageViewModel : INavigatedAware
{
    public ScannerPageViewModel(IScannerService scannerService, IUserDialogs dialogs, IPopupNavigation popups, IScreenService screen)
    {
        ScanResultCommand = new Command(ProcessBarcode);
    }

    public ICommand ScanResultCommand { get; }

    /// <summary>
    /// Show info dialog box with ticket info.
    /// </summary>
    private async Task ShowInfoScanResult(string message)
    {
        var popup = new PopupViews.InfoScanResult(Popups, message);
        popup.Disappearing += (se, ev) => IsAnalyzing = true;
        await Popups.PushAsync(popup);
    }

    private void ProcessBarcode()
    {
        Device.BeginInvokeOnMainThread(async () =>
        {
            if (ScanResult != null && !string.IsNullOrEmpty(ScanResult.Text))
            {
                // Disable the scanner after one barcode is found.
                IsAnalyzing = false;

                var source = new CancellationTokenSource();

                // Show loading animation if scanning takes >1 second.
                var t = Task.Run(async () =>
                {
                    await Task.Delay(1000, source.Token);
                    Device.BeginInvokeOnMainThread(ShowLoading);
                });

                // Call the web service to process the barcode.
                var scanResponse = await ScannerService.ScanBarcode(ScanResult.Text, ScanningSession, SelectedScanAction);

                if (scanResponse.IsSuccessful)
                {
                    var scanResult = scanResponse.Data;
                    if (scanResult.Success)
                    {
                        var json = scanResult.BarcodeInfo;
                        var message = ParseJsonBarcodeInfo(json);

                        if (SelectedScanAction == ScanAction.Information)
                            await ShowInfoScanResult(message);
                        else
                            await ShowOkScanResult(message);
                    }
                    else
                    {
                        await ShowErrorScanResult(scanResult.FaultDescription);
                    }
                }
                else
                {
                    ShowScanRequestError(scanResponse.ErrorMessage);
                }

                source.Cancel(); // Cancel loading animation timer.
                HideLoading();
                Screen.SetFullscreen();
                source.Dispose();
            }
        });
    }

Disable device back button

$
0
0

Hi all.

Any one know how to disable device back button in xamarin forms app?

Thanks
Lasantha

Is possible to avoid slow startup time of xf app on Android in this way?

$
0
0

I made a big xamarin form app for ios and android, all is working great, but on Android app take till 8 seconds to starts.
I already try to use XAML Compilation and AOT...the AOT gain 2seconds, but it double the size of my apk, so is not a solution for my needs.

My question:
If I try to:
- rewrote only the first page in xamarin android
- start the app in native way
- while first view is shown, init the xamarin form engine (using callback, timers or in other async way) and after the init use only xf page
the startup time for my xamarin android app should be better?

Thanks for answer
Matteo

how to disable or remove copy and back icon from the Xamarin forms picker

$
0
0

I have a picker with 3 options , when it slides up, it comes with previous , next and copy icon, when clicked on copy icon, previous and next button gets activated and on click of those, app crashes

how to solve dis???
please give inputs

thanks in advance

Persistent warnings

$
0
0

What is the cause of these warnings?

I'm having these error because I trying to do this https://github.com/HoussemDellai/BottomBar-Xamarin-Forms, the most annoying part is it's persistence. I can't deploy my application because of these warnings.
I already clean and rebuild the solution, already update the package, already restart my IDE.

Can anyone explain this to me?
Thanks in advance :)

Viewing all 77050 articles
Browse latest View live


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