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

Remote Push Notification Not occuring

$
0
0

I am following step by step, and exactly copying the code provided in the following tutorial:

https://developer.xamarin.com/guides/cross-platform/application_fundamentals/notifications/android/remote_notifications_in_android/

but still I'm not able to get the push notifications, and I don't get any errors. Any clue on this?

here is my file :

    <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.pushnotify.android" android:installLocation="auto">
        <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="com.pushnotify.permission.C2D_MESSAGE" />
        <permission android:name="com.pushnotify.android.permission.C2D_MESSAGE" android:protectionLevel="signature" />
        <application android:label="AJ" android:icon="@drawable/icon">
            <receiver android:name="com.google.android.gms.gcm.GCMReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
                <intent-filter>
                    <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                    <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                    <category android:name="com.pushnotify.android" />
                </intent-filter>
            </receiver>
        </application>
        <uses-sdk android:minSdkVersion="17" android:targetSdkVersion="17" />
     </manifest>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please help I am struggling in push notification from 4 days,  :'(   Thanks in advance.

MasterDetailPage - Bar at the top of the Detail's Page

$
0
0

Hi,
In my project, i made a Master Detail Page with a Detail page, but on this page, i have a bar a the top and i don't know why.
Does anyone already had this problem ?

Thanks !

How to transform secondary ToolbarItems to UIBarButtonItems in the bottom toolbar on iOS?

$
0
0

First of all, I think the ToolbarItems in Forms are the right approach to have a generic abstraction to the platform specific actions users can execute on each platform. Furthermore, the Android implementation today looks fine to me. The iOS implementation though renders the bar right beneath the UINavigationBar of the UINavigationController and not (as it is common sense on iOS) at the bottom of the screen.

So I tried to transform the secondary navigation items into UIBarButtonItems before rendering the screen and then place them the UIToolbar of the NavigationController my view stack is embedded in.

Unfortunately I was not able to have it render properly so far. The toolbar seems to be rendered fullscreen and even manually changing its frame does not have an impact on its size.

Here is my current solution apporach:

The page, which has secondary Toolbaritems (and hence should display a UIToolbar) inherits from a ToolbarAwarePage for which I export a custom renderer on iOS. The listing shows an attempt using viewWillAppear as viewDidLoad is too early to access the NavigationController (still null).

`

public class ToolbarAwareRenderer : PageRenderer
{
    public override void ViewWillAppear (bool animated)
    {

        base.ViewWillAppear (animated);

        // remove the toolbar items from the page
        var page = App.NavigationPage.CurrentPage;
        var secondaryToolbarItems = new List<ToolbarItem> (page.ToolbarItems.Where (item => item.Order == ToolbarItemOrder.Secondary));
        foreach (var toolbarItem in secondaryToolbarItems) {
            page.ToolbarItems.Remove (toolbarItem);
        }

        var formsToolBarItemArray = secondaryToolbarItems.ToArray ();
        var numberOfItems = formsToolBarItemArray.Length;

        if (numberOfItems != 0) {
            var nativeToolBarItemArray = new UIBarButtonItem[numberOfItems];
            // Add each secondary toolbaritem as a UIBarButtonItem to the UIToolBar of the underlying UINavigationController

            for (var itemIndex = 0; itemIndex < numberOfItems; itemIndex = itemIndex + 1) {
                UIBarButtonItem barButtonItem = formsToolBarItemArray [itemIndex].ToUIBarButtonItem ();
                nativeToolBarItemArray [itemIndex] = barButtonItem;
            }

            SetToolbarItems (nativeToolBarItemArray, false);
            NavigationController.SetToolbarHidden (false, false);

        }
    }
}

`

I also tried to do this transformation in a custom renderer for the NavigationPage itself (using the OnPushAsync(...) and PushViewController(...) methods), but the result was similar to the one of the approach here.

In general, I think that the Xamarin Team has forseen somethink like this because there is the public ToolbarItem.ToUIBarButtonItem() method, which I use.

Any help or suggestions are appreciated.

Thanks,
Sven

Hide the toolbar items in windows phone with xamarin forms

$
0
0

Hello

I have a class that inherits fomr contentPage, that contains a ToolbarItem:

