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

Push for Ad-Hoc (production) release - aps-environment *still* always resetting to development

$
0
0

Hi,

Xamarin Forms Project (Windows 10)
Visual Studio 2017 Version 15.6.4
Connected to Mac High Sierra over Network

My app deployed to my iOS device perfectly in development, and push notifications work fine.

I created a new certificate for iOS Distribution.
I created a new certificate for Apple Push Services.
I created a new provisioning profile (distribution)
Downloaded everything into Xcode on the mac.

I am trying to build (Visual Studio 2017) Ad-Hoc build, with IPA, so that I can deploy it via AppLoader to itunesconnect and set it up in TestFlight.

I am building this Ad-Hoc with the Distribution Signing identity and Provisioning Profile.

No matter what I do, in the file Entitlements.plist, the value of aps-environment changes to development, and to appLoader refuses to upload the IPA.

Help? Am I doing something obviously wrong here?

Thanks


Geolocator only works after exiting and re-entering app

$
0
0

The Xamarin.Forms application I'm working on is trying to prompt the user for location permissions on initial app startup, and then get their GPS position afterwards. iOS works fine, but when it runs on Android the permission prompt appears, the user clicks "allow," and then the CrossGeolocator.Current object says that the IsGeolocationAvailable and IsGeolocationEnabled properties are false. When the user closes and reopens the app, both are enabled. Is there a way for the CrossGeolocator.Current to recognize that it just got location permissions and that it should update?

What I've got so far:

Geolocator Plugin v3.0.4
Android Target v25

ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION set in Manifest

Current activity set in MainActivity's OnCreate:

Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity = this;

OnRequestPermissionsResult handler in MainActivity:

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

Prompts user for location permissions and then gets GPS position:

using Plugin.Geolocator;
using Plugin.Geolocator.Abstractions;
using Plugin.Permissions;
using Permissions = Plugin.Permissions.Abstractions;
using Xamarin.Forms;
.
.
.
    System.Threading.Tasks.Task.Factory.StartNew(
                    async () =>
                    {
                        await CheckAndEnableGeoLocatorPermissions();
                    });

                if (CurrentGeoLocator.IsGeolocationAvailable
                    && CurrentGeoLocator.IsGeolocationEnabled)
                {
                    CurrentGeoLocator.GetPositionAsync(TimeSpan.FromSeconds(Constants.IntervalTime.GetGeoLocatorCurrentPosTimeOut)).ContinueWith(
                        x =>
                        {
                            CurrentPosition = x.Result;
                        });
                }
.
.
.__
private async System.Threading.Tasks.Task CheckAndEnableGeoLocatorPermissions()
        {
            try
            {
                var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Permissions.Permission.Location);
                if (status != Permissions.PermissionStatus.Granted)
                {
                    var results = await CrossPermissions.Current.RequestPermissionsAsync(Permissions.Permission.Location);
                    //Best practice to always check that the key exists
                    if (results.ContainsKey(Permissions.Permission.Location))
                    {
                        status = results[Permissions.Permission.Location];
                    }
                }

                if (status != Permissions.PermissionStatus.Granted && status != Permissions.PermissionStatus.Unknown)
                {
                    Device.BeginInvokeOnMainThread(() => UserDialogs.Instance.Alert(
                        Text.Error_LocationPermissionDenied));
                }
            }
            catch (Exception ex)
            {
                Device.BeginInvokeOnMainThread(() => UserDialogs.Instance.Alert(ex.Message));
            }
        }

Exception while loading assemblies: netstandar issue!

$
0
0

Hi everyone,

I am working on a project and a couple of days ago, I have not been able to execute the application since it sent me the following error:

Error Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'netstandard.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(DirectoryAssemblyResolver resolver, ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
at Xamarin.Android.Tasks.ResolveAssemblies.Execute(DirectoryAssemblyResolver resolver) AnconApp.Android C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1413

I tried:
1. Update Visual Studio 2017 to the lastest version (15.6)
2. Update NugetPackage Components
3. Delete and reload NugetPackage Components
4. Install VS 2015 and build the app
5. Clear, build and rebuild the solution.

But nothing can delete the error.

Anybody have the same issue and solved?

Any Help?

Navigation Page in TabbedPage Open New Navigation Page cannot show BackButton

$
0
0

