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

App rejected Issue: Violation of Device andNetwork Abuse policy

$
0
0

So i decided to publish my app on google, and it got rejected.

What the application do is simple play youtube videos using thair youtube player.

The search etc i do it in my own rest api.

So the application is simple displaying those data that it gets from my rest api.

No youtube api or youtube related operation is done other then the video player.

This is the email content i got from google

Publishing status: Rejected
Your app has been rejected and wasn't published due to a policy violation. If you submitted an update, the previous version of your app is still available on Google Play.


Issue: Violation of Device and Network Abuse policy 
We don’t allow apps that interfere with, disrupt, damage, or access in an unauthorized manner the user’s device, other devices or computers, servers, networks, application programming interfaces (APIs), or services, including but not limited to other apps on the device, any Google service, or an authorized carrier’s network.

Your app shouldn’t access or use the service or API in a manner that violates its terms of service. For example, your app shouldn't download, monetize, or access YouTube videos in a way that violates the YouTube Terms of Service.

Here is my app incase some like to view it.

chrome-extension://bigefpfhnfcobdlfbedofhhaibnlghod/mega/secure.html#!UggU2Iwa!KnCvh5l-_CxgzWMssRz8i1hesYu2zNb26zD6P5T9dgk

Any suggesting would be really helpfull.


Having consistent error trying to use AdMob in Xamarin.Forms App

$
0
0

Hi,

I have been trying to put banner ads in a couple of my Xamarin.Forms aps. I followed the video on James Montemagno on Channel9
https://channel9.msdn.com/Shows/XamarinShow/Episode-26-Monetizing-Mobile-Apps-with-Ads
and also used the blog post at
https://montemagno.com/xamarinforms-google-admob-ads-in-android/

I get everything installed and all classes added as per the examples. I am having a problem with the AndroidManifest.xml file. The eroor I get is:
No resource identifier found for attribute 'configchanges' in package 'android' DewPoint.Android

This is what I have in my AndroidManifest.xml file



Can someone help me find a solution. Or is there a more recent example somewhere ??

Thanks in advance

How To Add List to Local Database? and images As it even cannot take the ImageSource?

$
0
0

public ImageSource Image1 { get; set; }
public ImageSource Image2 { get; set; }
public ImageSource Image3 { get; set; }
public ImageSource Image4 { get; set; }
public ImageSource Image5 { get; set; }
public ImageSource Image6 { get; set; }
public ImageSource Image7 { get; set; }
public ImageSource Image8 { get; set; }
public ImageSource Image9 { get; set; }
public ImageSource Image10 { get; set; }
public ImageSource Image11 { get; set; }

Which event will be raised after selecting Time in TimePicker?

$
0
0

Hi,

I want a event that is to be raised after selecting time from TimePicker, similar to DatePicker's DateSelected event. This event is raised after selecting Date option. But in TimePicker such type of event doesn't exist. As far as i checked, events like Focused, PropertyChanged all were raised before selecting Time option. But i need a event that is to be raised after selecting Time option, so that i can alert user if the selected Time were in past.

How to pass data from Label inside ListView

$
0
0

Hi Xamarin forum how can I get my data from my Label inside my listView here is my code

XAML

