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

Setting the resource file I want to use (not using localization)

$
0
0

Hello there!

I read about you can use .resx resource files automatically according the Localization of the App, so if you have MyData.en.resx and MyData.es.resx, it will use one or another according if the device language is set as englis or spanish.

I wonder if I can use something like that, in order to set if my WebApi must use one or another SQL scripts, for example, SQL Server or Oracle SQL sentences, according to some preprocessor directive, global variable or programm parameter.
As far as I look for information, all the data I get is for using them with Localization.

Thank you!


The Master detail icon doesn't respond to the FlowDirection.RightToLeft unless put in NavigationPage

$
0
0

The hamburger button of the master detail page is always on the left even I set the FlowDirection to RightToLeft , this happens when the MainPage is set this way in App.xaml.cs:

MainPage = new MasterDetailPage();

The menu itself is on the right:

But I noticed that it works properly when I put it in NavigationPage:

MainPage = new NavigationPage( new MasterDetailPage());

but I have to set the NavigationPage.HasNavigationBar to False, to look normal.
Is there a solution to this problem other than the workaround ?

How to build view same as Android Linear Layout

$
0
0

I want to create list Content like below picture :

under each icon I have text.
when I have more than two item go to next row like as picture.
but all data comes from database(dynamic) , how to build this list in xamarin form?

Background service - Get GPS Location every x minutes?

$
0
0

Hi all,

I'm developing an app using Xamarin (duh), and I need a background service that gets the user's GPS location at recurring intervals (say, every 15 minutes).

This project (https://github.com/xamarin/mobile-samples/tree/master/BackgroundLocationDemo) is the closest I can find to example code, and it claims that the location continues to update, even with the app in the background. Out of the box, this doesn't seem to be the case.

Could anyone offer insight (or even better, example code/projects) to point me in the right direction?

Thanks in advance.

iOS code signing key not found in keychain

$
0
0

After having successfully built, tested and published a Xamarin Forms app both for Android and iOS I'm suddenly no longer able to build the iOS version. I'm getting the "iOS code signing key not found in keychain" error.

How can I fix this problem? I don't even know where to start.

Opening a PDF in Default Application

$
0
0

I have followed all the directions for opening a pdf from downloads but I always get an error that it cannot access the file. I have read storage on, how do I start an intent to open the default file handler for a variety of files without some security issue?

Picker pops up twice

$
0
0

I have a simple picker inside a list view and on my devices when I use my finger to scroll or tap it pops up twice

I have verified this on multiple devices and I know it is not my code - it's just a picker

best

JK

Unable to resume video once video got paused using xamarin madia manager plugin.

$
0
0

I am able to play video successfully using following:
player.Source = item.VideoUrls.First().Url;
await CrossMediaManager.Current.VideoPlayer.Play();

Then I paused the video using following code:
CrossMediaManager.Current.Pause();

But once video gets paused, I m trying to resume video using following code:
await CrossMediaManager.Current.VideoPlayer.Play();

But video is not getting resumed/played.

Please help.
Thanks in advance.


How can we apply MVVM pattern in xamarin.android step by step

$
0
0

How can we apply MVVM pattern in xamarin.android step by step

Getting a empty list inside a button click Xamarin.Forms

$
0
0

I am new to Xamarin and MVVM. In my application I have Tabbed page and I have two child views inside. I am making a network call and getting data from databse in my first child's view model. Data is coming. I wanted to pass some data to my second child(List). I was able to pass data correctly. Inside my second child, I have a button and calling a new Page.

First child's ViewModel...

public async Task getFypDataAsync(string accessToken)
{

    fypFullList = await _apiServices.GetFypData(accessToken);

    fypFullList.Sort((x, y) => x.rank.CompareTo(y.rank));


    fypSendList.AddRange(new List<FypRankData>(fypFullList.GetRange(0, 320)));

    new HomeTab2(fypSendList); // send data to second child

}

List's data is available inside my second child's constructor (code behind).

Second child's code behind....

public partial class HomeTab2 : ContentPage
    {

        bool _istapped = false;
        public List<FypRankData> mylist = new List<FypRankData>();

        public HomeTab2()
        {

            InitializeComponent();

            BindingContext = new HomeTabVM2();

            var vm = BindingContext as HomeTabVM2;
            vm.setFypData();

        }

        public HomeTab2(List<FypRankData> fypSendList)
        {

            mylist = fypSendList;
            Debug.WriteLine(fypSendList.Count.ToString(), " list_yyycount ");

        }

    private async void Btn1_Clicked(object sender, EventArgs e)
    {
        if (_istapped)
            return;

        _istapped = true;

        await Navigation.PushAsync(new ChartPage(mylist));

        _istapped = false;
    }

}

Problem is inside the button click mylist is getting empty. But inside the constructor, value is assigning.

Error using ExportAttribute with array parameter

$
0
0

When I'm using ExportAttribute on a managed method with array parameter like this:

    [Export]
    public static int A(int[] b) { ... }

I'll get:

    NotSupportedException: Only primitive types and IJavaObject is supported in array type in callback method parameter or return value

But "int" is a primitive type.

I've found this link on GitHub: github.com/xamarin/xamarin-android/issues/1259
But the problem isn't solved.

Mismatch between the processor architecture

$
0
0

Hi.
I am using Xamarin.Forms on Visual Studio 2017. I am trying to use a dll that is compiled on 64bit. When i run the app on android emulator, it has a warning of "mismatch between the processor architecture" and the app crashed on the emulator. If i disable the initialization of the said dll, app runs fine.

Is it possible to use external dll's or api's on xamarin and if yes, how can we use those properly on xamarin.

Thanks...

Is it possible to call an asynchronous method from a synchronous method?

$
0
0

Hello everyone,

I'm having a Xamarin.forms application and what I'm trying to do is:
1) someone clicks on an item in a listview
2) the application shows a dialog to the user
3) the application waits until the user has pressed "yes" or "no"
4) as soon as there's input from the user, the application (code) continues again

