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

Push Notification's Custom Action not shown on iOS13 when iPhone is Idle

$
0
0

I am running into an issue relating to custom actions for a push notification on an iPhone that is idle/locked. It happens when the device is idle.

Let me first describe how it should work. This is working on iPhone using iOS12.
1. The device is idle and a push notification is received.
2. The user taps the push notification.
3. User unlocks the iPhone.
4. The app launches.
5. A message is displayed where the user either selects "accept" or "decline".

Here is what is happening on iPhones running iOS 13.
1. The device is idle and a push notification is received.
2. The user taps the push notification.
3. User unlocks the iPhone.
4. The app launches.
5. Message is never displayed with actions.

I am currently using Xcode v11.3.1. I see v11.6 is available.


pinterest app like collection of images in Xamarin Forms

$
0
0

Can someone suggest me a solution to implement xamarin forms collectionview like in this picture with variable size of heights and same spacing in each column and pictures without top alignment of each row.

Or any solution other than collectionview to implement such layout

How do I 'move' the clipping rectangle on a SkiaSharp SKCanvas?

$
0
0

I think I am missing a trick with SkiaSharp. It's difficult to explain without diagrams but here goes...

Imagine I have a single canvas that I conceptually want to divide into three columns. Now imagine I want to draw different shapes into each of the three columns but I want the shapes to clip at the column boundaries. And finally I want to draw a shape that extends over the whole canvas.

I can change the clipping rectangle to draw in the first column. When it comes to drawing in the second, how do I do this? If I call ClipRect() again, the second rectangle is combined with the first (either subtracted or intersected). What I want to do is clear the first clip rectangle I set, or somehow reset the clipping rectangle to be the whole canvas.

And when it comes to drawing my final shapes that fill the whole canvas, I definitely need to put the clipping rectangle back to being the whole canvas.

How would I do this?

Kind wishes - Patrick

How do I get Nearby connections to work?

$
0
0

I am writing an Android native app that should allow nearby phones to ne discovered, connected and exchabging messages.
The app works perfectly when connecting via version 60.1142 of Xamarin.GooglePlayServices.Nearby and using the GoogleApiClient approach, but that version is deprecated.

I converted the app to using version 117.0.0.preview04 of the package, but my test phones (one advertising and one discoovering) do not see eachother.

Has anybody a working example of NearBy using the latest prerelease of the package?

Retrieve all photos from custom folder on Android

$
0
0

On my Android device, inside of the Files folder under Images, I've created a new folder 'MyFolder' and added some photos.

I need to access these images without using a picker and put them into a list

I've looked at many documentation on file access, but I can't find anything that shows how to target a specific folder by name and retrieve its contents.

Can someone point me in the direction of some documentation or provide some sample code to help me understand this please

Android crashes after Update to VS 16.7.0

$
0
0

I tested it on two different systems. After I updated vom 16.6.6 oder 16.7.0 I can not start my App anymore. It crashes immediately without giving me any chance to debug anything. On the one System, the Message is just "myApp has stopped" and on the other system not even a message comes up.
The same code runs on a third system with 16.6.6 nicely. I updated all SDK´s and Nuget-packages and tried it with 4 different Android-Systems, even with my Hardware-Device. It is really frustrating. I had some many problems with the last Updates of Xamarin and VS...

Has anyone here had a similar experience? In the net I do not find a message about it.

Is there a size limit to the information returned by OnEndpointFound?

$
0
0

I am using the NearbyClass ConnectionsClinet to discober Bluetootj devices near my phone.
Before the call to NearbyClass.GetConnectionsClient(this).StartDiscovery I have set the ConnectionClient.MaxBytesDataSize value to 5K.
When an endpoint is found, the discovery returns information about the endpoint but the returned EndpointName string is truncated after 132 characters.
I have verified that the string sent to the StartAdvertising function call from another device is about 4500 characters.
What am I doing wrong?
Is there a limit on the lenfgth of the endpoint name?

Is it possible to use Prism INavigationService in a custom view?

$
0
0

I made a custom view that extends ContentView, and I would like to use the NavigationService to handle navigation, but when I inject it in the constructor, I get this build error (apparently in CustomHeader.xaml):

Severity Code Description Project File Line Suppression State
Error The given key was not present in the dictionary.

