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

SignaturePad within a template selector

$
0
0

Hello all, I am having an issue with my signaturepad (version 3.0) where when it is part of a data template, if I need to scroll, then it acts as if there is just one shared signature pad. That is, whatever change I do to one, affects the other one that is out of the screen's view. If they are side by side, then there is no problem

I was wondering if anyone has encountered this issue before. One interesting thing, I am not sure if that is just how selectors work, but ondisppearing is called each time the signaturepad is no longer visible within the screen (fair). However, OnAppearing is only called once for the initial render and never again.


Items scrolled through

$
0
0

I have a collection view with rss items with property

public string Id { get; set; }
public bool IsReaded { get; set; }

I need to set IsReaded property to true as scrolled through the items

I thought of using LastVisibleItemIndex so for every 5 items set there IsReaded property to true but how to get these items ids?

or if there are another suggested approaches

Xamarin Forms Language issues on Android

$
0
0

I'm going crazy for hours on an evil problem!!!

I've created a new Xamain Forms prj on Visual Studio for Mac (last version and last update).

I have three AppResources files for corrispondent languages: - AppResources.resx (for default) - AppResources.it.resx (for italian) - AppResources.es.resx (for spanish)

On IOS simulator, works all good. On Android I see always the default string.

This is my simple data on AppResources file:

AppResources.resx:

Default

AppResources.es.resx:

Espanol

AppResources.it.resx:

Italiano

Why on IOS works perfectly and on Android I can see only "default"?!?

Xamarin Forms Language issues on Android

$
0
0

I'm going crazy for hours on an evil problem!!!

I've created a new Xamain Forms prj on Visual Studio for Mac (last version and last update).

I have three AppResources files for corrispondent languages: - AppResources.resx (for default) - AppResources.it.resx (for italian) - AppResources.es.resx (for spanish)

On IOS simulator, works all good. On Android I see always the default string.

This is my simple data on AppResources file:

AppResources.resx:

Default

AppResources.es.resx:

Espanol

AppResources.it.resx:

Italiano

Why on IOS works perfectly and on Android I can see only "default"?!?

Image Aspect AspectFill

$
0
0

Hello,

Coming across a sudden, new issue that I can't quite figure out. Loading an image and setting aspect to "AspectFill" within a set height. Was working well previously and actually same code works well on a different form. Now...only in Android, the AspectFill is not working. "Fill" will work.

<StackLayout Padding="0,5,0,0">
   <Image
       x:Name="imgRoute"
       Aspect="AspectFill"
       HeightRequest="200"
       HorizontalOptions="Fill"
       Source="{Binding RouteThumbnail}" />
</StackLayout>

Any advice? Can't see what has changed and why it only affects Android; iOS displays image as expected.
Appreciate it.

Assets not always available

$
0
0

I've got issues with accessing and reading Assets. 50 % of the time it works, the other 50% it does not. Tested it in combination with multiple Android phones. Behavior is different every time I restart start the App. Sometimes it works, sometimes the files cannot be found. The previous version of my code was targeting Android 8.1. The new version of the code is targeting 10.

Every Asset has the AndroidAsset build action set.

Anyone any idea on what can cause this issue. Also Xamarin.Forms translations stopped to work on Android.

Dynamic Form data Binding to carousel view ItemSource property

$
0
0

Hello All,
I need to display dynamic forms in the carousel view. The form gets generated based on the JSON response from API and I have to show that particular form in the carousel view.

I am able to integrate my content view with some static content to the carousel view using this "CardsView(2.6.1) "package.

However, I am stuck at the data binding part because my content view is actually a dynamic form on which the data gets populated based on the JSON response from API. So, how can I create and bind the dynamic model to ItemSource Property of the carousel view?
Thanks in advance.

Cloud not launch Xamarin.Launcher

$
0
0

Dear all,

I am facing an issue with the launch iOS simulator.

The following image appeared when I tried to debug.

How can I fixed it?

Environment

  • macOS Catalina 10.15.4
  • Visual Studio for Mac
=== Visual Studio Community 2019 for Mac ===

Version 8.6 (build 4520)
Installation UUID: 436d9f64-9f6a-4a97-8b0c-f1f4848e6080
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

    Package version: 610000104

=== Mono Framework MDK ===

Runtime:
    Mono 6.10.0.104 (2019-12/5d03a6fe116) (64-bit)
    Package version: 610000104

=== Roslyn (Language Service) ===

3.6.0-3.20210.9+4eafdcb1bcbd8d3573f2ba6065e56d9b9ce4f8a3

=== NuGet ===

バージョン: 5.6.0.6591

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.1.300/Sdks
SDK バージョン: 3.1.300
MSBuild SDK: /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