I know that normally it's possible to make your method async and then apply an await on the DisplayAlert. However, because the code is so enormous, it has a lot of effect on the rest of my code.. So I wondered if it's possible to call an asynchronous method from a synchronous method?

To show the dialog, I use the following code:

private async Task<bool> ShowDialog()
{
return await DisplayAlert("Question?", "Waiting for user input", "Yes", "No");
}

And to await the message box I use the following the code:

public void SyncMethod()
{
// Showing the listview here
// The user clicks an item
bool result = await ShowDialogAsync();

// after the user has clicked something,
// then continue with more code here.
if (result)
// Result = true
}

Unfortunately the SyncMethod needs to be async. Is there a way to solve this without making this method async? Thanks for the answer :)

WatchOS 5.1 TCP Outgoing connection problem

$
0
0

Hello.

My Watch App call web service on https protocol in Internet.
I have always nw_resolver_create_dns_service_locked error:

WatchKit Extension[326:81502] dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
WatchKit Extension[326:81502] dnssd_clientstub ConnectToServer: connect()-> No of tries: 2
WatchKit Extension[326:81502] dnssd_clientstub ConnectToServer: connect()-> No of tries: 3
WatchKit Extension[326:81502] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:8 Err:-1 Errno:1 Operation not permitted
WatchKit Extension[326:81502] [] nw_resolver_create_dns_service_locked DNSServiceCreateDelegateConnection failed: ServiceNotRunning(-65563)
WatchKit Extension[326:81502] TIC TCP Conn Failed [1:0x1669aaa0]: 10:-72000 Err(-65563)
WatchKit Extension[326:81492] Task . HTTP load failed (error code: -1009 [10:-72000])
WatchKit Extension[326:81492] NSURLConnection finished with error - code -1009

I added to file
com.apple.security.network.client

but I have new error
ApplicationVerificationFailed: Failed to verify code signature of /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.OPGbCB/extracted/Payload/isafereader.app : 0xe8008016 (The executable was signed with invalid entitlements.)
error MT1006: Could not install the application '/Users/dev/Projects/qaz/qaz/bin/iPhone/Release/qaz.app' on the device 'iPhone (Daniel)': Your code signing/provisioning profiles are not correctly configured. Probably you have an entitlement not supported by your current provisioning profile, or your device is not part of the current provisioning profile. Please check the iOS Device Log for details (error: 0xe8008016).

I checked provisioning options on developer.apple.com.
I have all permissions checked.

What am I doing wrong?

How to fix "open failed: errno 13" exception

$
0
0