if (Device.OS == TargetPlatform.WinPhone)
            {
                toolbarItem = new ToolbarItem("Add", "add.png", () =>
                {
                }, 0, 0);
            }

            ToolbarItems.Add(toolbarItem);

In my OnAppearing and OnDissapearing methods i have:

protected override void OnAppearing()
        {
            base.OnAppearing();
            SetToolbarItems(true);
        }

        protected override void OnDisappearing()
        {
            base.OnDisappearing();
            SetToolbarItems(false);
        }

private void SetToolbarItems(bool show)
        {
            if (Device.OS != TargetPlatform.WinPhone)
                return;

            if (show)
            {
                ToolbarItems.Add(toolbarItem);
            }
            else
            {
                ToolbarItems.Remove(toolbarItem);
                ToolbarItems.Clear();
            }
        }

The toolbar items appear when I navigate to this view but when I go back to my mainView (which is a view that also inherits from contentPage) the toolbaritems bar is still there is still showed, How can I hide the toolbar?

Is it possible to apply common toolbar across multiple pages in Xamarin Forms PCL?

$
0
0

Hi all, I have an app that have multiple pages and I want to apply a common toolbar of 4 toolbaritems(icons) to all those pages.
Can u please help me to solve this issue. Thanks in advance.

How to add image in navigation bar (Title bar) in xamarin.forms

$
0
0

Hi,

How to add image in navigation bar (Title bar) in xamarin.forms?

Subtitle on a Toolbar Xamarin Forms

$
0
0

We are developing an application that needs a subtitle in the toolbar. The title also needs to be set when the application is running as it can change. Have had a search around and can not find anything that works. Does anyone have any solutions that achieve this?

Thanks

Item Appearing event of list view not working correctly in xamarin.forms

$
0
0

Hi

I have a list view in a page and pagination implemented in it .

The concept of item appearing event is the event will fire only when the particular list cell appears in the screen . But in my case i have done pagination for 100 items and initially in my ipad i can see 4 items and when i scroll up i could see the below cells and only if the last cell appears on the screen api call should go to fetch next 100 items.But here on loading the page itself the item appearing event is firing for all 100 items before i scroll.Why is it happening?

async void LoadingPaginationListItems(object Sender, ItemVisibilityEventArgs e)
{

        ObservableCollection<demo> ListItems = (ObservableCollection<demo>)ListView.ItemsSource;
        var item = (demo)e.Item;

        if (item != null && ListItems.Last().SampleNo.Equals(item.SampleNo)
            && (ListItems.Count >= 100))
        {
            DemoPageModel obj = new DemoPageModel();
            var result = await obj.PaginationListItems();  //api call
            foreach (var lsItem in result)
            {
                ListItems.Add(lsItem);
            }

          ListView.ItemsSource = ListItems;
            _userDialogs.HideLoading();
        }


    }

Please help me to solve this....


Remove Circle Item from Windwos Phone when using MasterDetailPage

$
0
0

I am using MasterDetailPage for showing the Menu in Xamarin its work well with Android but in Windows Phone its showing in another manner
Can we have any Menu control which behave same in all platforms
Or its possible to replace or remove the circle button which appear on Windows Phone

Please look
into attached image for same

[PRISM] Carousel Page Binding ItemsSource

$
0
0

Hello guys,

I'm trying to bind a CarouselPage.ItemsSource but i only got a result when the list is populate on the constructor.
I read this in Xamarin Documentation:
"The CarouselPage is populated with data by setting the ItemsSource property in the constructor for the code-behind file"
We can only bind itemsSource on the constructor?
I need to bind items in the OnNavigatedTo methods (PRISM MVVM) :neutral:

XAML:

<?xml version="1.0" encoding="utf-8" ?>
<CarouselPage xmlns="http://xamarin.com/schemas/2014/forms"
              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
              xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
              prism:ViewModelLocator.AutowireViewModel="True"
              x:Class="APP.Views.Manager.Needs"
              ItemsSource="{Binding Pages}">

    <CarouselPage.ItemTemplate>
        <DataTemplate>
            <ContentPage BackgroundColor="Red">
                <Label Text="Hello world!"/>
            </ContentPage>
        </DataTemplate>
    </CarouselPage.ItemTemplate>