As title, i want to open a navigation page when navigation page listview in tabbedpage.
var home = new NavigationPage(new HomePageCS());
home.Title = "Home";
home.BarBackgroundColor = Color.White;
home.BarTextColor = Color.Black;

            var discover = new NavigationPage(new DiscoverPage());
            discover.Title = "Discover";
            discover.BarBackgroundColor = Color.White;
            discover.BarTextColor = Color.Black;

            var notification = new NavigationPage(new NotificationPageCS());
            notification.Title = "Message";
            notification.BarBackgroundColor = Color.White;
            notification.BarTextColor = Color.Black;

            var profile = new NavigationPage(new ProfilePageCS());
            profile.Title = "Profile";
            profile.BarBackgroundColor = Color.White;
            profile.BarTextColor = Color.Black;

            Children.Add(home);
            Children.Add(discover);
            Children.Add(notification);
            Children.Add(profile);


    var notification = new NavigationPage(new DetailPageCS(item));
                    notification.Title = "Message";
                    notification.BarBackgroundColor = Color.White;
                    notification.BarTextColor = Color.Black;
                    NavigationPage.SetBackButtonTitle(this, "Test");
                    NavigationPage.SetHasBackButton(notification, true);
    await Navigation.PushAsync(notification);
    await Navigation.PushModalAsync(new DetailPageCS(item));

Error: “com.facebook.sdk.login error 308” in Xamarin.Form

$
0
0

I am using Visual Studio 2017. I am trying to connect with Facebook using following code by not able to connect. Can any body please suggest me what I missing? I have tried many solution but none of them work.

public void LogInToFacebook()
{
    if (AccessToken.CurrentAccessToken == null)
    {
        ObtainNewToken(LogInToFacebook);
        return;
    }
}

Getting Error: The operation couldn’t be completed. (com.facebook.sdk.login error 308.)
private readonly string[] permissions = { "public_profile", "email", "user_birthday", "user_photos" };
private void ObtainNewToken(Action callback)
{
var login = new LoginManager();

        login.LogInWithReadPermissions(permissions, null, (r, e) =>
        {
            if (e == null && !r.IsCancelled)
                callback?.Invoke();
            else
                HandleError(e?.LocalizedDescription);
        });
    }

info.plist: Facebook Related content

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>myapp.com</key>
        <dict>
            <key>NSTemporaryExceptionMinimumTLSVersion</key>
            <string>TLSv1.0</string>
            <key>NSTemporaryExceptionRequiresForwardSecrecy</key>
            <false/>
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
        <key>facebook.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>fbcdn.net</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>akamaihd.net</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
    </dict>
</dict>

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbapi</string>
    <string>fbapi20130214</string>
    <string>fbapi20130410</string>
    <string>fbapi20130702</string>
    <string>fbapi20131010</string>
    <string>fbapi20131219</string>
    <string>fbapi20140410</string>
    <string>fbapi20140116</string>
    <string>fbapi20150313</string>
    <string>fbapi20150629</string>
    <string>fbauth</string>
    <string>fbauth2</string>
    <string>fb-messenger-api20140430</string>
    <string>fb-messenger-api</string>
    <string>fbshareextension</string>
</array>
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb90000000000</string>
        </array>
        <key>CFBundleURLName</key>
        <string>facebook</string>
    </dict>
</array>
<key>FacebookAppID</key>
<string>8000666666666</string>
<key>FacebookDisplayName</key>
<string>MyApp – Test</string>

Cocossharp in Xamarin forms

$
0
0

i have searched over the internet to learn about cocossharp game development, how the layer,objects,collision... works and other.

but i cant able to find ,i can see only the examples , in that example itself i can see lot of calculations and it was confusing me a lot..

please help me to learn about cocossharp

Native views and VS2017 intellisense not working

$
0
0

Today I found out about Native Views, awesome!
However, my intellisense is not working for this. It works fine except for inside the native xaml.

My xmlns declarations:

xmlns:ios="clr-namespace:UIKit;assembly=Xamarin.iOS;targetPlatform=iOS"
xmlns:androidWidget="clr-namespace:Android.Widget;assembly=Mono.Android;targetPlatform=Android"
xmlns:formsAndroid="clr-namespace:Xamarin.Forms;assembly=Xamarin.Forms.Platform.Android;targetPlatform=Android"
xmlns:win="clr-namespace:Windows.UI.Xaml.Controls;assembly=Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime;targetPlatform=Windows"

