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

Troubles with Gmail authentication

$
0
0

Hello, I'm trying to implement Gmail authentication on my Xamarin Forms app. Searching for solutions I found to libraries which I can use. Implementations both of them turns error to me. First I tried the Xamarin.GooglePlayServices.Auth. I do all which was described in this article: https://causerexception.com/2017/12/03/google-native-login-with-xamarin-forms/ . I do exactly as it was described event set all of my libraries to the same version, but during compilation it throw exception: ImageManager_OnImageLoadedListenerImplementor is not abstract and does not override abstract method onImageLoaded(Uri,Drawable) Then I tried to delete all code which connected with image downloading but still have the same error.
The second version was Xamarin Auth library. I follow Xamarin site https://docs.microsoft.com/en-us/xamarin/xamarin-forms/data-cloud/authentication/oauth#android. It compiles fine, however, it throws Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup I google this error, so I check my Google+ API service was enabled, and scope was correct.
Now I stuck and would be thankful for any help.


How Xamarin.Forms handle encrypted app images to prevent resource extracting?

$
0
0

Currently ListView etc with image cells, we just supply image location, and Xamarin.Forms takes over and even recycle(?) the list items to display.

If images are encrypted, simply supply the image location won't work, and load binary beforehand may work, but with a list of 100s of items, will be a big or even deadly problem for the app.

So, anyone has a better idea how to deal with encrypted images?

Thanks a lot.

Unable to find a version of 'Xamarin.Forms' that is compatible with 'Xamarin.Android.Support.v4 23.3

$
0
0

I just created a Xamarin Forms project on Windows 10 in Xamarin Studio (updated to latest stable version), and I did a NuGet update on solution:

Looking for updates for 'Xamarin.Android.Support.v4'...
Updating 'Xamarin.Android.Support.v4' from version '23.0.1.3' to '23.3.0' in project 'MyApp.Droid'.
Updating 'Xamarin.Android.Support.v4 23.0.1.3' to 'Xamarin.Android.Support.v4 23.3.0' failed. Unable to find a version of 'Xamarin.Forms' that is compatible with 'Xamarin.Android.Support.v4 23.3.0'.

The Android project has default settings, I didn't change anything.

I'm a bit surprised this didn't work right off the bat....

how to know version of Xamarin Forms

$
0
0

I just installed community edition of the latest Visual studio with Xamarin. When I click Help->About I can see in the installed products that Xamarin is 4.0.x version. How do I know which version of Xamarin Forms am I using? And are Xamarin Forms upgraded independently? I was assuming that everything is from one installer.

Xamarin.Forms Android 8 API

$
0
0

Hi,
How do I use SetJustificationMode(JUSTIFICATION_MODE_INTER_WORD) in custom renderer for Label in my Android Project? I am using Visual Studio 15.5, downloaded SDK for API 26 Level, Target Framework: Android 8.0 Oreo, Target Android Version: Use Compile using SDK Version.
Specifically, in my custom renderer, I set
if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O)
{
TextView tv = (TextView)Control;
tv.SetJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
}
but Control.SetJustificationMode gives the following error.

'TextView' does not contain a definition for 'SetJustificationMode' and no extension method 'SetJustificationMode' accepting a first argument of type 'TextView' could be found (are you missing a using directive or an assembly reference?)

What version of Xamarin.Forms should I use

$
0
0

Hi!

I want to create a Xamarin.Forms app that will target as many devices as possible, targeting UWP, Android and iOS.
I was wondering which Xamarin.Forms version I should use.
I'm willing to compromise and provide no support for OSs or API levels with a low market share, especially if the minimal XF version that targets them contains critical fixes & features.

Is there a list that compares all XF versions and the API levels and OS versions they can target?

How can we fetch photos on our app from instagram or facebook?

$
0
0

Is this possible in Xamarin.forms?

Is there a way to get XAML binding intellisense in a separate ContentView file used in a ListView?

$
0
0

I have a ListView with this item template:

<ListView.ItemTemplate>
  <DataTemplate>
    <ViewCell>
      <views:ProjectListEntry />
    </ViewCell>
  </DataTemplate>
</ListView.ItemTemplate>