I am developing a camera app using CrossMedia.Plugin , when I take a photo from camera or from my phone gallery ,the crashes and the out put window shows open failed: errno 13 exception.How to fix it...

Please help me


[XAMARIN FORMS] problem of the link between my xaml view (with a picker) and the viewmodel

$
0
0

Hello everyone,

I have a small problem, I explain myself:

here's what I did, I have a page with buttons (with different values) and a picker (see xaml code), when the user clicks on a button, normally the picker selection list proposes things that are linked to the value of my button through lists (see my view model code). Except it doesn't work!

In my opinion it is because of the static type that is on some of my lists and methods. So my picker which has a binding on one of my lists does not display my selection because it cannot access my list because it is in static and not a constructor (in which I call the element of my binding).

Do you have a solution for me?

If you can't understand me, don't hesitate to ask me questions?

you will find the different files with my code below.

Sincerely
Camille

xaml code :

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="PolQual.Views.StatementReferencielPage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:PolQual.Views"
    xmlns:viewModels="clr-namespace:PolQual.ViewModels;assembly=PolQual"
    Title="Accueil">

    <ContentPage.BindingContext>
        <viewModels:StatementReferencielPageModel />
    </ContentPage.BindingContext>

    <ContentPage.Content>

        <StackLayout>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="10*" />
                    <RowDefinition Height="15*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="100*" />
                </Grid.ColumnDefinitions>

                <Label
                    Grid.Row="0"
                    Grid.Column="0"
                    FontSize="25"
                    HorizontalOptions="Center"
                    Text="Information sur le relevé référenciel" />

            </Grid>

            <ScrollView>
                <Grid x:Name="gridLayout" />
            </ScrollView>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="2*" />
                    <RowDefinition Height="3*" />
                    <RowDefinition Height="8*" />
                    <RowDefinition Height="2*" />
                    <RowDefinition Height="3*" />
                    <RowDefinition Height="6*" />
                    <RowDefinition Height="3*" />
                    <RowDefinition Height="6*" />
                    <RowDefinition Height="3*" />
                    <RowDefinition Height="6*" />
                    <RowDefinition Height="5*" />
                    <RowDefinition Height="6*" />
                    <RowDefinition Height="1*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="25*" />
                    <ColumnDefinition Width="50*" />
                    <ColumnDefinition Width="25*" />
                </Grid.ColumnDefinitions>

                <Label
                    Grid.Row="1"
                    Grid.Column="1"
                    FontSize="15"
                    Text="Veuillez sélectioner le secteur :" />

                <Picker
                    x:Name="PickerSectorsLists"
                    Title="Sélectionner votre secteur"
                    Grid.Row="2"
                    Grid.Column="1"
                    ItemDisplayBinding="{Binding Value}"
                    ItemsSource="{Binding SectorsFindLists}"
                    SelectedItem="{Binding SelectedSector}" />

                <Label
                    Grid.Row="4"
                    Grid.Column="1"
                    FontSize="15"
                    Text="{Binding ShowHouseholdTrash}" />

                <Switch
                    x:Name="SwitchHousehodTrash"
                    Grid.Row="5"
                    Grid.Column="1"
                    HorizontalOptions="Start"
                    IsToggled="{Binding HouseholdTrash}" />

                <Label
                    Grid.Row="6"
                    Grid.Column="1"
                    FontSize="15"
                    Text="{Binding ShowBoxboard}" />

                <Switch
                    x:Name="SwitchBoxboard"
                    Grid.Row="7"
                    Grid.Column="1"
                    HorizontalOptions="Start"
                    IsToggled="{Binding Boxboard}" />

                <Label
                    Grid.Row="8"
                    Grid.Column="1"
                    FontSize="15"
                    Text="{Binding ShowGlass}" />

                <Switch
                    x:Name="SwitchGlass"
                    Grid.Row="9"
                    Grid.Column="1"
                    HorizontalOptions="Start"
                    IsToggled="{Binding Glass}" />

                <Button
                    Grid.Row="11"
                    Grid.Column="1"
                    BackgroundColor="#2196f3"
                    Clicked="GoToAssesmentGrid"
                    FontSize="20"
                    Text="Valider les informations"
                    TextColor="White" />

            </Grid>

        </StackLayout>

    </ContentPage.Content>
</ContentPage>

Behind code :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using PolQual.ViewModels;

