Moved: White noise generation
send files using bluetooth in xamarin forms ios and android
hello guys,
i am currently doing project for file transfer using Bluetooth between two device using xamarin forms(.net standard) but i cant find relevant documentation for how to do this i know there is a plugin for data transfer https://github.com/aritchie/bluetoothle but i am not sure if it can transfer files please help me out on this.
thanks in advance.
why navigation between pages in xamarin forms is slow on Android
in same code same project in xamarin forms
Navigation between pages is slow just on android on ios it is good
these video for IOS it is good speed
https://drive.google.com/open?id=162U0XmPw-NZvMZhqNgyDOtCPcy52EhHy
these for Android it slow not good like IOS
https://drive.google.com/open?id=15yedNiqzwypFx8RIN22UTltFmCSIIFIl
these my simple
https://drive.google.com/open?id=1eK-6efyw37LUH78p3ze-fflWXJI_3tlQ
thank you
iOS Binding Unity as a library
Hi all,
I don't even know where to start
Since alpha 2019.3 Unity offers the feature "Unity as a Library" https://blogs.unity3d.com/2019/06/17/add-features-powered-by-unity-to-native-mobile-apps/ which I'm currently trying to integrate into one of our Xamarin Apps.
There are descriptions how to do that natively for Android and iOS which I got both working fine.
Just for reference:
https://forum.unity.com/threads/integration-unity-as-a-library-in-native-ios-app.685219/
https://forum.unity.com/threads/integration-unity-as-a-library-in-native-android-app.685240/
This is actually a really big deal so it is great working on it
However, I got it working fine for Xamarin Android. Now I'm trying on iOS which appears to be much more complicated.
The unity project will be exported as a native Objective-C++ framework (I think at least as there are .mm files using Objective C)
When using Sharpie to bind the framework I get a super large APIDefinitions file.
After some research I figured out that I have to define a scope to the Headers of the Framework, then the APIDefinitions are in fact much smaller and only reference the header files.
Now to my (current) problem:
If I open the ApiDefinitions then there is an interface UnityFramewok which comes from the UnityFramework.h file.
But this header holds a reference to a class UnityView which is not part of the headers. It is within the framework( at least it is within the Library project in Xcode so I assume it is bundled into the framework.)
I copied the .framework into the bindings Native References but I can't see any actual change happening when I do that.
The UnityView can not be found within the interface and I also can't import it from the library because the native reference is not available.
So how can I reference to a class of the framework from within an interface that is defined in the ApiDefinitions?
Thank you already!
How to set Dashed border color in xamarin forms Frame in iOS?
I am doing an app in Xamarin.Forms for iOS.In that i need to do a design of the image shown below.
To achieve this design I used a frame and added border color for it.But I am not able to get Dashed border as specified in the image above. I am trying to get this through custom renderer. Can anyone please help me or guide me to get the exact design in the image.
That would be a gret help for me.Thanks in advance.
Is it possible to combine Xamarin Forms views and Native views?
Hi all. i have a question regarding combining views from Xamarin Forms and native UWP views.
i have one Xamarin forms control with a bunch of labels and buttons, however, i want to display them in a "Pivot" UWP control. i managed to get a Pivot control working with xamarin, however i have not been able to put my xamarin forms control as the content of the pivot control. i have tried with Platform.GetRenderer and GetNativeElement, but this is not succesfull, see the code below:
foreach (View view in e.NewElement.Children)
{
var renderer = Platform.GetRenderer(view);
renderer.ElementChanged += Renderer_ElementChanged;
var native = renderer.GetNativeElement();
pivot.Items.Add(new PivotItem() {Header ="Item", Content = native });
Debug.WriteLine("Children found");
}
SetNativeControl(pivot);
xamarin control:
uwp control:
is this possible or do i have to resort to other methods?
Kind regards, Rick
Xamarin.forms Firebase analystics.
I have implemented Firebase analytics tool in Xamarin.forms application, and i unable to create custom event
**public partial class FeedPage : ContentPage
{
IFirebaseAnalytics eventTracker;
public FeedPage()
{
InitializeComponent();
eventTracker = DependencyService.Get();
}
void Handle_Clicked(object sender, System.EventArgs e)
{
eventTracker.SendEvent("Click1"); // Custom event
}
}**
This custom event throw the error System.NullReferenceException: 'Object reference not set to an instance of an object.'
SQLite-net-pcl on cross platform app saves well on iOS but erratic on Android
I wonder if this is a common issue. I load data from a web service (MS SQL Database passing JSON) into my mobile app for off-line processing. This works perfectly in iOS. On Android, if I step through the code when persisting, it works fine. If I run without any breakpoints, some data is not always persisted. I have reverted to pack all the transactions into forced start and commit transactions using ExecuteAsync, tried to close the connection regularly but still inconsistent results. Are there any known issues? This is on Android v 7 (HUAWEI) phone and the project targets API 28 with minimum 23
Shell close animation stuttering on Android
Hi,
today I experimented a bit with the "new" (not that new anymore) shell component in order to set up a simple hamburger menu.
I'm facing the same issue as with the MasterDetailPage in the past, were the animation of closing the menu is stuck for a second before actually closing.
For the Masterdetail it was solved by adding a delay (which was bad already) but I can't find a way to solve it for shell.
Does anyone know how to improve the closing animation? Right now it is unusable.
Here is my xaml setup:
<?xml version="1.0" encoding="UTF-8"?>
<Shell BackgroundColor="#D4503B" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:page="clr-namespace:MyApp.ContentPages" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MyApp.AppShell">
<FlyoutItem Title="Dashboard" >
<Tab>
<ShellContent ContentTemplate="{DataTemplate page:Page1}"/>
</Tab>
</FlyoutItem>
<FlyoutItem Title="Train ticket request">
<Tab>
<ShellContent ContentTemplate="{DataTemplate page:Page2}" />
</Tab>
</FlyoutItem>
<FlyoutItem Title="Parking spot reservation">
<Tab>
<ShellContent ContentTemplate="{DataTemplate page:Page3}" />
</Tab>
</FlyoutItem>
</Shell>
Page 1 is almost empty, just two buttons without any styling are shown there but the same problem. Page2 and 3 are a bit more complex but still not overwhelmingly crazy.
One of my ideas was to manually tell when to open and close and navigate but I didn't find a way how to implement it (For example, how to get the menu icon click event?)
Any ideas?
I'm using Xamarin.Forms 4.3.0.947036
References confirming the bug (One is marked as solved but clearly isn't):
https://github.com/xamarin/Xamarin.Forms/issues/7521
https://github.com/xamarin/Xamarin.Forms/issues/5216
References to fix MasterDetail in the past:
https://github.com/xamarin/Xamarin.Forms/issues/4398
https://stackoverflow.com/questions/48115810/how-can-i-make-the-masterdetailpage-faster-on-android
bootstrap in webview
Hi All,
In my App, I'm displaying a report in WebView. It is a local HTML. Currently working fine but the report does not look nice with just HTML. I want to include bootstrap to this local HTML. I can do that by including the Bootstrap CDN link but most of the users do not have the internet on their phone.
Is there a way to include the Bootstrap min file as a local asset and use it?
Does anyone like to share a sample code?
Button in a AbsoluteLayout issue
So I have an odd thing happening with last update and I am not sure what to do about it.
I have a view
<ContentView.Content>
<AbsoluteLayout WidthRequest="100" HeightRequest="100">
<Button x:Name="BackgroundButton" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1" />
<Image x:Name="Icon" InputTransparent="True" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1" Margin="20,15,20,25"/>
<Label x:Name="CountLabel" Style="{StaticResource HubButtonLabel}" HorizontalTextAlignment="End" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1" />
<Label x:Name="ButtonLabel" Style="{StaticResource HubButtonLabel}" HorizontalTextAlignment="Center" VerticalTextAlignment="End" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1" />
</AbsoluteLayout>
</ContentView.Content>
</ContentView>
Is basically just a button wrapper, with some extra icons, and text. I have a few of these in the project of different styles and layouts. Until the last update they worked fine. Now the button renders overtop of everything else. I can confirm that by setting the button colour to something semi transparent.
This only happens on android, ios still works as expected.
Anyone have a fix for that? or do I need to rework all these views?
Trying to get namespace right for an Effect
I am following Adam Pedley's excellent article on effects: https://xamarinhelp.com/safeareainsets-xamarin-forms-ios/
Unfortunately, When I go to the xaml code that wants to use the effect, it rejects the namespace I'm using. I've been banging my head against this for some time.
I've copied SafeAreaPaddingEffect.cs as is (my solution is named Enterprise)
In MainPage.xaml I have
xmlns:effect="clr-namespace:Enterprise.View.Effects">
and VS lights up Effects in red. Further when I try to use that namespace,
<ContentView.Effects>
<effect:SafeAreaPaddingEffect />
</ContentView.Effects>
It lights up SafeAreaPaddingEffect in red as well.
Any ideas/suggestions?
Thanks!!
jesse liberty
CollectionView: Putting the Footer at the Bottom
I have 2 CollectionView(s) (one is the ItemTemplate of the other), and I want to use the full height so that the Footer is at the bottom (which means there may end up being space between the items & the footer). However, my code seems to be placing the Footer immediately below the last item, or chopped off if there are more items than fit. Here is my code & a screenshot:
<CollectionView Grid.Column="1" Grid.RowSpan="3" BackgroundColor="Transparent" HorizontalOptions="Start" HorizontalScrollBarVisibility="Never" Margin="0" VerticalOptions="FillAndExpand" VerticalScrollBarVisibility="Never">
<d:CollectionView.ItemsSource>
<x:Array Type="{x:Type sp:SamplePlayer}">
<sp:SamplePlayer PlayerIndex="0">
<sp:SamplePlayer.HeaderData><sp:HData PlayerIndex="0" Name="Nate"/></sp:SamplePlayer.HeaderData>
<sp:SamplePlayer.FooterData><sp:FData PlayerIndex="0" Total="50"/></sp:SamplePlayer.FooterData>
<sp:SamplePlayer.ScoreData>
<sp:Score Points="10" IsSelected="False"/>
<sp:Score Points="20" IsSelected="False"/>
<sp:Score Points="-10" IsSelected="False"/>
<sp:Score Points="30" IsSelected="False"/>
</sp:SamplePlayer.ScoreData>
</sp:SamplePlayer>
<sp:SamplePlayer PlayerIndex="1">
<sp:SamplePlayer.HeaderData><sp:HData PlayerIndex="1" Name="Player 1"/></sp:SamplePlayer.HeaderData>
<sp:SamplePlayer.FooterData><sp:FData PlayerIndex="1" Total="50"/></sp:SamplePlayer.FooterData>
<sp:SamplePlayer.ScoreData>
<sp:Score Points="10" IsSelected="False"/>
<sp:Score Points="20" IsSelected="False"/>
<sp:Score Points="-10" IsSelected="False"/>
<sp:Score Points="30" IsSelected="False"/>
</sp:SamplePlayer.ScoreData>
</sp:SamplePlayer>
</x:Array>
</d:CollectionView.ItemsSource>
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="{x:Type sp:SamplePlayer}">
<CollectionView BackgroundColor="{Binding PlayerIndex,Converter={StaticResource ScoreColors}}" Header="{Binding HeaderData}" Footer="{Binding FooterData}" ItemsSource="{Binding ScoreData}" HorizontalOptions="Start" HorizontalScrollBarVisibility="Never" Margin="0" SelectionMode="Single" VerticalOptions="FillAndExpand" VerticalScrollBarVisibility="Never">
<CollectionView.HeaderTemplate><DataTemplate x:DataType="{x:Type sp:HData}"><Frame BackgroundColor="{Binding PlayerIndex,Converter={StaticResource NameColors}}" Padding="0,-4,0,4" HorizontalOptions="FillAndExpand" VerticalOptions="Center"><Label Style="{StaticResource ItemText}" Text="{Binding Name}" HorizontalOptions="CenterAndExpand"/></Frame></DataTemplate></CollectionView.HeaderTemplate>
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="{x:Type sp:Score}">
<Frame BackgroundColor="Transparent" Padding="0,-4,0,0" HorizontalOptions="FillAndExpand" VerticalOptions="StartAndExpand">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"><VisualState.Setters><Setter Property="BackgroundColor" Value="Transparent"/></VisualState.Setters></VisualState>
<VisualState x:Name="Selected"><VisualState.Setters><Setter Property="BackgroundColor" Value="Orange"/></VisualState.Setters></VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Label Style="{StaticResource ItemText}" Text="{Binding Points}"/>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
<CollectionView.FooterTemplate><DataTemplate x:DataType="{x:Type sp:FData}"><Frame BackgroundColor="{Binding PlayerIndex,Converter={StaticResource NameColors}}" Padding="0,-4,0,0" HorizontalOptions="FillAndExpand" VerticalOptions="Center"><Label Style="{StaticResource ItemText}" Text="{Binding Total}"/></Frame></DataTemplate></CollectionView.FooterTemplate>
</CollectionView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
As you can see, the pink area (the BackgroundColor of the CollectionView) goes all the way to the bottom, but the Footer (the red area) is immediately below the items. How can I move the Footer to the bottom? I am somewhat new to Xamarin (I am converting my apps from UWP to be used on Android). Thanks.
webview open new blank page in browser
public MainPage()
{
Title = "XXXXXX";
var source = new UrlWebViewSource();
source.Url = "http://XXXXXXXXX/student/studentlogin.aspx";
var webView = new WebView
{
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
Source = source
};
webView.Navigating += (s, e) =>
{
if (e.Url.Contains("FeeReceipt.aspx"))
{
try
{
var uri = new Uri(e.Url);
Device.OpenUri(uri);
}
catch (Exception)
{
}
e.Cancel = true;
}
};
webView.Navigated += (object sender, WebNavigatedEventArgs e) => {
System.Diagnostics.Debug.WriteLine("Done");
};
Content = new ContentView {
Content = new StackLayout {
Children = {
webView
}
}
};
}
not showing Camera option in webview of xamarin forms application
Hello,
I have created my application in asp.net mvc and I have given Input type="file" and added PWA in my web application. In browser it shows capture image and select image option. That web application hosted link I have given in my xamarin forms application and I have given camera and storage permission in android and IOS application It works good in IOS. But in android it is not showing capture camera option. Please help me out.
Xamarin.Forms previewer needs a Manual Refresh button
I've had to recreate a new content page, close and open it (the official advise) just to update the preview. This is insane.
Can we get a refresh button?
Linking Assemblies leads to Binding Property not updating
In my Xamarin.Forms app, there is an issue when creating the Release build:
In MyView.xaml, I have a Label with a Text binding:
<Label Text="{Binding ProgressInfo.Message, Mode=TwoWay}" />
In MyViewModel.cs I have the Property:
private (double Value, string Message) progressInfo;
public ( double TotalProgressInPct, string Message) ProgressInfo { get => progressInfo; set => SetProperty(ref progressInfo, value); }
where SetProperty is from a different assembly (MvvmHelpers)
The update of the text label works fine with No Linking, but not with Link SDK Assemblies, where the Label text does not update. All other Labels are updated just fine.
For some reason, the tuple character of the property does not work nice with the Linker? Thankful for any hints!
Anyone successfully passed cookies to WkWebView?
I have been working on a Custom WebView that on iOS uses the native WkWebView instead of the default.
My pain is that passing cookies to it from a HttpClient does not always sent those cookies on first request.
The intention is that the user, already being logged in using a HttpClient, opens a page showing the webpage of our service. By reusing the cookies, the user does not need to authenticate again. But by using the WkWebView, I sometimes end up on the loginpage, as a result of cookies not being passed properly.
This is my iOS Custom Renderer for the WebView:
public class CustomWebViewRenderer : ViewRenderer<CustomWebView, WKWebView>
{
protected override async void OnElementChanged(ElementChangedEventArgs<CustomWebView> e)
{
base.OnElementChanged(e);
if (e.NewElement != null)
{
if (Control == null)
{
var config = new WKWebViewConfiguration();
var jCookies = Appl.FlurlClient.Cookies.Values;
NSHttpCookie[] nsHttpCookies = jCookies.Where(c => c != null).Select(c => new NSHttpCookie(c)).ToArray();
foreach (var c in nsHttpCookies)
{
await config.WebsiteDataStore.HttpCookieStore.SetCookieAsync(c);
}
var webView = new WKWebView(Frame, config);
SetNativeControl(webView);
}
Control.LoadRequest(new NSUrlRequest(new NSUrl(Element.Uri)));
}
}
}
Xamarin.Forms TimePicker with 15 minutes Intervals?
Hi!
is there a way to get a TimePicker in Xamarin.forms which has only 0,15,30,45 minutes to choose?
I tried using custom renderer in Android with something like this:
`class MyTimePickerRenderer : TimePickerRenderer
{
protected override void OnModelChanged(Xamarin.Forms.VisualElement oldModel, Xamarin.Forms.VisualElement newModel)
{
base.OnModelChanged(oldModel, newModel);
Android.Widget.TimePicker tpdi = (Android.Widget.TimePicker)Control;
var numberPicker = FindMinuteNumberPicker(tpdi as ViewGroup);
if (numberPicker != null)
{
numberPicker.MinValue = 0;
numberPicker.MaxValue = 5;
numberPicker.SetDisplayedValues(new String[] { "00", "15", "30", "45" });
}
}
public NumberPicker FindMinuteNumberPicker(ViewGroup viewGroup)
{
for (var i = 0; i < viewGroup.ChildCount; i++)
{
var child = viewGroup.GetChildAt(i);
var numberPicker = child as NumberPicker;
if (numberPicker != null)
{
if (numberPicker.MaxValue == 59)
{
return numberPicker;
}
}
var childViewGroup = child as ViewGroup;
if (childViewGroup != null)
{
var childResult = FindMinuteNumberPicker(childViewGroup);
if (childResult != null)
return childResult;
}
}
return null;
}
}`
bust it didn't work...
hope you have any ideas ...
FloKo
Xamarin.Forms TimePicker with 15 minutes Intervals?
how to pass min interval in the Xamarin Forms TimePicker.
I had solution for the renderer iOS:
[assembly: ExportRenderer(typeof(TimePicker), typeof(TimePickerRenderers))]
namespace Anjep_Toolbox.MobileApp.iOS.Renderer
{
public class TimePickerRenderers : TimePickerRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs e)
{
base.OnElementChanged(e);
if(e.NewElement != null)
{
var timePicker = (UIDatePicker)Control.InputView;
timePicker.Locale = new NSLocale("no_nb");
timePicker.MinuteInterval = new nint(15);
}
//if (Control != null)
//{
// Control.Text = DateTime.Now.ToString("HH:mm");
//}
}
}
}
but not found any working solution for the android platform.
so guys kindly let me know if you have a solution.
Please help me!