<ListView  x:Name="listViewPost" RowHeight="570" Margin="0" ItemTapped="ViewPost" SeparatorVisibility="None" IsPullToRefreshEnabled="True">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                <Frame Padding="10,0,10,10" WidthRequest="400">
                                    <Frame CornerRadius="4" WidthRequest="400" Padding="0,0,0,10">
                                        <StackLayout Margin="5,0,5,0" Padding="0">
                                            <StackLayout>
                                                <StackLayout Orientation="Horizontal">
                                                    <controls:CircleImage Source="default_user.jpg" Aspect="AspectFit" BorderColor="Gray" BorderThickness="1" Grid.Column="0" Grid.Row="0">
                                                        <controls:CircleImage.WidthRequest>
                                                            <OnPlatform x:TypeArguments="x:Double">
                                                                <On Platform="Android, iOS">25</On>
                                                            </OnPlatform>
                                                        </controls:CircleImage.WidthRequest>
                                                        <controls:CircleImage.HeightRequest>
                                                            <OnPlatform x:TypeArguments="x:Double">
                                                                <On Platform="Android, iOS">25</On>
                                                            </OnPlatform>
                                                        </controls:CircleImage.HeightRequest>
                                                    </controls:CircleImage>
                                                    <StackLayout Margin="0,5,0,5">
                                                        <Label Text="{Binding Uploader}" HorizontalOptions="Start" FontSize="16" x:Name="uploader"  FontAttributes="Bold" FontFamily="sans-serif-light">
                                                            <Label.GestureRecognizers>
                                                                <TapGestureRecognizer Tapped="Tap_Uploader"/>
                                                            </Label.GestureRecognizers>
                                                        </Label>
                                                        <StackLayout Orientation="Horizontal">
                                                            <Label Text="Posted on " FontFamily="sans-serif-light"/>
                                                            <Label Text="{Binding dateUpload, StringFormat='{}{0:MMM d,yyyy}'}" HorizontalOptions="Start" FontSize="12" FontFamily="sans-serif-light"/>
                                                        </StackLayout>
                                                    </StackLayout>
                                                </StackLayout>
                                            </StackLayout>
                                            <Label Text="{Binding PostContent}" FontSize="15"/>
                                            <Image WidthRequest="400" HeightRequest="400" Aspect="AspectFill" Source="{Binding Photo}"/>
                                        </StackLayout>
                                    </Frame>
                                </Frame>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>

CodeBehind

public void Tap_Uploader(object sender, EventArgs e)
{

        string valueName = uploader.Text;

    }

Xamarin Forms iOS project is failing while doing archive for publishing

$
0
0

Hi,
I have a Xamarin .forms project. For that ios project, When I am creating a Release build, it is throwing the following error.
A PackageReference for 'NETStandard.Library' was included in your project. This package is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see https://aka.ms/sdkimplicitrefs

I tried Adding



But this does not help.

Xamarin form icons png problem

$
0
0

Hello every one i am new to xamarin and i really like it
but i have small problem which is that i have an icon png i place it into Resources drawable folder and also into Assets folder for android and i reference it in my xamarin form in header but it is not showing
this how i use in header :

    <ToolbarItem Name="iconexample" Icon="baseline.png" Priority="0" Order="Primary" Activated="MenuOnclick"   />

Blank space after listview items.

$
0
0

Hi all,
My listview Bottom portion has some blank space, I tried to remove it by adding Footer and HasUnevenRows, but not get lucky.
Screenshot:

My code:

<ContentPage>
<ScrollView>
    <StackLayout  
       Orientation="Vertical">

       //Community frame
       <Frame/>

         <ListView x:Name="Mycommunities"
                   HasUnevenRows="True"
                   Margin="15,5,5,5">
                            <ListView.ItemTemplate>
                                <DataTemplate>
                                       <TextCell Text="{Binding communities}" />
                                </DataTemplate>
                              </ListView.ItemTemplate>
                            <ListView.Footer>
                                <Label/>
                           </ListView.Footer>
                 </ListView>

//Add community and log out frames
       <Frame/>
       <Frame/>

       </StackLayout>
    </ScrollView>
</ContentPage>

Please suggest any solution? Thanks in advance :)


listview with grids on the same page having scrolling issue

$
0
0

Dear All.
i have a page where i am using couple of listviwes and some grids but if i put all inside scrollview it dose not work and leave unnecessary blank area where scroll does not works .

for example:

grid (have 2 rows)
listview (auto generated rows)
grid ( have 3 rows )
listview (auto generated rows)

so it shows first grid on top then list view but after listview items there is big blank area then next grid and same for the next listview that blank area i cant scroll.

i am beginner and dont know much may be i explained enough for you to understand.

Xamarin forms: How to handle the notification click in ios

$
0
0

I have implemented the push notification on my xamarin forms ios project. Now I am able to receive notifications on my iPhones that are pushed from the postman. But when tapping the notification how can I read my model data from notification and load the PCL App.xaml.cs?