namespace PolQual.Views
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class StatementReferencielPage : ContentPage
    {
        public StatementReferencielPage()
        {
            InitializeComponent ();
            BindingContext = new StatementReferencielPageModel();
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) });
            //collmun
            gridLayout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(25, GridUnitType.Star) });
            gridLayout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(50, GridUnitType.Star) });
            gridLayout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(25, GridUnitType.Star) });

            var PolesListsIndex = 0;

            for (int columnIndex = 1; columnIndex < 2; columnIndex++)
            {
                for (int rowIndex = 0; rowIndex < 7; rowIndex++)
                {
                    if (PolesListsIndex >= StatementReferencielPageModel.PolesLists.Count<Pole>())
                    {
                        return;
                    }
                    var poles = StatementReferencielPageModel.PolesLists[PolesListsIndex];
                    PolesListsIndex += 1;

                    var button = new Button()
                    {                   
                        Text = poles.Name,
                        BackgroundColor = Color.FromHex(poles.Color),
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions = LayoutOptions.Center,
                        WidthRequest = 280,
                    };
                    string request = StatementReferencielPageModel.PolesLists[rowIndex].Name;
                    button.Clicked += delegate { MaFunction(request); };// anonymous method
                    gridLayout.Children.Add(button, columnIndex, rowIndex);  

                }
            }
        }

        public static void MaFunction(string polename)
        {
           StatementReferencielPageModel.FindPoleName(polename);
        }

        public void GoToAssesmentGrid(object sender, System.EventArgs e)
        {
            if (PickerSectorsLists.SelectedIndex == -1) 
            {
                DisplayAlert("Erreur de saisie", "Veuillez séléctioner un secteur svp! ", "D'accord");
            }
            else
            {
                var page = new AssesmentGridPage();
                Navigation.PushAsync(page);
            }
         }
    }
}

view Model code :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using Xamarin.Forms;
using PolQual.Views;

namespace PolQual.ViewModels
{
    public class StatementReferencielPageModel : INotifyPropertyChanged
    {
        private static List<Sector> _sectorsLists;
        public static List<Sector> SectorsLists { get => _sectorsLists; set => _sectorsLists = value; }

        private readonly List<Sector> sectorsFindLists;
        private static List<Sector> _sectorsFindLists;
        public static List<Sector> SectorsFindLists { get => _sectorsFindLists; set => _sectorsFindLists = value; }

        private static List<Pole> _polesLists;
        public static List<Pole> PolesLists { get => _polesLists; set => _polesLists = value; }

        public event PropertyChangedEventHandler PropertyChanged;