This is my custom view code behind (CustomHeader.xaml.cs):

    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class CustomHeader : ContentView
    {
        private DelegateCommand _profilePictureTappedCommand;
        public DelegateCommand ProfilePictureTappedCommand =>
            _profilePictureTappedCommand ?? (_profilePictureTappedCommand = new DelegateCommand(ExecuteProfilePictureTappedCommand));

        // This Prism command works just fine, it fires successfully
        private void ExecuteProfilePictureTappedCommand()
        {
        }

        public CustomHeader(INavigationService navigationService)
        {
            try
            {
                InitializeComponent();

                ProfilePicture = Properties.CurrentUser.ProfilePicture;
            }
            catch (Exception ex)
            {
                throw;
            }

            _navigationService = navigationService;
        }
    }

Is it not possible to do dependency injection in a class that extends ContentView?
Just tagging you @BrianLagunas in case you have a quick answer to that.

Thanks!


How do we create a composite primary key using SQLite.NET ORM

$
0
0

How do we create a composite primary key using SQLite.NET ORM

what Event is start when page close up?

$
0
0

What Event is start when page close up?

Intercept page leaving event

$
0
0

Basically I would like to ask the user, if he really wants to move away from the current page. How would I do that? I have a MasterDetailPage. Is there an event like the disappearing but before the page gets destroyed?

Video Compression in Xamarin PCL

$
0
0

Hi,

Can any one help me on video compression without using ffmpeg as this is not working from Android Nougat version. Please share sample code. Any help is appreciated..!! Thank you.

Xamarin Forms Video Compression

$
0
0

hi,

is there any cross platform plugins available for video compression ?

any help will be appreciated.

Video Compression in Xamarin

$
0
0

I'm looking for video compression in Xamarin Forms. I am using plugin.media to take video then I upload that video to server but video size is too big. I need to compress video but there is no specific solution. I need to implement platform specific solution but I couldn't find any solution platform specific on Android and iOS. Is there any solution for video compression on Android and iOS.

Unterminated string. Expected delimiter

$
0
0

When I calling Tcp request and when we call this "var responseModel = JsonConvert.DeserializeObject(str);" then it return error:

Unterminated string. Expected delimiter.


Video compression on Android

Xamarin IOS app, the restore function in my app from iCloud will not work once on the App Store

$
0
0

My IOS app is now on the Apple App Store. I tested it like crazy before it was put on the App Store and I am sure Apple did as well, but now that it is on the App Store, when I install it from there, the restore function I wrote to restore the applications data from iCloud does not work. The backup function works, as I can see the iCloud usage on my phone for my app contains 78mb of data, but the restore does not work at all, it just goes back to the home page. I have no idea why as I get nothing reported on the crash.

2 questions

  1. Is there a way to look at why it is crashing on my phone
  2. Any idea why it would stop working once installed from the App Store when it must have worked for apple when they tested it and worked for me as well before on the App Store?

Masonry view in Xamarin forms

$
0
0

i started Xamarin Forms a month ago and i am trying to implement sample Ui (attached) For android and iOS using list view and grid view with some nested views to show image and labels

So idea is i will have list view with grid . And grid will have two columns and two rows . if image is portrait grid child row span will be 1 and grid child column span will be 2 . I am new to Xamarin Forms so i am confused that is there any event that will trigger when ever a view cell is added and can pass me view cell with Access to grid in that view cell so i can change to span values of grid child ?

any help in the code to get started will be help full

Masonry list style in Xamarin

$
0
0

