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

Setting BaseUrl on files loaded from Environment.SpecialFolder.LocalApplicationData

$
0
0

This should probably be straightforward but it's been giving me a headache.
Basically I'm creating an app that downloads a zip file containing html, css, javascript etc.
It unzips the contents and stores them in LocalApplicationData, loades the index.html into a webview likes so:

HtmlWebViewSource html = new HtmlWebViewSource();

html.Html = htmlString;
html.BaseUrl = DependencyService.Get().Get();
courseWindow.Source = html;

All of this works just fine, except I end with unformatted html, no scripts running etc..
I'm assuming this has to do with the baseURL but could it be something else like resources being blocked from loading?

If anybody has come upon the same issue or could point me in the right direction that would be great.


Unable to read from a Bluetooth socket

$
0
0

I am trying to communicate with a Bluetooth device.
I have succeeded in outStream.Write(outBuf, 0, outBuf.Length); but int readLen = inStream.Read(inBuf, 0, inBuf.Length); never returns.

I am sure that the device has successfully received the bytes I sent and returned some bytes.
I have written a Java version of this program and it works well, but now get problem on C# Xamarin.

Here is my code, please anybody help me:

        BluetoothSocket btSocket = null;
        BluetoothAdapter mBluetoothAdapter = null;
        try{
            mBluetoothAdapter = BluetoothAdapter.DefaultAdapter;
        }
        catch (Exception e){

        }
        if (mBluetoothAdapter == null){
            return null;
        }


        ICollection<BluetoothDevice> boundSet = mBluetoothAdapter.BondedDevices;
        BluetoothDevice btDevice1 = boundSet.ElementAt(0);
        btSocket = btDevice1.CreateRfcommSocketToServiceRecord(UUID.FromString("00001101-0000-1000-8000-00805F9B34FB"));
        mBluetoothAdapter.CancelDiscovery();
        try{
            btSocket.Connect();
        }
        catch (Exception e)
        {
            return e.Message;
        }

        Stream outStream = btSocket.OutputStream;
        Stream inStream = btSocket.InputStream;
        //inStream.ReadTimeout = 5000;
        byte[] outBuf = new byte[5] { 0xAC, 0x00, 0x00, 0x74, 0xAA };
        byte[] inBuf = new byte[1];
        outStream.Write(outBuf, 0, outBuf.Length);

        int readLen = inStream.Read(inBuf, 0, inBuf.Length);   //This line NEVER returns.
        return string.Format("readLen{0} {1} readRet!", readLen, inBuf[0]);

Thank you very much.

Possible bug in Visual Studio for Mac 7.7.4

$
0
0

Hi All,

I am new to Xamarin, but I have 18 years development experience in .Net.

I upgraded to VS2017 Community Edition for mac to version 7.7.4 today.

I then started getting the following event error code. The attached error code was generated when I tried to enter values into Single Line enty in the FormsGallery project using the iOS simulator.

I am getting the same error in my main App project, interestingly the App has not crashed, so I am trying to determine whether the issue is in the application, the sumulator, or the Application output log.

I hope someone can help.

Regards

Ross

Extract from Application Output:

2019-02-03 21:29:40.111993+1100 FormsGallery.iOS[3573:99148] SecTaskLoadEntitlements failed error=22 cs_flags=200, pid=3573
2019-02-03 21:29:40.112705+1100 FormsGallery.iOS[3573:99148] SecTaskCopyDebugDescription: FormsGallery.iOS[3573]/0#-1 LF=0
2019-02-03 21:29:40.127757+1100 FormsGallery.iOS[3573:99148] libMobileGestalt MobileGestalt.c:890: MGIsDeviceOneOfType is not supported on this platform.
2019-02-03 21:30:09.988279+1100 FormsGallery.iOS[3573:99148] SecTaskLoadEntitlements failed error=22 cs_flags=200, pid=3573
2019-02-03 21:30:09.988497+1100 FormsGallery.iOS[3573:99148] SecTaskCopyDebugDescription: FormsGallery.iOS[3573]/0#-1 LF=0
2019-02-03 21:30:21.217978+1100 FormsGallery.iOS[3573:99148] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"",
"",
"",
"",
"",
""
)

Will attempt to recover by breaking constraint

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2019-02-03 21:30:21.219537+1100 FormsGallery.iOS[3573:99148] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"",
"",
"",
"",
"",
""
)

Will attempt to recover by breaking constraint

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

BrainTree SDK Bindings for Android & iOS

Creating a ListView embedded in a ScrollView

$
0
0

