As far as I tested the MediaElement in Xamarin.Forms 4.7, it plays mp4 files, but not .m3u8 playlist files.
Is there a plan to support also the m3u8 file type in the future? Or is there another Xamarin Forms component that could handle m3u8 files?
Thank you.
Will the MediaElement support playing .m3u8 files in the future?
How to notify Picker about change of it's selected option' text?
Hi,
I've created a Picker bound to list of items, and the item object implements INotifyPropertyChanged.
I need to update text of selected option, but couldn't make the Picker reflect the change.
Any help is appreciated.
Regards,
Mehmet
PostAsync has occurred “the request timed out” on iOS Xamarin Forms
I use xamarin forms to create an mobile app for Android and iOS. I need to make Http Request, so I use HttpClient.
Here is a simple code of request :
var client = new HttpClient(); try { string requestUrl = URL_DATABASE + "xxx"; var content = new StringContent("{\"param\":\"" + param+ "\"}", Encoding.UTF8, "application/json"); var response = await client.PostAsync(requestUrl, content); if (response.StatusCode == HttpStatusCode.OK) { var result = await response.Content.ReadAsStringAsync(); return result; } return "{\"status\":-1}"; } catch (Exception ex) // Error catched : "the request timed out" { return "{\"status\":-1}"; }
I used Postman to check result of my request and work's well, I got good response without timeout.
I noticed that error occurs sometimes but can last an hour.
Thank you in advance for your help
Device.RuntimePlatform not resolved in some files
Hi,
When using the RuntimePlatform attribute in some files, the VS cannot resolve the symbol. I have grouped my code in two folders (called "Misc" and "Models").
Inside the Models directory, the Device.RuntimePlatform is found and works as expected.
Inside the Misc directory (manually created by me), I get "The name 'Device.RuntimePlatform' does not exist in the current context." and the "using Xamarin.Forms" statement stays greyed out.
The Xamarin.Forms."Device" assembly is present and the RuntimePlatform attribute is there.
May you please advise how to figure this out?
how to apply fadding effect in collectionview
In a page there is image at the bottom which covers 30% of the page and above is the CollectionView. If user scrolling up the CollectionView, items(last items of the collection) has to be appeared using fading effect and when scrolling down item has to be disappeared using fading effect.
How can I achieve it ? Any suggestion will be appreciated !
Xamarin.Essentials.Browser.Openasync is not closing after activity in iOS
When Auth0 URL is passed to Xamarin.Essentials.Browser.Openasync to open the browser, after authentication in android Callback url is handled and continuing to corresponding ContentPages. But in iOS i'm getting the callback from OpenUrl function in AppDelegate but the browser is not closing. And even if we forcibly dismiss the ViewController of browser, Still the navigation to corresponding ContentPages is not happening. But can see the compiler is going through corresponding codes while debugging and the view is not appearing.
can't call page erro Object reference not set to an instance of an object
Greeting everyone i'm still newbie in Xamarin.form platform i'm trying to create StockCount app
so i'm using c# markup on my app and everything was working fine but this page when i try to call it i got this error messages
and this is my code for that page
using SQLite; using StockCount.Models; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using Xamarin.Forms; namespace StockCount.Views { public class Stocktaking : ContentPage { private Entry _barcodeEntry; private ListView _listViewStocking; public string NameST2; public string NumberST2; public string BarcodeST2; public int QtyST2; string _dbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "StockCountDB.db3"); public Stocktaking() { this.Title = "StokingPage"; _barcodeEntry.Focus(); var db = new SQLiteConnection(_dbPath); StackLayout stackLayout = new StackLayout(); _barcodeEntry = new Entry(); _barcodeEntry.Keyboard = Keyboard.Text; _barcodeEntry.Placeholder = "Barcode here"; _barcodeEntry.Completed += _barcodeEntry_Completed; ; stackLayout.Children.Add(_barcodeEntry); _listViewStocking = new ListView(); try { _listViewStocking.ItemsSource = db.Table<StocktakingTB>().OrderBy(x => x.NameST).ToList(); } catch { } stackLayout.Children.Add(_listViewStocking); Content = stackLayout; } private void _barcodeEntry_Completed(object sender, EventArgs e) { var db = new SQLiteConnection(_dbPath); string searchbarcodetext = _barcodeEntry.Text; if (db.Table<ProductsTB>().Count(o => o.BarcodeProduct == searchbarcodetext) == 0) { DisplayAlert("Error", "not found Barcode", "OK"); } else { if(db.Table<StocktakingTB>().Count(o => o.BarcodeST == searchbarcodetext) == 0) { NameST2 = db.Table<ProductsTB>().Where(o => o.BarcodeProduct == searchbarcodetext).SingleOrDefault().ProductName; NumberST2 = db.Table<ProductsTB>().Where(o => o.BarcodeProduct == searchbarcodetext).SingleOrDefault().ProductNumber; BarcodeST2 = db.Table<ProductsTB>().Where(o => o.BarcodeProduct == searchbarcodetext).SingleOrDefault().BarcodeProduct; db.CreateTable<StocktakingTB>(); StocktakingTB stocktaking = new StocktakingTB() { NameST = NameST2, NumberST = NumberST2, BarcodeST = BarcodeST2, Qty = 1 }; db.Insert(stocktaking); NameST2 = ""; NumberST2 = ""; BarcodeST2 = ""; _listViewStocking.ItemsSource = db.Table<StocktakingTB>().OrderBy(x => x.NameST).ToList(); _barcodeEntry.Text = ""; _barcodeEntry.Focus(); } else { NameST2 = db.Table<ProductsTB>().Where(o => o.BarcodeProduct == searchbarcodetext).SingleOrDefault().ProductName; NumberST2 = db.Table<ProductsTB>().Where(o => o.BarcodeProduct == searchbarcodetext).SingleOrDefault().ProductNumber; BarcodeST2 = db.Table<ProductsTB>().Where(o => o.BarcodeProduct == searchbarcodetext).SingleOrDefault().BarcodeProduct; //var db = new SQLiteConnection(_dbPath); StocktakingTB stocktaking = new StocktakingTB() { NameST = NameST2, NumberST = NumberST2, BarcodeST = BarcodeST2, Qty =+ 1 }; db.Update(stocktaking); } } } } } -------------------------------------
and this is table which i'll inserted to
using SQLite; using System; using System.Collections.Generic; using System.Text; namespace StockCount.Models { class StocktakingTB { public string NameST { get; set; } public string NumberST { get; set; } public string BarcodeST { get; set; } public decimal Qty { get; set; } public override string ToString() { return this.BarcodeST + "- " + this.NameST + "(" + this.Qty + ")"; } } }
Problem with conditional compilation
Good day!
if I run this fragment
var sCheck = "universal code";
# if _ ANDROID _
sCheck = "Android code";
# endif
on android device (or emulator) sCheck always has "universal code" value (I wait for "Android code" value). What I am doing wrong ?
I use Visual Studio Community 2017.
Thanks in advance for your help
frame1_ChildAdded event not firing after some time
Dear All,
I have a frame name frame1 inside a collectionview. Whenever new item is inserted it should fire event. But its not firing this event sometimes. I want to show alert and highlight newly added item whenever new item is added to observable collection using SignalR
Thanks
Xamarin iOS is not working on release mode
I am trying to generate an archive of my iOS project but I can't, everything is working fine on debug mode but when I go to release mode the process fails, I am getting this error:
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: The "XamlCTask" task failed unexpectedly.
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: Mono.Cecil.Cil.SymbolsNotFoundException: No symbol found for file: /myproject/test/obj/iPhone/Release/test.exe
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018:
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018:
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: Server stack trace:
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Mono.Cecil.Cil.DefaultSymbolReaderProvider.GetSymbolReader (Mono.Cecil.ModuleDefinition module, System.String fileName) [0x000a4] in <02cd44f94ebd4355b3be9e1dbd9d77a1>:0
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Mono.Cecil.ModuleReader.ReadSymbols (Mono.Cecil.ModuleDefinition module, Mono.Cecil.ReaderParameters parameters) [0x00032] in <02cd44f94ebd4355b3be9e1dbd9d77a1>:0
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Mono.Cecil.ModuleReader.CreateModule (Mono.Cecil.PE.Image image, Mono.Cecil.ReaderParameters parameters) [0x00081] in <02cd44f94ebd4355b3be9e1dbd9d77a1>:0
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Mono.Cecil.ModuleDefinition.ReadModule (Mono.Disposable1[T] stream, System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0000d] in <02cd44f94ebd4355b3be9e1dbd9d77a1>:0 /myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0006c] in <02cd44f94ebd4355b3be9e1dbd9d77a1>:0 /myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Mono.Cecil.AssemblyDefinition.ReadAssembly (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <02cd44f94ebd4355b3be9e1dbd9d77a1>:0 /myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Xamarin.Forms.Build.Tasks.XamlCTask.Execute (System.Collections.Generic.IList
1[System.Exception]& thrownExceptions) [0x0023e] in <194637163a754df3b62b8bf9aa013363>:0
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Xamarin.Forms.Build.Tasks.XamlTask.Execute () [0x00000] in <194637163a754df3b62b8bf9aa013363>:0
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at (wrapper remoting-invoke-with-check) Xamarin.Forms.Build.Tasks.XamlTask.Execute()
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at (wrapper xdomain-dispatch) Xamarin.Forms.Build.Tasks.XamlTask.Execute(object,byte[]&,byte[]&)
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018:
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: Exception rethrown at [0]:
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at (wrapper xdomain-invoke) Xamarin.Forms.Build.Tasks.XamlTask.Execute()
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:575
/myproject/packages/Xamarin.Forms.4.7.0.1080/build/Xamarin.Forms.targets(114,3): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002a9] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-12/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:818
Here are my computer details
=== Visual Studio Enterprise 2019 for Mac ===
Version 8.6.5 (build 23)
Installation UUID: 65aaf5c2-46d5-4ee1-9383-d27decdcf313
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 ===
Version: 5.6.0.6591
=== .NET Core SDK ===
SDK: /usr/local/share/dotnet/sdk/3.1.301/Sdks
SDK Versions:
3.1.301
3.1.300
3.1.200
3.1.102
3.1.101
3.1.100
3.0.101
3.0.100
2.2.300
2.2.103
2.1.505
2.1.302
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Sdks
=== .NET Core Runtime ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.1.5
3.1.4
3.1.2
3.1.1
3.1.0
3.0.1
3.0.0
2.2.5
2.2.1
2.1.19
2.1.18
2.1.17
2.1.15
2.1.14
2.1.13
2.1.9
2.1.2
=== Xamarin.Profiler ===
Version: 1.6.12.29
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Updater ===
Version: 11
=== Apple Developer Tools ===
Xcode 11.5 (16139)
Build 11E608c
=== Xamarin.Mac ===
Version: 6.18.2.1 (Visual Studio Enterprise)
Hash: 29c4ea731
Branch: d16-6
Build date: 2020-05-26 17:03:04-0400
=== Xamarin.iOS ===
Version: 13.18.2.1 (Visual Studio Enterprise)
Hash: 29c4ea731
Branch: d16-6
Build date: 2020-05-26 17:03:05-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 ===
Version: 10.3.1.4 (Visual Studio Enterprise)
Commit: xamarin-android/d16-6/3a10de9
Android SDK: /Users/oscarumc/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
8.0 (API level 26)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.6
SDK Build Tools Version: 29.0.2
Build Information:
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 OpenJDK for Mobile ===
Java SDK: /Users/oscarumc/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_8.0.25
1.8.0-25
Android Designer EPL code available here:
=== Android SDK Manager ===
Version: 16.6.0.50
Hash: 5901879
Branch: remotes/origin/d16-6
Build date: 2020-06-10 22:42:50 UTC
=== Android Device Manager ===
Version: 16.6.0.96
Hash: 6e8b80b
Branch: remotes/origin/d16-6
Build date: 2020-06-10 22:43:28 UTC
=== Build Information ===
Release ID: 806050023
Git revision: 5289d413b99fddfc20b4ecf3e445ccb822213427
Build date: 2020-06-18 12:08:30-04
Build branch: release-8.6
Xamarin extensions: 5289d413b99fddfc20b4ecf3e445ccb822213427
=== Operating System ===
Mac OS X 10.15.5
Darwin 19.5.0 Darwin Kernel Version 19.5.0
Tue May 26 20:41:44 PDT 2020
root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
Getting (com.apple.AuthenticationServices.AuthorizationError error 1000)
Getting (com.apple.AuthenticationServices.AuthorizationError error 1000) on calling AppleSignInAuthenticator.AuthenticateAsync(). I added apple signin key 'com.apple.developer.applesignin' in Entitlements as documented. But i'm getting access token from WebAuthenticator.AuthenticateAsync(authorizationUrl, callbackUrl)
navigation to root after closing dialog Prism xamarin
Hi all,
I'm using IDialogService to show Dialog. When I click cancel, I want to navigate back to the root page and not to the page that it's displayed on.
so I did the following:
public DetectedCorrectlyDialogViewModel(IDialogService dialogService,INavigationService navigationService)
{
_dialogService = dialogService;
_navigationService = navigationService;
NameFieldCommand = new DelegateCommand(NavigateToAddFieldDialog);
BackCommand = new DelegateCommand(Back);
}
private void Back()
{
RequestClose(null);
await _navigationService.GoBackToRootAsync();
}
but it doesn't work. what should I do to achieve this.
Content of a frame that is the View of a ViewCell appear on top of other rows in the list - iOS only
Hi,
I updated to the latest Xamarin.Forms version (4.7.0.1080) and now a list view I have in my project is totally messed up - the template of the list view is set to a custom view cell that it's View is set to a frame and now the content of the rows appear on top of each other.
I found this same problem in this sample - https://docs.microsoft.com/en-us/samples/xamarin/xamarin-forms-samples/boxview-listviewcolors (see screenshot)
Does anyone have a fix for this problem?
Thanks!
ListView Grouping issues on UWP
I am facing two issues with grouping in ListView on UWP. They are:
- In Group Header by default it shows the GroupShortNameBinding rather than the GroupDisplayBinding (which is the default for Android & iOS). I can get to display the GroupDisplayBinding only if I define a GroupHeaderTemplate. Is that the only way?
- If leave it to the default settings, tapping on a group header shows the single letter based jump list. But if I use the GroupHeaderTemplate, tapping a group header clears the screen and the app hangs. How can prevent taps on group header, as I don't need have a jump list?
I did find some threads in this forum on ListView grouping. But it appears they never had these issues as no one reported it. Is it a recent issue or am I the only one having it?
Fly Item To Cart Tab in Tabbed Page
I want to fly an item to cart tab in cart page on item image clicked..Is there any way to implement it in xamarin forms? I need it..plz help
Service doesn't work when device sleeps
I've built a simple service which works fine.
public class FibonacciJob : JobService { public override bool OnStartJob(JobParameters jobParams) { int x = jobParams.Extras.GetInt("secondsToWait", -1); Task.Run(() => { Thread.Sleep(1000*x); JobFinished(jobParams, false); }); return true; } public override bool OnStopJob(JobParameters jobParams) { return false; } }
The calling to the service is done by the next class:
public class Class1: I1 { public const string JobSchedulerService = "jobscheduler"; public void F1(int seconds) { var instance = MainActivity.Instance; Java.Lang.Class javaClass = Java.Lang.Class.FromType(typeof(FibonacciJob)); ComponentName component = new ComponentName(instance, javaClass); var jobParameters = new PersistableBundle(); jobParameters.PutInt("secondsToWait", seconds); JobInfo.Builder builder = new JobInfo.Builder(1, component) .SetMinimumLatency(10000) .SetOverrideDeadline(10000) .SetExtras(jobParameters); JobInfo jobInfo = builder.Build(); JobScheduler jobScheduler = (JobScheduler)instance.GetSystemService(JobSchedulerService); int result = jobScheduler.Schedule(jobInfo); } }
The problem is that when I switch the phone to sleep mode (click the button on the device's side, so the screen is turned off),
the service doesn't work- the SetOverrideDeadline(10000) will not be taken in account.
Nothing will happen no matter how much time will pass.
How can I cause the service to start after X time (Lets say 1 hour) , no matter if the device sleeps or not.
Why is it necessary to re-install a NuGet package for an existing class?
I'm curious why this is necessary and wonder if my understanding is at fault. I have installed the NuGet package Xam.Plugin.Media within an existing solution that was already in development. I installed it for the solution and the Android project, before making any code changes. When I then insert my code from another separate and already-working application, it doesn't recognise the references to the NuGet package even though it's already installed for this solution:
using Plugin.Media; using Plugin.Media.Abstractions; if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported) { }
I then follow its offer to auto-correct, and it shows within the drop-down menu that there is a local version 5.0.1 already. Choosing this rectifies the problem, but as far as I can see there is no code change to my class as a result of this. What has it done to my solution in order to resolve this? Does this mean that NuGet packages and versions are specific to each class? If so, where is this information stored? Image of the whole thing is below, showing the menu.
Random WebService Timeouts
I am getting random webservice timeouts and I can't figure out why, it is only happening when calling the webservice from the Xamarin app. If I test the webservice in SoapUI, and even spam it with requests, I get 100% success and return values. But when calling the same webservice in Xamarin about 30% of the calls never return and eventually timeout. But on the backend I and see the calls 100% of the calls made it to the webservice and worked, but Xamarin isn't getting the response 30% of the time.
Webservice is C# asmx webservice, which is added via the connected services in the Xamarin project.
The call is pretty simple
PhoneWSServiceReference.PhoneWebServiceSoapClient wsclient = new PhoneWebServiceSoapClient(EndPointName); WSHelper.SetWSTimeOut(ref wsclient, 20); BaseResponse response = wsclient.UserLogin(UserName, Password);
But 30% of the time I get "System.TimeoutException: 'The operation has timed out.'"
I am using the IsBusy flag, setting it to true just before the webservice call and false after it. Is there a better way to call the asmx webservices?
Customize ListView
Hey,
I want to create a custom cell which should describe a transaction (like a banking app). The transactions should be group by there date.
The cell should look like the one in the attached photo.
My question is, is this possible with Xamarin.Forms?
I could create a cell with space between them using the DataTemplate for the ListView but there are two other major problems:
- How can I customize the grouping header (Label and Background) from the ListView?
- How can I change the selected background to only apply on my custom frame (not the entire cell, because I use space between them by "actual" cell
is a view inside the cell with margins around them)?
Is it better to use a Scroll view with custom views like cards for this? What is the performance of a ScrollView is like when there are many cells/views in there?
I have searched a lot but don't find anyone who is using such cells...
Thanks for your help!!
Flo
How to send image to api using image path
I have this method that gets image from device storage and send it to api
var media = CrossMedia.Current;
var file = await media.PickPhotoAsync();
// wait until the file is written while (File.ReadAllBytes(file.Path).Length == 0) { System.Threading.Thread.Sleep(1); } var content = new MultipartFormDataContent(); content.Add(new StreamContent(file.GetStream()), "\"file\"", $"\"{file.Path}\""); var httpClient = new HttpClient(); var httpResponseMessage = await httpClient.PostAsync(URL, content);
How to do this using image path without getting image from device storage