        public void OnPropertyChanged([CallerMemberName] string propertyname = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyname));
        }

        private bool _boxboard { get; set; }
        public bool Boxboard
        {
            get { return _boxboard; }
            set
            {
                _boxboard = value;
                OnPropertyChanged();
                OnPropertyChanged(nameof(ShowBoxboard));
            }
        }

        private bool _glass { get; set; }
        public bool Glass
        {
            get { return _glass; }
            set
            {
                _glass = value;
                OnPropertyChanged();
                OnPropertyChanged(nameof(ShowGlass));
            }
        }

        private bool _householdTrash { get; set; }
        public bool HouseholdTrash
        {
            get { return _householdTrash; }
            set
            {
                _householdTrash = value;
                OnPropertyChanged();
                OnPropertyChanged(nameof(ShowHouseholdTrash));
            }
        }

        private Sector _selectedSector { get; set; }
        public Sector SelectedSector
        {
            get { return _selectedSector; }
            set
            {
                if (_selectedSector != value)
                {
                    _selectedSector = value;
                    // que faire quand l'élèment est sélectionné !
                }
            }
        }

        public StatementReferencielPageModel()
        {
            SectorsLists = GetSectors().OrderBy(t => t.Key).ToList();
            SectorsFindLists = GetSectors().OrderBy(t => t.Key).ToList();
            PolesLists = GetPoles().OrderBy(t => t.Key).ToList();
        }

        public List<Sector> GetSectors()
        {
            var Sectors = new List<Sector>()
            {
                //Erdre et cens
                new Sector() { Key = 0, Value = "Sautron", PoleName="Erdre et cens" },
                new Sector() { Key = 1, Value = "Orvault", PoleName="Erdre et cens" },
                new Sector() { Key = 2, Value = "Nantes Nord", PoleName="Erdre et cens" },
                new Sector() { Key = 3, Value = "La-Chapelle-Sur-Erdre", PoleName="Erdre et cens" },
                // Erdre et Loire
                new Sector() { Key = 4, Value = "Mauves-Sur-Loire", PoleName="Erdre et Loire" },
                new Sector() { Key = 5, Value = "Carquefou", PoleName="Erdre et Loire" },
                new Sector() { Key = 6, Value = "Thouré sur Loire", PoleName="Erdre et Loire" },
                new Sector() { Key = 7, Value = "Sainte Luce sur Loire", PoleName="Erdre et Loire" },
                new Sector() { Key = 8, Value = "Nantes Erdre", PoleName="Erdre et Loire" },
                new Sector() { Key = 9, Value = "Doulon", PoleName="Erdre et Loire" },
                //Loire-Sèvre et Vignoble
                new Sector() { Key = 10, Value = "Rezé", PoleName="Loire-Sèvre et Vignoble" },
                new Sector() { Key = 11, Value = "Les Sornières", PoleName="Loire-Sèvre et Vignoble" },
                new Sector() { Key = 12, Value = "Vertou", PoleName="Loire-Sèvre et Vignoble" },
                new Sector() { Key = 13, Value = "Saint Sébastien sur Loire", PoleName="Loire-Sèvre et Vignoble" },
                new Sector() { Key = 14, Value = "Base Goulaine", PoleName="Loire-Sèvre et Vignoble" },
                new Sector() { Key = 15, Value = "Nantes sud", PoleName="Loire-Sèvre et Vignoble" },
                //Sud-Ouest
                new Sector() { Key = 16, Value = "Bouchenais", PoleName="Sud-Ouest" },
                new Sector() { Key = 17, Value = "Saint-Aignan-Grandlieu", PoleName="Sud-Ouest" },
                new Sector() { Key = 18, Value = "Bouaye", PoleName="Sud-Ouest" },
                new Sector() { Key = 19, Value = "Saint-Leger-Les-Vignes", PoleName="Sud-Ouest" },
                new Sector() { Key = 20, Value = "Brains", PoleName="Sud-Ouest" },
                new Sector() { Key = 21, Value = "La-Montagne", PoleName="Sud-Ouest" },
                new Sector() { Key = 22, Value = "Saint-Jean-De-Boiseau", PoleName="Sud-Ouest" },
                new Sector() { Key = 23, Value = "Le Pellerin", PoleName="Sud-Ouest" },
                //Loire-Chézine
                new Sector() { Key = 24, Value = "Couëron", PoleName="Loire-Chézine" },
                new Sector() { Key = 25, Value = "Saint-Herblain", PoleName="Loire-Chézine" },
                new Sector() { Key = 26, Value = "Indre", PoleName="Loire-Chézine" },
                //Nantes-Ouest
                new Sector() { Key = 27, Value = "Bellevue-Chantenay-Sainte-Anne", PoleName="Nantes-Ouest" },
                new Sector() { Key = 28, Value = "Dervallière-Zola", PoleName="Nantes-Ouest" },
                new Sector() { Key = 29, Value = "Breil-Barberie", PoleName="Nantes-Ouest" },
                new Sector() { Key = 30, Value = "Hauts Pavés Saint Félix", PoleName="Nantes-Ouest" },
                //Nantes-Loire
                new Sector() { Key = 31, Value = "Malakof-Saint-Donatien", PoleName="Nantes-Loire" },
                new Sector() { Key = 32, Value = "Centre Ville", PoleName="Nantes-Loire" },
                new Sector() { Key = 33, Value = "île de Nantes", PoleName="Nantes-Loire" },

            };
            return Sectors;
        }

        public List<Pole> GetPoles()
        {
            var Poles = new List<Pole>()
            {
                new Pole { Key = 1, Name = "Erdre et Cens", Color = "ffccd5"},
                new Pole { Key = 2, Name = "Erdre et Loire", Color = "ff4d4d"},
                new Pole { Key = 3, Name = "Loire-Sèvre et vignoble", Color = "ff9933"},
                new Pole { Key = 4, Name = "Sud-Ouest", Color = "bfbfbf"},
                new Pole { Key = 5, Name = "Loire-chézine", Color = "ffff4d"},
                new Pole { Key = 6, Name = "Nantes-Ouest", Color = "3385ff"},
                new Pole { Key = 7, Name = "Nantes-Loire", Color = "53c653"},
            };
            return Poles;
        }

        public static void FindPoleName(string polename)
        {
            for (int search = 0; search < SectorsLists.Count(); search++)
            {
                if (SectorsLists[search].PoleName == polename)
                {
                    SectorsFindLists.Add(new Sector() {Key = search, Value = SectorsLists[search].Value, PoleName = polename });
                }
            }
        }

        public string ShowBoxboard
        {
            get
            {
                return $"{(_boxboard ? "Jour de collecte des cartons : oui " : "Jour de collecte des cartons : non")}";
            }
        }

        public string ShowGlass
        {
            get
            {
                return $"{(_glass ? "Jour de collecte du verre : oui " : "Jour de collecte du verre : non")}";
            }
        }

        public string ShowHouseholdTrash
        {
            get
            {
                return $"{(_householdTrash ? "Jour de collecte des Ordure ménagère : oui " : "Jour de collecte des Ordure ménagère : non")}";
            }
        }
    }

    public class Sector
    {
        private int _key;
        public int Key { get => _key; set => _key = value; }

        private string _value;
        public string Value { get => _value; set => _value = value; }

        private string _poleName;
        public string PoleName { get => _poleName; set => _poleName = value; }
    }

    public class Pole
    {
        private int _key;
        public int Key { get => _key; set => _key = value; }

        private string _color;
        public string Color { get => _color; set => _color = value; }

        private string _name;
        public string Name { get => _name; set => _name = value; }
    }
}