Hello, I am trying to create a ListView embedded in a ScrollView. My main issue is that I want this ListView to have cells that cover all of the page. So, each cell is a page long and a page wide. I am using Xamarin.Forms to develop an Android and an iOS app. I am also trying to make it so that each cell has a background image and a label in front of that image. How can I achieve this?

App crash when denied location permission in Xamarin iOS

$
0
0

i need to have location in my app and app got crash when user denied the location permission by clicking "Don't Allow". i got "System.Reflection.TargetInvocationException". but once i again start again even on that time the permission is denied its not crashing . in android its working fine .Do i need to update permission plugin or change in info.Plist? i gave all three permission in info.Plist for Location . here is my code .

  var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Location);
        if (status != PermissionStatus.Granted)
        {
            if (await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Permission.Location))
            {
                await Application.Current.MainPage.DisplayAlert("Location denied", "app needs access to location for this operation.", "OK");
            }

            var results = await CrossPermissions.Current.RequestPermissionsAsync(Permission.Location);
            status = results[Permission.Location];
        }
        if (status == PermissionStatus.Granted)
        {
              // do something
        }
        else if (status != PermissionStatus.Unknown)
        {
              // Crash when user denied permission 
        }

Label TextColor Binding on iOS doesn't updates

$
0
0

Hi,

I have a very simple page, just with one label whose text color is data bound to a property in VM. However the color of the text updates fine on Android each time the property changes but doesn't updates on iOS at all.

There seems to be a bug in iOS. Can you please address this issue?

I am using XF 3.4

when all BindableProperties get initialized from XAML regardless their declaration order?

$
0
0

This happens a lot when creating custom controls (mostly in code only). In many cases some properties (if not all) are dependent on each other, like for example: ItemsSource and DisplayMemberPath .. etc- I need to know the value of DisplayMemberPath while I'm iterating over the ItemsSource to render controls (set the Text of a Label to the value of DisplayMemberPath).

when I process Items in the ItemsSource collection I want to make sure that the DisplayMemberPath property has also been set,
when using the propertyChanged delegate of the ItemsSourceProperty it's likely that the DisplayMemberPathProperty is null, if it's set in XAML after ItemsSource:

<controls:FlowList ItemsSource="{Binding Items}" DisplayMemberPath="Title"/>

so, where is the proper place where I'll be sure every property has been set regardless their declaration order?


Adding microsoft.net.http to an application

$
0
0

Hi,

I'm currently part way through porting an iOS app over to macOS. Pretty much everything is done, but when I come to testing I'm getting this error

Method not found: void System.Net.Http.HttpClientHandler.set_AutomaticDecompression(System.Net.DecompressionMethods)

I'm using FubarRestSharp in my mvvm project which from memory uses Microsoft.Net.Http for the decompression. The answer to get rid of this error is to add the Microsoft.Net.Http package from nuget but the problem is that the version on nuget (2.2.29) isn't happy with macOS. I've tried adding a handler in the code calling the web service, but that's not cutting it either.

I've tried just adding a reference back to the packages, but that's not working either.

Any ideas?

Speech to text - using with Emulator

$
0
0
Hi everyone. I’m using the following sample to test the STT feature.
Unfortunately the mic Dialog is unable to capture audio when I use an emulator.
What could be the reason for this?
I’m unable to post links ( for real, forum admin?) so please concat and paste github.com dev-aritra/XFSpeech

How to get Image from directory path in xamarin forms

$
0
0

I want to retrieve image which i have it's path in phone

filepath = "/storage/emulated/0/Android/data/com.CommunicatorEye/files/Pictures/EmployeesCards/IMG_20190131_143513.jpg";

var image = DependencyService.Get<IDependency().RetriveImageFromLocation(filepath);

IDependency.cs

 public interface IDependency
    {
        Task<Image> RetriveImageFromLocation(string location);
    }

Android DependencyImplementation.cs

public async Task<Image> RetriveImageFromLocation(string location)
        {
            Image image = new Image();
            var memoryStream = new MemoryStream();

            using (var source = System.IO.File.OpenRead(location))
            {
                await source.CopyToAsync(memoryStream);
            }

            image.Source = ImageSource.FromStream(() => memoryStream);
            return image;
        }

but it doesn't work for me , any sample ?

SQLite.Net.Platform.XamarinAndroidN 3.1.1

$
0
0

hello

please iam trying install SQLite.Net.Platform.XamarinAndroidN on xamarin.forms i can not install (restored failed) all time until on fresh xamarin project .

Package SQLite.Net.Platform.XamarinAndroidN 3.1.1 is not compatible with monoandroid80