ランタイム: /usr/local/share/dotnet/dotnet
ランタイム バージョン:
    3.1.4
    2.1.18

=== Xamarin.Profiler ===

バージョン:1.6.15.68
場所: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

バージョン: 11

=== Apple Developer Tools ===

Xcode 11.5 (16139)
Build 11E608c

=== Xamarin.Mac ===

Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.

=== Xamarin.iOS ===

Version: 13.18.1.31 (Visual Studio Community)
Hash: b3eedfed9
Branch: d16-6
Build date: 2020-04-09 10:22:36-0400

=== Xamarin Designer ===

Version: 16.6.0.329
Hash: d4f8bcd13
Branch: remotes/origin/d16-6
Build date: 2020-04-24 02:16:02 UTC

=== Xamarin.Android ===

バージョン:10.3.1.0 (Visual Studio Community)
コミット:xamarin-android/d16-6/3fe860a
Android SDK: /Users/toyoshima takumi/Library/Developer/Xamarin/android-sdk-macosx
    サポートされている Android バージョン:
        インストールなし

SDK Tools のバージョン: 26.1.1
SDK プラットフォーム ツールのバージョン: 29.0.5
SDK ビルド ツールのバージョン: 29.0.2

ビルド情報: 
Mono: 165f4b0
Java.Interop: xamarin/java.interop/d16-6@2cab35c
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.31.1@49232bc
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-6@bfb66f3

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/toyoshima takumi/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL のコードは以下から入手できます。
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.6.0.50
Hash: 5901879
Branch: remotes/origin/d16-6
Build date: 2020-04-30 04:01:22 UTC

=== Android Device Manager ===

Version: 16.6.0.95
Hash: 45d17b5
Branch: remotes/origin/d16-6
Build date: 2020-04-30 04:01:42 UTC

=== Build Information ===

Release ID: 806004520
Git revision: 9c92c7baceef7771f8dcf5c86e1e1a66fdc26182
Build date: 2020-05-18 10:05:00-04
Build branch: release-8.6
Xamarin extensions: 9c92c7baceef7771f8dcf5c86e1e1a66fdc26182

=== Operating System ===

Mac OS X 10.15.4
Darwin 19.4.0 Darwin Kernel Version 19.4.0
    Wed Mar  4 22:28:40 PST 2020
    root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64



NavigationBar.TitleView does not hide menu icon in UWP.

$
0
0

This is my NavBar title view:

<NavigationPage.TitleView>
        <StackLayout Margin="0" Padding="6,0,6,0" BackgroundColor="Yellow"
                     Orientation="Horizontal">
            <Button VerticalOptions="Center" ImageSource="backArrow_icon.png"
                    HorizontalOptions="Start"
                    HeightRequest="30" MinimumHeightRequest="30"
                    WidthRequest="30" MinimumWidthRequest="30"/>
            <Label VerticalOptions="Center"
                   HorizontalOptions="StartAndExpand"
                   Text="{x:Static resources:AppResources.Share}"/>
            <Button VerticalOptions="Center" ImageSource="Check_Icon.png"
                    HorizontalOptions="Start"
                    HeightRequest="30" MinimumHeightRequest="30"
                    WidthRequest="30" MinimumWidthRequest="30"/>
        </StackLayout>
    </NavigationPage.TitleView>

How do I make the menu icon marked in red, invisible? or get rid of it?

UIWebView AppStore Rejection Despite mtouch Flag

$
0
0

Hello, my Xamarin.iOS app is still getting rejected on upload to iTunes Connect based on UIWebView even after following the instructions found in other posts for adding the mtouch --optimize. Here is my mtouch line:

--optimize=experimental-xforms-product-type --warn-on-type-ref=UIKit.UIWebView

And here is the warning:

Warning MT1503: One or more reference(s) to type 'UIKit.UIWebView' still exists inside 'Xamarin.Forms.Platform.iOS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' after linking (MT1503)