</CarouselPage>

ViewModel:

    public ObservableCollection<ContentPage> Pages { get; private set; }

    public async void OnNavigatedTo(NavigationParameters parameters)
    {
        List<ContentPage> ContentPages = new List<ContentPage>();
        ContentPages.Add(new ContentPage());
        Pages = new ObservableCollection<ContentPage>(ContentPages);
    }

Best regards

Implement 'Done' button in Nemeric Keyboard for Windows Phone

$
0
0

Hi

I am new in Xamarin and creating the App which run on Android / IOS / WP
How we achieve the rendering for Entry control in WP
I am using the numeric keyboard its work fine with Android but I want to implement 'Done' button in Numeric keyboard for Windows Phone.

Thanks

Get x,y co-ordinates in tap gesture inside ListView

$
0
0

How do we get the y coordinate based on where the “tap gesture” inside a listview? I have an image with “tap Gesture” event in one of the columns in a listview. The X value in “click” event on “sender” object inside the clicked event is correctly populated. But the “Y” is always “0”. Most likely because the list view scrolls and “Y’ position always changes. Any workarounds for this?
Thx much..

Image clicked (ImageButton)

$
0
0

Hi. Help me pls do it normally imagebutton or say me any solution for my problem.

<Grid RowSpacing="3">
            <Grid.RowDefinitions>
              <RowDefinition Height="20"></RowDefinition>
              <RowDefinition Height="30"></RowDefinition>
              <RowDefinition Height="15"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="2*"></ColumnDefinition>
              <ColumnDefinition Width="5*"></ColumnDefinition>
              <ColumnDefinition Width="1*"></ColumnDefinition>
              <ColumnDefinition Width="1*"></ColumnDefinition>
              <ColumnDefinition Width="1*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Image Source="foot.png"  Aspect="AspectFit" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"  Grid.Column="0" Grid.Row="0" Grid.RowSpan="2"/>
            <Label Text="" TextColor="#049BD2" FontSize="16" Grid.Column="1" Grid.Row="0"  />
            <Label Text="Lorem Ipsum is simply dummy text of the printing and typesetting." FontSize="10" Grid.Column="1" Grid.Row="1" Grid.RowSpan="2"/>
            <controls:ImageButton Clicked="button1" Source="add.png" BackgroundColor="Black" Grid.Row="1" Grid.Column="2"/>
            <controls:ImageButton Clicked="button2" Image="discussions.png" BackgroundColor="Black" HeightRequest="30" WidthRequest="30" ImageHeightRequest="30" ImageWidthRequest="30" Grid.Row="1" Grid.Column="3"/>
            <controls:ImageButton Clicked="button3" Source="group.png" BackgroundColor="Black" HeightRequest="30" WidthRequest="30" Grid.Row="1" Grid.Column="4"/>
            <Label Text="2200"  VerticalOptions="Start" HorizontalOptions="Center" HorizontalTextAlignment="Center" FontSize="10" TextColor="#049BD2" Grid.Row="2" Grid.Column="3"/>
            <Label Text="13"  VerticalOptions="Start" HorizontalOptions="Center" FontSize="10" HorizontalTextAlignment="Center" TextColor="#049BD2" Grid.Row="2" Grid.Column="4"/>
          </Grid>

I want that my images have center position in grid cell. I do background black special.

How to create a well structured Xamarin App with on-line databank

$
0
0

Hello,

I'm starting the mobile development now, and I need your help to show me the right way to develop a well-structured app, considering that it will need an on-line data base, and it will be accessed by lots of people at the same time. It’s also important to say that the users will access the google maps/GPS through the app to get locations. I hope you can alert me about the proper procedures, I don't want to develop an unstable app, so i'd like to have some articles or other kind of information about app development with on-line data base in Xamarin.

hope I were clear!

Best practices for Login/Logoff

$
0
0

My app needs to consume a REST Service which has Authentication built into it. Once I logon, I will get a token that expires. I am using Xamarin.Auth to store the username and password. Is this the intended purpose of Xamarin.Auth?

What is the best practice to check for the idle time on the app and log the user off? and what is the industry standard for idle time?


Xamarin Bug: "java.lang.IllegalStateException: Unable to create layer for "