When clicking the notification in ios device I need to open a content page(Message listing page) on my PCL project. I have implemented this on my PCL project App.xaml.cs. For this, I need to load the App.xaml.cs from AppDelegate.cs with the model data received from the notification.

Following way I am loading the App.xaml.cs from Android MainActivity

LoadApplication(new App(notificationdata));

In ios DidReceiveRemoteNotification is invoking when receiving the notification for background and foreground modes, but not invoking when taps the notification.

My notification body: webContentList is my model data.

{
 "to" : "dmtfiSvBBM0:APA91bFnHkamMSYgxPuiSfdvKnU8hD_mOqrWijnENNgXVSkSgo1ILH3-uKVCU7Ez2PXXOhtDoobIyKBf5UshVfTmvjSqHgXMRTsqguKCSTjIfGnXrVP-_cNFq2sisshZO-BcfkwKTl-I",
 "collapse_key" : "type_a",
 "notification" : {
      "body" : "This is body",
     "title": "Tech Team",
     "priority":"high",
     "content_available":true
 },
 "data" : {
    "webContentList": [
        {
            "webContentDefinitionId": 818084,
            "pageTitle": "CCD Grade 3-4",
            "pageKwd": "CCD Grade 3-4",
            "pageDesc": "CCD Grade 3-4",
            "siteId": 45,
            "pageCreatedTime": 1555145959428,
            "pageUpdatedDate": 1555927274279,
            "modifier": {
                "userId": 12944,
                "applicationId": 32,
                "username": "robert.downey",
                "email": "robert@master-mail.net",
                "firstName": "Robert",
                "lastName": "Downey"
            },
            "creator": {
                "userId": 12944,
                "applicationId": 32,
                "username": "robert.downey",
                "email": "robert@master-mail.net",
                "firstName": "Robert",
                "lastName": "Downey"
            }
        }
        ]
 },
  "ttl": 3600
}