And the dreaded AppStore rejection:

ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability. Learn more (https://developer.apple.com/documentation/uikit/uiwebview).

I have tried both "Link Framework SDKs only" as well as "Link All". Everything is fully updated on the Stable channels (VS Mac 8.5.4, and Xamarin Forms 4.6.0).

Any ideas what I might be doing wrong? Thanks!

My Xamarin.iOS app crashes on the simulator on startup, but then works?

$
0
0

I'm currently trying to test my Xamarin.iOS app on my Windows machine connecting through MacInCloud. When I attempt to debug the code, it will crash after about 10 seconds of the loading screen. After the crash, when I click on the app again, it gets past the loading screen and works fine. I debugged this way for a little, but without the ability of using breakpoints it's very difficult to find the other bugs.

This happens even with a blank template app.

Any ideas?

ITMS-90809:Deprecated API Usage-Apple will stop accepting submissions of apps that use UIWebView API

$
0
0

Yesterday, I uploaded my App to TestFlight and after a while, Apple sent me this warning:

ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs. See https://developer.apple.com/documentation/uikit/uiwebview for more information.

I am using WebView for showing HTML data in my app. Also, I have used WebView for playing audio and video. So is this warning reject my app when submitting for review or should I change these features with some other APIs?

In this link provided by AppStore, telling about use WKWebView instead of UIWebView, I tried that and no such property found on XAML. Should I need to install any packages for getting that feature? Also, by using WKWebView, is it possible to play audio, video and showing HTML data in the app?

Check battery

$
0
0

Hello

How can I find because my App spend a lot of battery device ?

thanks.

Launching Running app Soon but wish to give free trail before charge of app store

$
0
0

Hi I wish to give my users of my new running app seven days free trail before charging their debit card in ios store. Is this sort of functionality done at the store level or do I also need to code for it in my xamrain forms app.

Also is their any hosted sites like appcentre for your privacy policies screen shots and all.

New blank app in Xamarin.Android can't be built, error parsing some XML

$
0
0

Hi to everybody,

I am coding in Xamarin.Android for last 4 years and I very like the platform! But now it's partially broken on my computer. Recently I tried to create new testing project but I failed to build even the simplest blank project automatically generated by Visual Studio Community 2019 (16.6.0).

I tried to reinstall whole Visual Studio but it made no change. I am not sure where to search for the problem.

This is warning (and later error when I try to build) I get immediately after creating new blank project both in native Xamarin.Android or in Android project of Xamarin.Forms. In error window I get this warning as number one, without showing in which file it occurs.

Severity Code Description Project File Line Suppression State
Warning System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 2444.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r)
at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
at Xamarin.Android.Tasks.ReadLibraryProjectImportsCache.RunTask()
at Xamarin.Android.Tasks.AndroidTask.Execute()

I have yellow exclamation marks on all references of the project: Mono.Android, System, System.Core,... and when I click them they disappear.
Another warnings are: The referenced component 'Mono.Android' could not be found... and so on

In Tools-Options-Xamarin I have these values

Java: C:\Program Files\Android\Jdk\microsoft_dist_openjdk_1.8.0.25
Android SDK: C:\Program Files (x86)\Android\android-sdk

But I have installed everything as far as I know. At least my long term project in Xamarin.Android is running without errors.

Recently I installed Android NDK and only then I tried to test it with new Xamarin.Android project.
I have no idea what did I make wrong and worse, how to fix it.

Already have three evenings in it :|

Thank you for advice.


Post download latest visual studio 19 getting some errors

$
0
0

05-23 00:20:54.865 W/monodroid-assembly(15792): typemap: unable to find mapping to a managed type from Java type 'java/util/Collections$UnmodifiableCollection$1'
05-23 00:20:54.870 W/monodroid-assembly(15792): typemap: unable to find mapping to a managed type from Java type 'android/app/SharedPreferencesImpl'
05-23 00:20:54.870 W/monodroid-assembly(15792): typemap: unable to find mapping to a managed type from Java type 'android/app/SharedPreferencesImpl$EditorImpl'
05-23 00:20:54.872 W/monodroid-assembly(15792): typemap: unable to find mapping to a managed type from Java type 'android/app/SharedPreferencesImpl'
05-23 00:20:54.872 W/monodroid-assembly(15792): typemap: unable to find mapping to a managed type from Java type 'android/app/SharedPreferencesImpl$EditorImpl'

SimpleAudioPlayer stops working

$
0
0

Hi. I created a class to add sound effects to my program. It works great.... and then just quits. I am not certain as to why, but it seems to be occuring when a sound is called again before the first sound ends, but I am not certain of this.

using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;

namespace Potocracy.Classes
{
    public class Sounds
    {
        protected Plugin.SimpleAudioPlayer.ISimpleAudioPlayer sound_KaChing;
        protected Plugin.SimpleAudioPlayer.ISimpleAudioPlayer sound_Train;

        public Sounds()
        {
            var assembly = typeof(App).GetTypeInfo().Assembly;

            sound_KaChing = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            sound_KaChing.Load(assembly.GetManifestResourceStream("Potocracy.Resources.kaching.mp3"));

            sound_Train = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
            sound_Train.Load(assembly.GetManifestResourceStream("Potocracy.Resources.train.wav"));
        }

        public void KaChing()
        {
            if (!sound_KaChing.IsPlaying)
                sound_KaChing.Play();
        }