$
0
0

Hi,

I think there is a bug in Xamarin Forms:

  1. Environment:
  • Device: Samsung galaxy S7.
  • Adroid OS: 6.01
  • Xamarin Studio: 6.1.3
  • Xamarin Forms: 2.3.3.180
  1. Sample Code:

                            <Grid
                                x:Name  ="CountProduct"
                                IsVisible        ="false"
                                VerticalOptions  ="End"
                                HorizontalOptions="End"
                                Margin           ="0, 0, 20, 20"
                                HeightRequest    ="25"
                                InputTransparent ="true">
                                <ContentView
                                    InputTransparent="true"
                                    HeightRequest   ="25"
                                    BackgroundColor ="Black"
                                    Opacity         ="0.4">
                                </ContentView>
    
                            </Grid>
    
  2. Description:

  • "java.lang.IllegalStateException: Unable to create layer for " error happened when IsVisible = "false". There are so many case similar that.

  • If inner controller is ContentView, message : Unable to create layer for Platform_DefaultRenderer

  • if inner Controller is CustomController, CustomControllerRender implement VisualElementRenderer. Message : Unable to create layer for CustomControllerRender

My app so big and there are many code that dropped in this bug. If i try to fix all to avoid this bug, my app will become to be unmanaged.
Please help me!

On clicking editor , editor get focus.

$
0
0

I am using editor to enter text and place this editor at bottom when tap on editor default keyboard took whole place and cant see what are typing. I want to scroll to editor when user tap on editor. I am using editor.focus but didnt get the desired result.

MasterDetailPage Fixed icon menu

$
0
0



Hi, they have some idea how to leave the icon of the hamburgesa fixed, while navigating to the pages of the menu, of my main page, the images illustrate a little the effect that I want to bind instead of the icon to return back. That is the one of the hamburger.

Thanks in Advance

FireBase Messaging is not yet resolved

$
0
0

Dear Xamarin lovers. I am unable to install the Xamarin.Firebase.Messaging version 42.1001.0-beta2 in xamarin forms.
please resolve this error and help to me 1. * 1. * #
Severity Cod Description Project File Line Suppression State Error
Unable to find a version of 'Xamarin.GooglePlayServices.Basement' that is compatible with 'Xamarin.Firebase.Common 42.1001.0-beta2 constraint: Xamarin.GooglePlayServices.Basement (= 42.1001.0-beta2)', 'Xamarin.Firebase.Iid 42.1001.0-beta2 constraint: Xamarin.GooglePlayServices.Basement (= 42.1001.0-beta2)', 'Xamarin.Firebase.Messaging 42.1001.0-beta2 constraint: Xamarin.GooglePlayServices.Basement (= 42.1001.0-beta2)', 'Xamarin.GooglePlayServices.Base 29.0.0.2-beta1 constraint: Xamarin.GooglePlayServices.Basement (= 29.0.0.2-beta1)', 'Xamarin.GooglePlayServices.Gcm 29.0.0.2-beta1 constraint: Xamarin.GooglePlayServices.Basement (= 29.0.0.2-beta1)', 'Xamarin.GooglePlayServices.Iid 42.1001.0-beta2 constraint: Xamarin.GooglePlayServices.Basement (= 42.1001.0-beta2)', 'Xamarin.GooglePlayServices.Measurement 29.0.0.2-beta1 constraint: Xamarin.GooglePlayServices.Basement (= 29.0.0.2-beta1)', 'Xamarin.GooglePlayServices.Tasks 42.1001.0-beta2 constraint: Xamarin.GooglePlayServices.Basement (= 42.1001.0-beta2)'.

i am tried from github firebase samples also. but its taking 1 month time a go but not resolved please help me to resolve this error as soon as possible
and one more request xamarin forums also no one cannot give solution for fire base messaging

What would cause Java.Lang.OutofMemory exception after multiple PopAsync and Back calls?

$
0
0

I have a couple of pages with different information that is all driven from a GridLayout. After going to couple of different pages I get an Unhandled Exception.

Java.Lang.OutOfMemoryError: Failed to allocate a 12538892 byte allocation with 4025888 free bytes and 3MB until OOM

Viewing all 91519 articles
Browse latest View live


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