ProjectListEntry is fairly complex and is used in another ListView, so I have it in its own file. I've set it up like this:

<ContentView
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    ...
    BindingContext="{x:Static helpers:DesignTimeData.ProjectListEntryVm}">

As you can see, to get Intellisense, I tried to set BindingContext to a static member on the DesignTimeData class. This works fine for my Pages (where I replace the BindingContext at runtime), but for ContentViews used in ListViews, the ContentView's BindingContext seems to be inherited (from the ViewCell, I guess). This means that the explicit BindingContext on my ContentView will actually override the BindingContext set on the ViewCell by the ListView, and all my list elements will reflect the static design-time data at runtime. But if I remove the BindingContext, I get no intellisense for the members I bind to inside the ContentView file.

Is there a simple way to get Intellisense for bindings in a ContentView like this? (As mentioned, I can't inline the ContentView in the ListView definition, because the ContentView is fairly complex and used in several lists. I also can't use some kind of VM locator, because although I'm using bindings, I'm not using "full" MVVM - I'm using a Redux-like architecture instead. And I guess a VM locator wouldn't work for this case anyway for the same reasons the above doesn't work.)


is there any update for xamarin.social is coming for .net standard 2.0 or suggest any alternative.

$
0
0

xamarin.social is targeting framework 4.6.1

Handling the tap events on image in xamarin.forms?

$
0
0

Can you anyone Please help me on this? How to handle the tap events on xamarin.forms. even i gave numbertaps required=2 in xaml it s executing number of times.
my scenario is image is in xaml page and i gave number taps required is "2" when i click on 2 times with no time its executing many times.

how to set (no of taps to) 1 in tap command in mvvm xamarin forms?

$
0
0

i have given tap gesture to image .... when i tapped image multiple times then page is also opening multiple times....i want to open page for only one tap...i have already given no of taps=1...but not working..how to do???

[Material] how to gain access to `Toolbar` from custom renderer?

$
0
0

Based on @TheRealJasonSmith's gist on how to add Material design to your Forms.Android app, I've implemented the "Toolbar" instead of the "ActionBar".

I'm wondering how I might go about getting access to that View in order to set the NavigationIcon to the Page.Icon?

Right now I've got a custom renderer that is attempting to set the Toolbar NavigationIcon like so, but toolbar is always null

[assembly: ExportRenderer(typeof(Page), typeof(Renderers.ExtendedPageRenderer))]
namespace Renderers
{
    public class ExtendedPageRenderer : PageRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
        {
            base.OnElementChanged(e);

            if (Element != null && Element.Icon != null)
            {
                var iconId = ResourceManager.GetDrawableByName(Element.Icon.File);
                var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
                if (toolbar != null)
                {
                    toolbar.SetNavigationIcon(iconId);
                }
            }
        }
    }
}

Saving game data to SQLite

$
0
0

I have 6 populated instances of a rather lengthy class (6 columns of the players stats in a score sheet). Can someone please tell me the best way to save the 6 instances to Sqlite when the game terminates and then use SQLite to repopulate the instances when the players load the saved game?

Set Values in Picker depending on User Input (Dynamically add items to Picker)

$
0
0

I am using Xamarin Forms. I am able bind values from the List<> to Picker using XAML. There are two pickers in my Registration Form. The requirement is that depending on the selection of item from the first Picker, I want to add items in the second picker. Is this possible? Any help would be appreciated!

EDIT: Example
In first picker, I have A, B, C, D.
If user selects A, then second picker must display A1, A2, A3.
If user selects B, then second picker must display B1, B2, B3.
If user selects C, then second picker must display C1, C2, C3.
If user selects D, then second picker must display D1, D2, D3.