I need to list the announcements on a content page just like masonry style (https://halcyon-theme.tumblr.com/) but I couldn't be successful on it. My problem is that the Scrollview doesn't cover whole the page when I use the Parent Stacklayout's Vertical alignment option set as FillAndExpand. But if I set the Scrollview and Parent StackLayout as static height value, It's okay but due to per item's height will change, I can't use it that's the way as you guess.

 <StackLayout x:Name="stckParent" Orientation="Vertical" VerticalOptions="FillAndExpand">
                    <Grid VerticalOptions="FillAndExpand" RowSpacing="0" ColumnSpacing="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto"/>
                        </Grid.RowDefinitions>

                        <StackLayout x:Name="stckLeft" Grid.Column="0" Margin="0,0,2,0"
                                  Orientation="Vertical" VerticalOptions="FillAndExpand">
                        </StackLayout>

                        <StackLayout x:Name="stckRight" Grid.Column="1" Margin="2,0,0,0"
                                  Orientation="Vertical" VerticalOptions="FillAndExpand">
                        </StackLayout>

                    </Grid>
                </StackLayout>

</ScrollView>


public MainPage()
        {
            InitializeComponent();

            var list = new ObservableCollection<Announcement>
            {
                new Announcement
                {
                    ID = 1,
                    Title = "Yedek parça siparişlerinizde %22' ye varan indirim!",
                    ImagePath = "https://image5.sahibinden.com/photos/08/54/18/x5_719085418j7p.jpg",
                    IsActive = true,
                    CreateDate = DateTime.Now,
                },
                new Announcement
                {
                    ID = 2,
                    Title = "Fren Balataları Hangi Sıklıkla Değiştirilmelidir?",
                    ImagePath = "https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTJzQfduSrJ3Nh7SHzGSGrCmTnWses4AcfuRSnU7hX4y9XN4TSU&usqp=CAU",
                    IsActive = true,
                    CreateDate = DateTime.Now,
                }
            };

            DeviceHelper helper = DependencyService.Get<IDeviceHelper>().GetDevice();

            double height = 0;

            for (int m = 0; m < 6; m++)
            {
                for (int i = 0; i < list.Count; i++)
                {

                    Frame frame = new Frame
                    {
                        Padding = new Thickness(0, 0, 0, 0)
                    };

                    // Stack
                    StackLayout stack = new StackLayout
                    {
                        Margin = new Thickness(10),
                    };

                    // Image
                    Image image = new Image
                    {
                        Source = list[i].ImagePath,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions = LayoutOptions.FillAndExpand
                    };

                    // Title
                    Label title = new Label
                    {
                        Text = list[i].Title,
                        Margin = new Thickness(0, 6, 0, 0),
                        FontSize = 13
                    };

                    // Date
                    Label date = new Label
                    {
                        Text = list[i].CreateDate.ToString().Substring(0, 10), // temporary workaround
                        Margin = new Thickness(0, 6, 0, 0),
                        TextColor = Color.Gray,
                        FontSize = 11
                    };

                    stack.Children.Add(image);
                    stack.Children.Add(title);
                    stack.Children.Add(date);

                    frame.Content = stack;


                    if (i % 2 == 0)
                    {
                        stckLeft.Children.Add(frame);
                    }
                    else
                    {
                        stckRight.Children.Add(frame);

                        SizeRequest columnSizeRequest = frame.Measure(600, 800);
                        height += columnSizeRequest.Request.Height * 6; // *6 is estimated height, what should be the solution?
                    }
                }
            }
            stckLeft.HeightRequest = height;
            stckRight.HeightRequest = height;

            scrList.HeightRequest = helper.ScreenHeight - 100;

        }

Why Scrolview doesn't fill the whole page?
What is the best practice to able to do the masonry-style page?

How can I obtain a frame size that just bound? {
SizeRequest columnSizeRequest = frame.Measure(300, 400); // the result is always 41, It's not make sense..
height += columnSizeRequest.Request.Height * 6;

}

except for estimated height value, not bad :)

GitHub link; https://github.com/Erdogan34/Test-Masonry

thanks

Picker - SelectedItem Binding on pageload

$
0
0

Hi Guys,

Need your help pls as tested this alot and still couldn't find why my picker can't select the related item on the page load.
Note : All Categories are loaded in picker but the issue is that I can't see the related category selected.

Your helps are highly appreciated.

*My VM:

private ObservableCollection _AllCats;
public ObservableCollection AllCats
{
set
{
this._AllCats = value;
OnPropertyChanged();
}
get
{
return this._AllCats;
}
}

    private Category _SelectedCat;
    public Category SelectedCat
    {           
       set
        {
            this._SelectedCat = value;
            OnPropertyChanged();
        }
        get
        {
            return this._SelectedCat;
        }
    }

    public ProdsMngtDetailViewModel(Product product , Category selectedcat)
    {
        GetCatsAsync();
        SelectedCat = selectedcat;
        SelectedProduct = product;
        CategoriesService cs = new CategoriesService();
        AllCats = cs.GetAllCats2();
    }

private async void GetCatsAsync()
{
CategoriesService cs = new CategoriesService();
List list = await cs.GetCategoriesAsync();
AllCats = new ObservableCollection(list);
}

XAML:

Viewing all 204402 articles
Browse latest View live


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