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

Permission for Android not prompting user for permission

$
0
0

Hi All

I am using Geolocator Plugin as well as Permissions Plugin from James Montemagno.

The issue i am facing is that on Android it is not prompting a user for permission to get Location, on iOS it works fine. Below is code extracts:

try
{
var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Location);
if (status != PermissionStatus.Granted)
{
if (await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Permission.Location))
{
await DisplayAlert("Need location", "Gunna need that location", "OK");
}

                var results = await CrossPermissions.Current.RequestPermissionsAsync(new[] { Permission.Location });
                status = results[Permission.Location];
            }

            if (status == PermissionStatus.Granted)
            {
                var results = await CrossGeolocator.Current.GetPositionAsync(TimeSpan.FromMilliseconds(10000));
                         latLable.Text = results.Latitude.ToString();
                         lonLable.Text = results.Longitude.ToString();
            }
            else if (status != PermissionStatus.Unknown)
            {
                await DisplayAlert("Location Denied", "Can not continue, try again.", "OK");
            }
        }
        catch (Exception ex)
        {

                     await DisplayAlert("Error", ex.Message,"OK");
        }

I have also added the below to my Main activity:

public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
{
    PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}

I have also added the below permissions to AndroidManifest:
uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"

I am targeting Android 7.1

Currently I have to go into my phones Setting>App>MyApp and manually set the permissions.

I have read many forums and my implementation looks correct.

One Forum suggested i should target Android 6, but i am struggling to retarget my Packages when I do this.


How to open pdf files inside my app in web view sung xamarin forms?

$
0
0

Hi all,I am developing an app which enables the user to select a pdf file from his mobile.Then the pdf file should be displayed in webview.I installed plugin CrossFilePicker to pick up a file from mobile.From that I am getting file byte array,File path and File name.By using the path i am not able to display the pdf in webview.Please provide any solution.Below is the code i used to implement.Is there anything wrong?

private async void OnAddClicked(object sender,EventArgs e)
{
try
{

            FileData fileData = new FileData();
            fileData = await CrossFilePicker.Current.PickFile();
            byte[] data = fileData.DataArray;
            string name = fileData.FileName;
            string path = fileData.FilePath;
            Stream stream = fileData.GetStream();

            name = name.Substring(name.Length - 3);
            if (name != "pdf")
            {
                await DisplayAlert("Sorry", "Other than pdf files are not supported", "Ok");
                return;
            }
            else
            {
                WebPage.Source = path;
            }
        }
        catch (Exception ex)
        {
        }
    }~~~~

App Store Rejected - Wi-Fi connected to an IPv6 network

$
0
0

Hi guys,

I have a problem, Im trying to publish my app on app store(apple), but it is being rejected.

We discovered one or more bugs in your app when reviewed on iPhone running iOS 9.3.4 on Wi-Fi connected to an IPv6 network.
Please run your app on a device while connected to an IPv6 network (all apps must support IPv6) to identify the issue(s), then revise and resubmit your app for review.
_

I know that aple started enforcing a new policy whereby all iOS applications must support IPv6-only network services in iOS 9. While Apple states that most apps will not need to be changed or updated, your app may be using a few libraries that need to be updated before you submit your next update.

But im using httpclient to a server with no hard coded IP.. and i have this problem now..

Do you guys know how to help me?
Is it a Xamarin Bug?

Im using HttpClient

string uri = "https://example.azurewebistes.net/api/example"

HttpClient client = new HttpClient();
 var response = await client.GetAsync(uri);

Relevant link
https://developer.apple.com/library/mac/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html#//apple_ref/doc/uid/TP40010220-CH213-SW1
https://blog.xamarin.com/making-your-ios-apps-ipv6-ready/

__The print anexed is from app review

Xamarin.Forms version: 2.3.0.46

How to Implement Shopping Cart in Xamarin.Forms ?

$
0
0