All the above values A, B, C, D and A1 A2,.... etc will come from list or web API.(no issues with this part. It's working)

How to implement Fused Location Provider in Xamarin Forms?

$
0
0

Hi,
I am stuck in implementing Fused Location Provider (as explained here) to find indoor Geo-Coordinates. At a very first place it gives the following error:

error CS0103: The name 'LocationServices' does not exist in the current context

Can you please help with this error or any other suggestion for getting the indoor locations using Xamari.Forms? Thanks


RSA Encryption

$
0
0

Hi,

Please help me to encrypt string(password) in Xamarin using RSA algorithm. I am using following code in Android native. Please help me to port this in Xamarin,

        byte[] keyBytes = Base64.decode(key.getBytes("utf-8"), Base64.DEFAULT);

        X509EncodedKeySpec spec = new X509EncodedKeySpec(keyBytes);
        KeyFactory keyFactory = KeyFactory.getInstance("RSA");
        PublicKey publicKey = keyFactory.generatePublic(spec);

        Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1PADDING");
        cipher.init(Cipher.ENCRYPT_MODE, publicKey);
        byte[] encryptedBytes = cipher.doFinal(plain.getBytes());
        encrypted = Base64.encodeToString(encryptedBytes, Base64.NO_WRAP);

Thanks...

Why is idle HEAP always the same size regardless of maximum available?

$
0
0

After checking my app on multiple Android devices, I've noticed something odd with respect to he available heap space.
One device might have a max of 256. Another a max of 512. If I don't set largeheap to true then it will be 128.
Yet regardless the size of the heap the AVAILABLE heap is always 15mb when idle.
This is not a static value. I can see it rise and fall with work being done. The available being returned seems accurate because if I don't take precautions when scanning and drive it down to <2mb then it will throw an OOM exception stating it tried to allocate 3mb with only 1.4 available-and the amount the exception said was available matches my calculated amount.

So that's where I am confused. How does the same app which presumably has the same base footprint never get more available heap regardless of largeheap or device? More importantly - How can I use that available heap? Its silly that I'm going OOM when I have 512 total and not using any of it.

I tend to beleive these calculations are right because they change correctly when I change devices or turn of LargeHeap; but I'll provide them anyway in case someone knows a better way.

//This is running from the Droid project and returning the value to the PCL

        /// <summary>Return in MB
        /// 
        /// </summary>
        /// <returns></returns>
        public override decimal GetTotalHeap()
        {
            Java.Lang.Runtime runtime = Java.Lang.Runtime.GetRuntime();
            long maxHeapSizeInMB = runtime.MaxMemory() / 1048576L;
            return maxHeapSizeInMB;
        }

        public override decimal GetAvailHeap()
        {
            Java.Lang.Runtime runtime = Java.Lang.Runtime.GetRuntime();
            var aval = runtime.FreeMemory();
            return aval / 1048576L;
        }

Select an item is MasterDetail page by default

$
0
0

Hi,

I have just created a new MD page in C# by using Visual Studio (so it created the templates for me)
and while I can navigate to different pages by selecting an option on the left, I want the first page shown to the user to be the first item of the list.

How can I do that?

Parts of RelativeLayout not showing with TranslateX

$
0
0

I'm creating a custom ListView that is a StackLayout (list) containing a bunch of RelativeLayouts (the list items). I want to add the ability to swipe the list items to show more options. I need to do this custom because the list items are not uniform at all and the list must look the same on iOS and Android.

I have 2 solutions that each have a problem. Here is how I add the extra options to my RelativeLayout. Notice they go beyond the bounds of the RelativeLayout.

{
                            trashLayout,
                            Constraint.RelativeToParent(parent => parent.Width ),
                            Constraint.Constant(0),
                            Constraint.Constant(80),
                            Constraint.Constant(80)

}

First I added the RelativeLayout to a ScrollView and everything shows up fine, the problem is I don't want the user to be able to scroll the list item, I want them to swipe it to show more options (using ScrollToAsync). So is there a way to disable scroll on a ScrollView? I know that sounds silly..

So then I tried removing the ScrollView and just having the RelativeLayout. The swiping works great now, however the overflow of the view (the additional options) are now not showing when I do TranslateTo to the view, as can be seen in the pic.

How do I get the entire view to render so using TranslateTo will show the options? Or how can I disable the scrolling of a ScrollView?

Thanks.

Any tools or libs for displaying an offline map using local vector mbtiles?

$
0
0

Are there any tools or libs for displaying an offline map using local vector mbtiles file stored on device?
(I use mbtiles from openmaptiles.com.)

I've tried tried MapsUI but it only support raster tile.

Any suggestion?

Thanks

Viewing all 58056 articles
Browse latest View live


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