        public void Train() => sound_Train.Play();
    }
}

When I played my game, if KaChing was called twice the sound quit working and you could never hear any sound again (including the train sound). So, I added the code:

            public void KaChing()
            {
                if (!sound_KaChing.IsPlaying)
                    sound_KaChing.Play();
            }

After that, you could hear the KaChing sound once, but no sounds after that would work. Even though, stepping through with the debugger, Play() would execute.

Any ideas?

Thank you.

Push Notification in Xamarin Forms for a specific USER

$
0
0

I have followed this https://docs.microsoft.com/en-za/xamarin/xamarin-forms/data-cloud/azure-services/azure-notification-hub to the core and I am able to send push notifications in Azure to many devices e.g Android devices.

I want to be able to register a user to the hub (I assume by calling this method OnNewToken in FirebaseService) but I don't know how to go about doing that from the PCL project and if it's the right thing to do.

It'd be great if someone with greater knowledge on how to properly implement the OnNewToken method and call it could share that knowledge with me. I appreciate it

An error occurred trying to load the page. Index was outside the bounds of the array.

$
0
0

I'm building a mobile application using Xamarin Form.When I tried to open AndroidManifest.xml in Visual Studio 2019 Community by Right Click -> Xamarin.Android Project -> Properties -> Android Manifest , I'm getting following error,

"An error occurred trying to load the page. Index was outside the bounds of the array."

But the application is working perfectly, just does not show the Android Manifest in properties.

I have try recreate the Android Manifest again and replace the old Manifest in Xamarin.Android but it still does not resolve the problem.

I have delete bin and obj file of Xamarin.Android but still problem persist.

I have create another new Xamarin Form and try to read the AndroidManifest.xml from properties and I can read it. But It just does not show in Xamarin Form my project

1. I have check the Xamarin Log in Visual studio by going too Help -> Xamarin -> Open Logs . It do show some error log.

Can anyone help me regrading this problem. I have attached the Xamarin Log regarding the problem and include the Android Manifest

Android Manifest

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0.0" package="com.companyname.VMS.ResidentMobileApp" android:installLocation="preferExternal"> <application> <provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data> </provider> </application> <uses-sdk android:minSdkVersion="18" android:targetSdkVersion="26" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.CAMERA" /> <application android:label="VMS.ResidentMobileApp.Android"></application> </manifest>

How to read a backspace in an Entry from Xamarin.Forms?

$
0
0

I can't for the life of me capture the backspace! I need to capture a backspace, even if the field is empty. Am I doing something wrong?

public class CustomEntryRenderer: EntryRenderer, Android.Views.View.IOnKeyListener
{
    protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
    {
        base.OnElementChanged(e);

        if (Control == null) 
        {
            return;
        }

        var entry = (CustomEntry)Element;

        Control.SetOnKeyListener(this);

        Control.KeyPress += (s, arg) => { 
            System.Diagnostics.Debug.WriteLine("OnElementChanged KeyPress");
        };

        Control.TextChanged += (s, ev) => { 
            System.Diagnostics.Debug.WriteLine("OnElementChanged TextChanged"); 
        };

        Control.EditorAction += (s, ev) =>
        {
            System.Diagnostics.Debug.WriteLine("EditorAction EditorAction");
        };

        Control.SetOnEditorActionListener(this);


    }

    public override bool OnKeyPreIme(Keycode keyCode, KeyEvent e)
    {
        System.Diagnostics.Debug.WriteLine("OnKeyPreIme");
        return base.OnKeyPreIme(keyCode, e);
    }

    public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
    {
        System.Diagnostics.Debug.WriteLine("OnKeyUp");
        return base.OnKeyUp(keyCode, e);

    }



    protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
    {
        base.OnElementPropertyChanged(sender, e);

        if (Control == null)
        {
            return;
        }

        var entry = (CustomEntry)Element;

        Control.SetOnKeyListener(this);

        Control.KeyPress += (s, arg) =>
        {
            System.Diagnostics.Debug.WriteLine("OnElementPropertyChanged KeyPress");
        };

        Control.TextChanged += (s, ev) =>
        {
            System.Diagnostics.Debug.WriteLine("OnElementPropertyChanged KeyPress");
        };

        Control.EditorAction += (s, ev) => { 
            System.Diagnostics.Debug.WriteLine("OnElementPropertyChanged EditorAction");
        };

    }

    bool IOnKeyListener.OnKey(Android.Views.View v, Keycode keyCode, KeyEvent e)
    {
        System.Diagnostics.Debug.WriteLine("OnKey");
        return true;
    }


}
Viewing all 204402 articles
Browse latest View live