Hi Folks,
I have to Implement shopping cart in xamarin forms app. I've never worked with Shopping cart stuff before that's why asking for suggestions here. I have a products screen where all the products are listed. Another page for Specific Product's details page that shows description, price and useful info about a specific product with "Add to Cart" button in it. Now, I want to:
1- Have a cart Icon on navigation bar that shows a number indicating how many products are there in the cart at the moment. How increment to cart icon will work ?
2- Add Multiple products in the cart (An order having multiple items).
3- Update , delete items from the cart.

I have no knowledge of how things will work in the database for shopping cart thing. Do I need to create a specific table for shopping cart? Kindly give your valuable suggestions /links on how should I implement it ?
Thanks

Remove Navigation Bar Shadow/Line

$
0
0

I'd like to remove the line separating the navigation bar from the rest of the page in iOS.

Problem with MasterDetailPage

$
0
0

Hello.

I implemented MasterDetailPage into my app, but on Windows 10 the behavior seems a bit weird.
When the app starts, the menu is showing as expected. But when I click an item, it disappears with no way to go back or show the menu again.

It's simple to reproduce.. Download the sample: https://github.com/xamarin/xamarin-forms-samples/tree/master/Navigation/MasterDetailPage
Run the UWP app on Windows 10 and click any menu item. Now you're stuck on that page, with no way to navigate further.

How to personalize Arrows of BindablePicker.

$
0
0

I need to personalize arrow of a BindablePicker, but no idea how to do it, i've already searched about but, nothing has helped me...
i want to change the colors of specific items...
Someone have any idea ?

Header and Footer

$
0
0

How to use header and footer in xamarin Form and how to navigate to other screen .


Xam.Plugin.Media from Camera screen back shows black screen in android

$
0
0

Hi ,
In my xamarin form project i have a camera functionality implemented using Xam.Plugin.Media package as a custom renderer from android project. All operations works as expected but small issue when i press back button while camera is open first it shows the black screen. Is anybody has faced the same issue? Any workaround/Solution?
I'm using Xam.Plugin.Media version 2.6.0
Xamarin.Form version 2.3.2.127

StatuaBar color without navigationbar

$
0
0

Hi,

I want to change to status bar color (The bar, where the clock and battery status is located).

This is my Code, where the different tabs are defined.

var homeNavigation = new NavigationPage(new Home());
homeNavigation.SetValue(NavigationPage.BarBackgroundColorProperty, Color.Black);
homeNavigation.BarBackgroundColor = Color.Black;
homeNavigation.BackgroundColor = Color.Black;

homeNavigation.Title = "Home";

For reasons, I disabled the NavigationBar NavigationPage.SetHasNavigationBar(this, false);.

Is it possible to change to status bar color without the navigation bar? And how?

If I enabled the status bar it worked successfully.

Thanks for your help!

Connect to an online DataBase with a REST service

$
0
0

I would like to know what are the exact steps of connecting to an online Database with a REST service.
When I say exact steps I mean EXACT steps, how do I create the REST service, how do I make it be online so it can be accessed from multiple devices etc.
Thanks in advance,
Dvck

Config files in android and iOS

$
0
0

Hello:

I've been trying to make a Configuration for a few days but it always gives me an error. The code I use is the following:

** private static Boolean UpdateSetting (String key, object value,Boolean nuevo)

     {

       {

         Configuration cfg = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

         cfg.AppsSettings.Settings.Remove(key);

         if(nuevo == true)

            cfg.AppSettings.Settings.Add(key, value.ToString());

         cfg.Save();

     System.Configuration.ConfigurationManager.RefreshSection(cfg.AppSettings.SectionInformation.Name);

     return true;

   }

 return false;

}**

This code gives me a huge error when it reaches the first line:

**"Could not load type of field 'System.Configuration.TypeUtil: s_aspNetHostingPermision'(2) due to: Could not resolve type with token 0100009e (from typeref, class/assembly System.Web.AspNetHostingPermission, System, version=4.0.0.0, culture=neutral, public key token= b77a50561934e089) assembly: System, version= 4.0.0.0, culture= neutral, public key token = b77a50561934e089 type: System.Web.AspNetHosting Permission member:."
**
Someone can help me correct this error.