My xaml controls:

<ios:UISwitch On="{Binding Path=IsSwitchOn, Mode=TwoWay, UpdateSourceEventName=ValueChanged}"
                    OnTintColor="{x:Static ios:UIColor.Red}"
                    ThumbTintColor="{x:Static ios:UIColor.Blue}" />
<androidWidget:Switch x:Arguments="{x:Static formsAndroid:Forms.Context}"
                            Checked="{Binding Path=IsSwitchOn, Mode=TwoWay, UpdateSourceEventName=CheckedChange}"
                            Text="Enable Entry?" />
<win:ToggleSwitch Header="Enable Entry?"
                        OffContent="No"
                        OnContent="Yes"
                        IsOn="{Binding IsSwitchOn, Mode=TwoWay, UpdateSourceEventName=Toggled}" />

Intellisense stops after <ios: and the other platforms. It seems it can see the xmlns but not what's inside.

When I run the app it works great, I get different controls for each platform.
Im using VS2017, 15.3.4 and tested Xamarin.Forms 2.3.4.270 / 2.4.0.269-pre2 (nuget).

Anyone else experiencing this? Or is this just not supported?

Picker Renderer Affecting Behavior Without Any Additional Code

$
0
0

I was trying to apply a custom render to Picker when I realized the renderer affects the behavior of the Picker on Android platforms even without any additional code, i.e.

public class CustomPickerRenderer : PickerRenderer
{
    public CustomPickerRenderer(Context context) : base(context)
    {
    }
}

Without the renderer, the picker displays a full screen of options:

After renderer is applied, it looks like this:

Why is this the case and how can I apply a custom renderer while preserving the original behavior?


Set height in Toolbar xamarin froms

$
0
0

Hi i want to define Height in Toolbar, how hi can do this.

This is my code:

ContentPage.ToolbarItems >

<ToolbarItem Text="Botão 1" Clicked="OnClickButtonOne" Order="Secondary" />
<ToolbarItem Text="Botão 2" Clicked="OnClickButtonTwo" Order="Secondary" />
<ToolbarItem Text="Botão 3" Clicked="OnClickButtonThree" Order="Primary" Icon="cloud.png" />
<ToolbarItem Text="Botão 3" Clicked="OnClickButtonThree" Order="Primary" Icon="edit.png" />
<ToolbarItem Text="Botão 3" Clicked="OnClickButtonThree" Order="Primary" Icon="incomingmail" />
<ToolbarItem Text="Botão 3" Clicked="OnClickButtonThree" Order="Primary" Icon="list.png" />
<ToolbarItem Text="Botão 3" Clicked="OnClickButtonThree" Order="Primary" Icon="replayarrow.png" />
<ToolbarItem Text="Botão 3" Clicked="OnClickButtonThree" Order="Primary" Icon="settings.png" />
<ToolbarItem Text="Botão 3" Clicked="OnClickButtonThree" Order="Primary" Icon="signal.png" />
<ToolbarItem Text="Botão 3" Clicked="OnClickButtonThree" Order="Primary" Icon="search.png" />

</ContentPage.ToolbarItems>

Joining a bunch of controls

$
0
0

Sorry if this is a very basic question, but I don't know how is the name of the control or if I have to do a view, a subpage or a layout.

The point is that I have a bunch of controls (an entry, a delete button for the entry, and a listview) and variables that I want to encapsulate as a new control or something, to use with other pages once or more times. But I don't know what kind of element should I use to do it. If you could point me in the right way, I will do my researchs.

Also, I have to bind the listview with a list that can be one of the different models I have in my app, with different types of variables in it. Am I wrong or this is the time when I have to use a converter?

Thank you.

Silent remove of Page in Navigation Stack

$
0
0

Is there a way to move from one page to another but remove the last page I was on from the navigation stack.

For example

Page 1 > Page 2 > Page 3

As I move from Page 2 to Page 3, remove Page 2 from the navigation stack so when I go back it goes to page 1.

I know I can manually remove things from the navigation stack but it causes all kinds of weird animations when going back. Also if I do a Pop then a Push, it shows the animation on screen which I don't want.

So I am wondering if there is a way to remove it from the Stack silently, with no onscreen animations or quick flashes of the page etc visible to the user?

Real Time Vehicle Tracking Using Xamarin Forms