Small dSym file

$
0
0

An app I'm building produces a small .dSym file - 9KB. Is that normal? I don't think so.
Not sure why it is so small - using latest stable version of Visual Studio 2017 and VS for MAC. App is build in compiled from VS2017 on Windows 10.

Broadcast receiver not firing on receive

$
0
0

Here is my broadcast receiver code:

[BroadcastReceiver]
[IntentFilter(new[] { BluetoothDevice.ActionFound })]
public class BlueToothDeviceBroadcastReciever : BroadcastReceiver
{
    public override void OnReceive(Context context, Intent intent)
    {
         IBlueToothService service = Xamarin.Forms.DependencyService.Get<IBlueToothService>();
         string action = intent.Action;
         if (action == BluetoothDevice.ActionFound)
         {
              BuetoothDevice newDevice = (BluetoothDevice)intent.GetParcelableExtra(BluetoothDevice.ExtraDevice);
              service.DeviceAdded(new Models.BluetoothDevice(newDevice.Name, newDevice.Address));
         }
    }
}

Here is my on-resume code for the activity:

 protected override void OnResume()
        {
            if(bluetoothDeviceReceiver == null)
            {
                 bluetoothDeviceReceiver = new BlueToothDeviceBroadcastReciever();
            }           
            RegisterReceiver(bluetoothDeviceReceiver, new IntentFilter(BluetoothDevice.ActionFound));
            base.OnResume();
        }

and I am calling start scan once the user clicks a button:

public void StartScan()
        {
            BluetoothAdapter adapter = BluetoothAdapter.DefaultAdapter;
            if(adapter.IsEnabled)
            {
                adapter.StartDiscovery();
            }
        }

I cant get the OnReceive to fire inside the broadcast receiver
did I miss anything?

Thanks!

ImageButton from Xamarin Forms 3.4: different render behavoir regarding to Image

$
0
0

Old implementation was
class MyImageButton : Image { … }

This I changed to class MyImageButton : ImageButton { … }
On platform UWP it's the same behavoir, iOS I never tested, but on Android it's different.

As it's forbidden to post links I cannot show the picture.
I have the "three Points menu image".
With ImageButton as base I see only the left/top quarter of the image.
With Image as base I see the image as expected.

Top Part is rendered with new ImageButton, the Bottom with my old Image based.

It's no big deal to Keep with my old implementation. But I'm wondering why ImageButton is rendered different from Image on Android.

Regards, Holger Gothan.

Binding to native android lib is not success

$
0
0

I have problem with binding with android native library. After do all steps then build the project. the result is success with many warning. But it not generate .net class on object browser. Please see the attachment for more detail.

Viewing all 204402 articles
Browse latest View live


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