My AppDelegate.cs

    [Register("AppDelegate")]
    public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate, IUNUserNotificationCenterDelegate, IMessagingDelegate
    {
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Rg.Plugins.Popup.Popup.Init();
            global::Xamarin.Forms.Forms.Init();
            ImageCircleRenderer.Init();
            LoadApplication(new App("", ""));

            #region Push Notification            
            Firebase.Core.App.Configure();
            if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
            {
                // iOS 10 or later
                var authOptions = UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound;
                UNUserNotificationCenter.Current.RequestAuthorization(authOptions, (granted, error) => {
                    Console.WriteLine(granted);
                });

                // For iOS 10 display notification (sent via APNS)
                UNUserNotificationCenter.Current.Delegate = this;

                // For iOS 10 data message (sent via FCM)
                //Messaging.SharedInstance.RemoteMessageDelegate = this;
            }
            else
            {
                // iOS 9 or before
                var allNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound;
                var settings = UIUserNotificationSettings.GetSettingsForTypes(allNotificationTypes, null);
                UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
            }

            UIApplication.SharedApplication.RegisterForRemoteNotifications();

            Messaging.SharedInstance.Delegate = this;
            Messaging.SharedInstance.ShouldEstablishDirectChannel = true;
            #endregion

            return base.FinishedLaunching(app, options);
        }

        [Export("messaging:didReceiveRegistrationToken:")]
        public void DidReceiveRegistrationToken(Messaging messaging, string fcmToken)
        {
            LogInformation(nameof(DidReceiveRegistrationToken), $"Firebase registration token: {fcmToken}"
            MessagingCenter.Send<object, string>(this, "fcmtoken", fcmToken.ToString());
            Console.WriteLine($"fcmtoken received: {fcmToken}");
        }

        public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
        {
            HandleMessage(userInfo);
            // Print full message.
            LogInformation(nameof(DidReceiveRemoteNotification), userInfo);
            completionHandler(UIBackgroundFetchResult.NewData);
        }

        [Export("messaging:didReceiveMessage:")]
        public void DidReceiveMessage(Messaging messaging, RemoteMessage remoteMessage)
        {
            // Handle Data messages for iOS 10 and above.
            HandleMessage(remoteMessage.AppData);
            LogInformation(nameof(DidReceiveMessage), remoteMessage.AppData);
        }

        void HandleMessage(NSDictionary message)
        {
            //if (MessageReceived == null)
            //    return;

            //MessageType messageType;
            //if (message.ContainsKey(new NSString("aps")))
            //    messageType = MessageType.Notification;
            //else
            //    messageType = MessageType.Data;

            //var e = new UserInfoEventArgs(message, messageType);
            //MessageReceived(this, e);
        }

        public static void ShowMessage(string title, string message, UIViewController fromViewController, Action actionForOk = null)
        {
            var alert = UIAlertController.Create(title, message, UIAlertControllerStyle.Alert);
            alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, (obj) => actionForOk?.Invoke()));
            fromViewController.PresentViewController(alert, true, null);
        }

        void LogInformation(string methodName, object information) => Console.WriteLine($"\nMethod name: {methodName}\nInformation: {information}");

        async Task RequestPushPermissionAsync()
        {
            // iOS10 and later (https://developer.xamarin.com/guides/ios/platform_features/user-notifications/enhanced-user-notifications/#Preparing_for_Notification_Delivery)
            // Register for ANY type of notification (local or remote):
            var requestResult = await UNUserNotificationCenter.Current.RequestAuthorizationAsync(
                UNAuthorizationOptions.Alert
                | UNAuthorizationOptions.Badge
                | UNAuthorizationOptions.Sound);


            // Item1 = approved boolean
            bool approved = requestResult.Item1;
            NSError error = requestResult.Item2;
            if (error == null)
            {
                // Handle approval
                if (!approved)
                {
                    Console.Write("Permission to receive notifications was not granted.");
                    return;
                }

                var currentSettings = await UNUserNotificationCenter.Current.GetNotificationSettingsAsync();
                if (currentSettings.AuthorizationStatus != UNAuthorizationStatus.Authorized)
                {
                    Console.WriteLine("Permissions were requested in the past but have been revoked (-> Settings app).");
                    return;
                }

                UIApplication.SharedApplication.RegisterForRemoteNotifications();
            }
            else
            {
                Console.Write($"Error requesting permissions: {error}.");
            }
        }
    }
}

Log data when receiving notification:

Method name: DidReceiveRemoteNotification
Information: {
    aps =     {
        alert =         {
            body = "This is body";
            title = "Tech Team";
        };
        "content-available" = 1;
    };
    "gcm.message_id" = 1562648547588794;
    "gcm.notification.priority" = high;
    "google.c.a.e" = 1;
    webContentList = "[{\"swcmMessage\":null,\"pageTitle\":\"CCD Grade 3-4\",\"modifier\":{\"lastname\":\"downey\",\"zipcode\":null,\"parentemail\":null,\"address2\":null,\"city\":null,\"address1\":null,\"phone2\":null,\"userid\":12944,\"enabled\":true,\"phone1\":null,\"firstname\":\"robert\",\"state\":null,\"usertype\":null,\"applicationid\":32,\"profileimageurl\":null,\"profileimagetype\":null,\"email\":\"robert@master-mail.net\",\"username\":\"robert.downey\"},\"deletable\":true,\"pagecontenttype\":\"tweets.topics\",\"previewuuid\":null,\"webcontentdefinitionid\":818084,\"pagecreatedtime\":1555145959428,\"usercreated\":12944,\"pagestatus\":\"on\",\"thumbnailimageurl\":null,\"videourl\":null,\"imageurl\":\"\",\"webcontentid\":65059,\"creator\":{\"lastname\":\"downey\",\"zipcode\":null,\"parentemail\":null,\"address2\":null,\"city\":null,\"address1\":null,\"phone2\":null,\"userid\":12944,\"enabled\":true,\"phone1\":null,\"firstname\":\"robert\",\"state\":null,\"usertype\":null,\"applicationid\":32,\"profileimageurl\":null,\"profileimagetype\":null,\"email\":\"robert\"},\"contentTemplateId\":null,\"appName\":\"services\",\"customHTML\":\"\",\"processedTime\":null,\"pageDesc\":\"CCD Grade 3-4\",\"editUrl\":\"\\/module\\/tweets-topics\\/edit-tweets-topics?webcontentid=818084\",\"pageKwd\":\"CCD Grade 3-4\",\"staticContent\":true,\"siteId\":45,\"pageUrl\":\"\\/tweets-topics\\/818084\\/1\\/ccd-grade-3-4\",\"linkType\":null,\"pageUpdatedDate\":1555927274279,\"swcmStatus\":null,\"userModified\":12944}]";
}