$
0
0

I am working on a task to track a vehicle (Cab)from mobile app which is to be built in Xamarin forms. Planning to Use GeoLocator plugin. Any ideas and suggestion how should i proceed.

I wish to show the vehicle moving on the map route when the user is actually tracking the ride.

How to get the best routes for a particular destination?

A device is installed in the vehicle which keeps sending the GPS Location.

Ideas and Suggestions are welcome.

How to edit and show code in Xamarin Forms

$
0
0

Hello
I would like to know how can we show Code in formatted way like we do in web pages and how to create a text area for editing code in Xamarin Forms, I am new to xamarin and xamarin forms
Thanks

SnackBar Issue

$
0
0

Hi , in my Xamarin forms app, when the user clicks on delete icon , I am showing a snackbar with the provision of undoing the deleted item. Now if I make the app go in sleep(background), change the language of device through settings , open the app and now when I click on delete button snackbar is not displayed.

Same is working fine for IOS and Xamarin android.

Any help is appreciated. TIA

how to disable the space occupied by the activity indicator in xamarin forms Mobile application?

$
0
0

how to disable the space occupied by the activity indicator in xamarin forms Mobile application?


Consuming REST services

$
0
0

What is the best method for consuming REST services which are locally deployed? I am specifically having issues with utilizing HTTPS for iOS. When calling the web service from iOS (the iPhoneSimlator), I receive a "TrustFailure" web exception. I think this is because the certificate used is self-signed (it's not secure because I am using my internal IP address and the certificate is issued for localhost) when using IIS Express. Does this mean I need to "publish" my API to IIS (or Azure) and use a valid certificate in order to consume the service? This seems like a lot of work for development, especially since I am creating the REST service and mobile application at the same time.

My development environment is:

I have reviewed this and this, but neither really touch on this issue. Any advice on a streamlined workflow would be much appreciated.

How to load records at the bottom of ListView/RepeatableStack dynamically when scrolls down?

$
0
0

I am working on Xamarin mobile app development. I am using RepeatableStack to display collection records on a CarouselPage. This is working fine, when i have less number of records.

But when i have huge number of records, the page gets stuck on load and takes few seconds. This gives bad user experience.

I would like load more records on the fly, when the user scrolls the list down to the bottom. I would like to load it, only when user scrolls down to the bottom. So that, the RepeatableStack will have less number of records when the page loads. Has any one resolved this scenario in Xamarin(C#)?

Xamarin.forms: Unable to connect to locally hosted web service.

$
0
0

Hi guys,
I've been trying to connect with web service deployed in my local (which is running in tomcat). And I'm deploying my project in Android device. As you can see in the code below that I've used my local PC's IP address. Also in Android Manifest file, I turned on the "INTERNET" permission. If I run this url directly in browser, I get expected result. Please note that I had to remove "http" from the code in order to post it here.

` public async Task<List> getHospitalsByCityAsync(string city)
{
List hospitals = null;

        string RestUrl = "192.168.15.100:8080/unsaarAPI/bismillah/city/" + city;
        var uri = new Uri(RestUrl);

        try
        {
            var response = await client.GetAsync(uri);
            if (response.IsSuccessStatusCode)
            {
                var content = await response.Content.ReadAsStringAsync();
                NswHospitalSearch nswHs = JsonConvert.DeserializeObject<NswHospitalSearch>(content);
                hospitals = nswHs.hospitals;
            }
        }
        catch (HttpRequestException e)
        {
            Debug.WriteLine(e.InnerException.Message);
        }
        catch (Exception ex)
        {
            Debug.WriteLine(@"              ERROR {0}", ex.Message);
        }
        return hospitals;
    }`

During debug, its doesn't reach at line if (response.IsSuccessStatusCode) and after a while I get
Error: ConnectFailure (Connection timed out)

I've no clue how to fix this. I've been surfing online many hours; but can't find a suitable solution.
Can any one help. I would really appreciate it.

Thanks.

Expandable ListView

$
0
0

i am new in xamarin forms and i need to make expendable list view by Populating data from web services
Thank you

How to create Background Service in xamarin forms ??

$
0
0

How to create background service in xamarin forms !! I create a task to meet my friend today at 10 am and close the app, remind before 10 minutes to the meeting time phone is ringing or vibrate.

Viewing all 58056 articles
Browse latest View live


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