Thanks in advance****

What is a Xamarin Component?

$
0
0

I ran across this page today: https://components.xamarin.com/

It's missing one key piece, which is a brief explanation of the noun 'Component'.

So.... what is a Xamarin Component, what is it for, and how can it be used? I can infer from the downloads page that it's something like a Wordpress Plugin, and when I go to one of them, I see a 'Download' button. When I click that button, it downloads a .zip file... but how do I actually get my project to use it? I don't see any Nuget commands or anything like that, so I assume it's not Nuget-compatible, which leaves me unsure of how I can actually use any 'Components' I download (assuming, of course, that I'm inferring correctly and these are things that my project should be able to Reference).

If this is already on the Components website somewhere, sorry for having missed it, but if you could point it out to me, I'd appreciate it.

Xamarin RealTime Messaging

$
0
0

Dears ,

i am new developer in xamarin coming from asp.net mvc platform.

I would like to know what is the best way to create real time messaging having one application that can send and receive messages

to other devices that have the same app , is there references documentation Guiding to how to implement it?

appreciate your time

Sticky Header Listview

$
0
0

Is possible sticky header listview in xamarin forms?


Using CarouselView in UWP crashes

$
0
0

Hello,
using CarouselView from XF 2.3.1.114 in an UWP app (constructed using XAML) just crashes without trace.
Is anybody else having the same issue?
Regards, Sascha

Sticky Header Listview

$
0
0

Is possible sticky header listview in xamarin forms?

How to retrieve a dynamic entry box value?

$
0
0
    <ListView ItemsSource="{Binding DataReceived}" Grid.Row="0" WidthRequest="100" x:Name="entryListView">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell >
                        <ViewCell.View x:Name="entryViewCell">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="4*" />
                </Grid.ColumnDefinitions>

                            <Label x:Name="{Binding Key}" Grid.Column="0"  Text="{Binding Value}" FontSize="14"  FontAttributes="Bold" TextColor="Black"  >
                                </Label>
                                <Entry  x:Name="entryValue"   Grid.Column="1" Placeholder="{Binding Value}" IsVisible="{Binding pickerVisible, Converter={StaticResource BooleanNotConverter}}" FontSize="14"  FontAttributes="Bold" TextColor="Black" ></Entry>
                                <Picker x:Name="pickerValue"   Grid.Column="1"  IsVisible="{Binding pickerVisible}"  ItemsSource="{Binding PredefinedItems}"   >

                                </Picker>


            </Grid>
                            </ViewCell.View>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>


            <ListView.Footer>
                <Label />
            </ListView.Footer>
        </ListView>

How to disable swipe gesture on pushed page.

$
0
0

I have a detail page, which is pushed onto the navigation stack:

    listView.ItemTapped += (sender, args) =>
        {
            if (listView.SelectedItem == null)
                return;
            var content = listView.SelectedItem as Content;

            var page = new ArticleView(content)
            {
                Title = string.Format("{0}", content.Title)
            };

            Navigation.PushAsync(page);
            listView.SelectedItem = null;
        };

The page that is pushed, is basically an ContentPage. How can I disable the swipe from the popped the view of the stack? My ScrollView on this page isn't reacting because the gesture is captured by the navigation page (I guess).

Picker done button in Xamarin.Forms iOs

$
0
0

Good day. It's probably simple question, but I can't find an answer for it. So in my PCL project I use picker. And the only problem I got is a language of it. In Droid part it's ok. But on iOs the text of choose button is "done" - at English. The title property is correct - native language, the items are correct, though they contains strings at native language. But the text on the button user should push to make a choice is in English, though native for device is Russian. So is it possible to change this text to Russian from PCL project, or the only way is to create a custom renderer? In Droid all text is Russian, so may be I just need to change some cultural options?

Viewing all 81910 articles
Browse latest View live


Latest Images

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