webContentList is my model data, I need that data when loading the App.xaml.cs. How can I parse that data from the DidReceiveRemoteNotification userInfo and load the App.xaml.cs?

Grid problems - elements do not fit

$
0
0

Hi,
I've got a complex layout, consisting of a horizontal stack layout containing a list of grids. Every grid has 3 rows - 1 with an image, 1 with a big label, and 1 with a small label. Here's the code that creates the layout:

for (int i = 0; i < sights.Count(); ++i)
{
 var placeGrid = new Grid
 {
     BackgroundColor = Color.White,
     Margin = 0,
     RowSpacing = 0,
     Padding = 0
 };

 var imageRow = new RowDefinition
 {
     Height = new GridLength(6, GridUnitType.Star)
 };
 var labelRow = new RowDefinition
 {
     Height = new GridLength(3, GridUnitType.Star)
 };
 var distanceRow = new RowDefinition()
 {
     Height = new GridLength(2, GridUnitType.Star)
 };
 placeGrid.RowDefinitions.Add(imageRow);
 placeGrid.RowDefinitions.Add(labelRow);
 placeGrid.RowDefinitions.Add(distanceRow);

 var placePreview = new Image() { Source = ImageSource.FromResource("res.png"), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Margin = new Thickness(0, 5, 0, 2) };

 var placeLabel = new Label() { Text = sights[i].Name, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, Margin = new Thickness(5, 0, 5, 0), LineBreakMode = LineBreakMode.NoWrap };
 FontCalc.SplitLabel(placeLabel);
 FontCalc.FitLabelToBounds(placeLabel, AutoFit.Width);
 Label distanceLabel = (userLocation != null) ?
 new Label() { Text = MilesToKm(DistanceTo(new Coordinates(userLocation.Latitude, userLocation.Longitude), sights[i].GetCoordinates())).ToString("0.0") + " km", VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, LineBreakMode = LineBreakMode.WordWrap, Margin = new Thickness(5, 0, 5, 5)}
 : null;

 placeGrid.Children.Add(placePreview, 0, 0);
 placeGrid.Children.Add(placeLabel, 0, 1);
 if(distanceLabel != null)
     placeGrid.Children.Add(distanceLabel, 0, 2);

 PlacesStackLayout.Children.Add(placeGrid);

 if (i + 1 != Places.Count())
 {
     var separator = new BoxView
     {
         CornerRadius = 10,
         Color = Color.LightGray,
         WidthRequest = 3,
         Opacity = 0.25,
         Margin = 7,
         VerticalOptions = LayoutOptions.Fill,
         HorizontalOptions = LayoutOptions.Center
     };
     PlacesStackLayout.Children.Add(separator);
 }

}

And here's the FontCalc class:

enum AutoFit {Width, Height}

    struct FontCalc
    {
        public double FontSize { private set; get; }
        public double TextBound { private set; get; }

        public FontCalc(Label label, double fontSize, double containerBound, AutoFit calcType)
        {
            FontSize = fontSize;
            label.FontSize = fontSize;

            if(calcType == AutoFit.Width)
            {
                SizeRequest sizeRequest = label.Measure(Double.PositiveInfinity, containerBound, MeasureFlags.IncludeMargins);
                TextBound = sizeRequest.Request.Width;
            }
            else //(calcType == FontCalcType.FitToHeight)
            {
                SizeRequest sizeRequest = label.Measure(containerBound, Double.PositiveInfinity, MeasureFlags.IncludeMargins);
                TextBound = sizeRequest.Request.Height;
            }
        }

        public static void SplitLabel(Label label)
        {
            if (label.Text == null)
                return;

            int index = 0;
            int lastLineBreak = 0;
            for (int i = 0; ; ++i)
            {
                lastLineBreak = index;
                index = label.Text.IndexOf(' ', index + 1);
                if (index == -1)
                    break;
                if ((i + 1) % 2 == 0 && index - lastLineBreak > 4)
                {
                    label.Text = label.Text.Remove(index, 1);
                    label.Text = label.Text.Insert(index, Environment.NewLine);
                }
            }
        }

        public static void FitLabelToBounds(Label label, AutoFit autoFit)
        {
            if (label.Width <= 0 || label.Height <= 0)
                return;

            FontCalc lowerFontCalc;
            FontCalc upperFontCalc;

            if (autoFit == AutoFit.Width)
            {
                lowerFontCalc = new FontCalc(label, 10, label.Height, AutoFit.Width);
                upperFontCalc = new FontCalc(label, 100, label.Height, AutoFit.Width);
            }
            else
            {
                lowerFontCalc = new FontCalc(label, 10, label.Width, AutoFit.Height);
                upperFontCalc = new FontCalc(label, 100, label.Width, AutoFit.Height);
            }


            while (upperFontCalc.FontSize - lowerFontCalc.FontSize > 1)
            {
                // Get the average font size of the upper and lower bounds.
                double fontSize = (lowerFontCalc.FontSize + upperFontCalc.FontSize) / 2;


                FontCalc newFontCalc = (autoFit == AutoFit.Width) ? new FontCalc(label, fontSize, label.Height, AutoFit.Width) : new FontCalc(label, fontSize, label.Width, AutoFit.Height);
                if (newFontCalc.TextBound > ((autoFit == AutoFit.Width) ? label.Width : label.Height))
                {
                    upperFontCalc = newFontCalc;
                }
                else
                {
                    lowerFontCalc = newFontCalc;
                }
            }

            label.FontSize = lowerFontCalc.FontSize;
    }
}

There are 2 problems with the layout, which I can't solve:
1. The smaller label gets cut on smaller devices (below 4 inches)
2. The bigger label doesn't fit - the font is too big. My FitLabelToBounds method in FontCalc class doesn't seem to work properly in this case, although it works fine in another layout.
3. The labels are too far away from each other on bigger devices.

Here's how the layout looks on a small phone (3.7 inches):


And on a big tablet (10.1 inches):

How can I fix that?

How to vertically scroll a list of horizontal collection view

$
0
0

l have 3 horizontal collectionviews list and the user needs to scroll to see the last view. How can l implement this in xamarin forms..Can l use scrollview with collectionview

master detail page override back button navigation

Leveraging vector graphics for UWP

$
0
0

Does a Xamarin Forms UWP app support vector graphics?

If yes, I have one in an SVG format. Does that work?

How does one incorporate a vector graphic file into the UWP part of the app?

Not seeing any documentation on this so asking here...

Adding an element to a listview in viewmodel

$
0
0

I am trying to make a tab page with a list view. I have two questions.
First) I am trying to make each page have a list view that receives Item source from list of view model. Do i add the elements directly to the list in view model or from the page?
Second) Is there a way to add an element form one page to another by clicking a button? (So like a button on scheduler adds the selected schedule to the personal agenda)
I've been researching and reaching out for help and actually even some folks helped me out, It seems not working. Should I use observable collection on model view or just a list and make it into observable class in each page? please help!


How can i update Datetime

$
0
0

MODEL

`public class TDORDERS : INotifyPropertyChanged

{

    public event PropertyChangedEventHandler PropertyChanged;

    [PrimaryKey, AutoIncrement]

    public int TDId { get; set; }

    public DateTime? _tddate { get; set; }

public DateTime? TD_DATE

    {

        get { return _tddate; }

        set

        {

            if (_tddate == value)

                return;

            _tddate = value;

            OnPropertyChanged();

        }

    }

private void OnPropertyChanged([CallerMemberName] string propertyName = null)

    {

        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));

    }

}`