any solution for this

navigation, listview, buttons,... with keyboard

$
0
0

Hello,
I have published an app for Android with Xamarin forms and I have received various Request About use with keyboard. My native app for UWP works correctly and I have checked varoius apps on Android and they support use a keyboard. So, I have searched information of keyboard but I haven't found it or I haven't known how I have to search. is it necessary some package special?
Thanks you

Visual Studio for Windows/Mac not showing all simulators bug

$
0
0

Yes, i put bug in title as that is what I believe this is.

I spent a lot of time trying to fix things and I documented it all here. https://forums.xamarin.com/discussion/comment/362759#Comment_362759
Unfortunately, the problem came right back.

Summary:

Using Visual Studio 2017 15.9.6 with a Xamarin.Forms project. I found I am having no issues connecting to my Mac2011, but my Mac2018 is missing simulators of iPhone 7 and above.

I went thru many steps, ultimately I re-installed the Mac fresh and using a test project I connected and found all the simulators were there.
However as soon as I connect while my main project is open, these simulators no longer appear.

Let me take this moment to say, "Thanks to all the Xamarin creators/contributors/supports for this awesome Xamarin magic".

Considering all my steps... these VS tools appear to have a nasty bug.
I've been working for over a year to deliver this app... and now the tooling is blocking me.

Please share any suggestions, but at this point, I think I need paid support services, so I'm not sure which direction to go up the support ladder.

Thanks.

Problem with ImageButton when changing the Source-Image

$
0
0

Hi,

I'm using the new ImageButton to implement a ToggleButton which switches between a "Locked" and "Unlocked" state.
The "Source"-Property is bound to a bool-Property in the ViewModel and using a ValueConverter to set the name of the according image:

            <ImageButton                    
                Command="{Binding ToggleLockStateCommand}"
                BackgroundColor="Transparent"
                Source="{Binding Locked, Converter={StaticResource cnvLockStateToImage}}">

Changing the images works as expected but after changing the image is not correctly sized, it randomly switches between "very small" and the original size.

I already verified that the ImageButton doesn't change its size when the Source is changed (which is expected as the two images are of the same size).

Anybody has an idea how to fix this (or maybe it's a bug?) My target-platform is Android.

-Michael


Lost sqlite data in Windows 10 tablet after restart

$
0
0

Hi,

I developed small app using Xamarin Forms with SQLite database, data are saving in SQLite database in developer machine, no issue
after create store package (sideloading) for UWP
and after install one is my Windows tablet then app is working fine with data, but when after restart windows tablet, I lost all data

Please help
anything I am missing for windows tablet setting or anything else

Thanks
Rizwan

Decryption Unsuccessful Message

$
0
0

I am attempting to run the HELLO, ANDROID; QUICKSTART.

After I follow the instruction: RUN THE APP. Test the application by running it on an Android device or emulator. When I click ANDROID-ACCELATED-X86 I get this message DESCRYPTION UNSUCCESSFUL The password you entered is correct, but your data is corrupt. To resume using the phone, you need to perform a factory reset. When you set up your phone after the reset, you will have an opportunity to restore data that was backed up to your goggle account. What steps should I take. I need help on this matter.

How can I search the forums

$
0
0

How can I search to see if anyone have ask a question that I have so I can get the answer without asking a the same question?

Testing a backend API locally for Xamarin Forms using IP address

$
0
0

I have a simple asp.net core api backend project that serves a Todo API and a xamarin forms app that consumes it. When I run the backend API, the project runs on IIS Express on localhost:44374. Now for purposes of testing my android or ios app, i can't use localhost as my endpoint, I think i need to specify the actual ip address like so: 192.168.1.72:44374.

That doesn't work directly, and its supposedly an issue with IIS Express bindings. I have searched high and low on Stackoverflow and other places for a solution, but haven't really been able to find one. I am assuming someone here has had the same issue.

What is the suggested workaround?

Testing a backend API locally for Xamarin Forms using IP address

$
0
0

I have a simple asp.net core api backend project that serves a Todo API and a xamarin forms app that consumes it. When I run the backend API, the project runs on IIS Express on localhost:44374. Now for purposes of testing my android or ios app, i can't use localhost as my endpoint, I think i need to specify the actual ip address like so: 192.168.1.72:44374.

That doesn't work directly, and its supposedly an issue with IIS Express bindings. I have searched high and low on Stackoverflow and other places for a solution, but haven't really been able to find one. I am assuming someone here has had the same issue.

What is the suggested workaround?

Viewing all 204402 articles
Browse latest View live


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