** How can i update TD_DATE with current datettime corresponding to TDId **

Geolocation.GetLastKnownLocationAsync() makes the app to crash

$
0
0

Hello,

I need to get device location in Xamarin.Forms application or iOS.

I have added 'Location When In Use Usage Description' key in info.plist, and in shared project, I am calling this:

await Geolocation.GetLastKnownLocationAsync();

That instruction makes the app to crash. This is in the log:

=================================================================

Native Crash Reporting

Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries

used by your application.

=================================================================

Basic Fault Adddress Reporting

Memory around native instruction pointer (0x1bfd920dc):0x1bfd920cc fd 7b c1 a8 c0 03 5f d6 10 29 80 d2 01 10 00 d4 .{......)......
0x1bfd920dc c3 00 00 54 fd 7b bf a9 fd 03 00 91 55 d6 ff 97 ...T.{......U...
0x1bfd920ec bf 03 00 91 fd 7b c1 a8 c0 03 5f d6 90 29 80 d2 .....{....
..)..
0x1bfd920fc 01 10 00 d4 c3 00 00 54 fd 7b bf a9 fd 03 00 91 .......T.{......

=================================================================

The shared code works perfectly in Android.

What is it going on?

As a final fact. That call is made in the event that is called when a QR code was read.

Thanks

Jaime

why is not view showing in the code below

$
0
0

why is my the label and collectionview not showing in the codd below.

<StackLayout >
 <Label Text="New &amp; Trending"        
        HorizontalTextAlignment="Center" 
        TextColor="Black"
        FontAttributes="Bold"/>        
<CollectionView ItemsSource="{Binding sliders}" 
                VerticalOptions="EndAndExpand">
    <CollectionView.ItemTemplate>
        <DataTemplate>
            <Grid Padding="10">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Image Grid.RowSpan="2"
                       Source="{Binding Url}"
                       Aspect="AspectFill"
                       HeightRequest="60"
                       WidthRequest="60" 
                       Grid.Row="0"/>              
            </Grid>
        </DataTemplate>
    </CollectionView.ItemTemplate>
</CollectionView>    
  </StackLayout>

Clearing the navigation stack

$
0
0

Hi,
i am using the prism frame work in xamarin forms. when i am navigating one page to another page all the previous pages adding in to the navigation stack, can any one suggest how can we clear the previous pages from the navigation stack.

Advance Thanks,
Vijay

Set background color in image when click camera

$
0
0

Hello Developers,

I want to set background color of image when take image from gallery or take photo from camera.
i have some issue, when i set background color of content page is black and take transparency image from gallery, image have text color black after that not show anything because content page and image text color is black.

This is my take image code :

private async void ImageTapped(object sender, EventArgs e)
        {
           string action = await UserDialogs.Instance.ActionSheetAsync("PickPhoto", "Cancel", null, null, "Take Photo", "Pick From Gallery");
           MediaFile file = null;
           if (action == "Take Photo")
           {
               await CrossMedia.Current.Initialize();
               if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
               {
                   UserDialogs.Instance.Alert("No Camera", ":( No camera avaialble.", "OK");
                   return;
               }
               file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
               {
                   PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium,
                   Directory = "Sample",
                   Name = "test.png"
               });
           }
           else if (action == "Pick From Gallery")
           {
               if (!CrossMedia.Current.IsPickPhotoSupported)
               {
                   UserDialogs.Instance.Alert("PhotosNotSupported", "PermissionNotGrantedToPhotos.", "OK");
                   return;
               }
               else
               {
                   file = await CrossMedia.Current.PickPhotoAsync(new PickMediaOptions
                   {
                       PhotoSize = PhotoSize.Medium
                   });
               }
           }
           else
           {
               return;
           }
           if (file == null)
               return;
            Stream s = file.GetStream();
           RestaurantImage.Source = ImageSource.FromStream(() =>
           {
               file.Dispose();
               return s;
           });
        }
Viewing all 77050 articles
Browse latest View live


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