Quantcast
Channel: General — Xamarin Community Forums
Viewing all 5066 articles
Browse latest View live

Get OS installation date

$
0
0

Hi,

I would like to know if it's possible to get Operating System installation date (both on Android and iOS).
If yes, how can I get it?

Regards


Bluetooth Low Energy

$
0
0

I am trying to create a simple app to connect with my device and get data from it. the way the device works is that I have to pair with it, create a bond, and connect to the gatt server, then write some data to a characteristic in order to authenticate with the device. Once authenticated the device starts advertising again with encrypted data which I need to pick up.. The problem is when I am paired with the device in settings I am unable to get any of the advertise data when I scan. Is there any way to pick up advertise data from an already paired device?

No View Designer in Win7 VS2017

$
0
0

Hey all,
So I was doing some programming this weekend and I discovered that there is no XAML view designer in Xamarin for VS 2017? I know it's in the win10 version... is there any way to get the XAML designer to open when running win7? It would cost a lot of money to upgrade to win10 in updates to the OS (I'm on a hotspot). There is also a "UWP" checkbox when creating a blank cross platform template; but then when the project is built, there is no UWP specific project tree in the solution explorer? Can I create cross platform UWP apps in Win7? I just don't want to waste my time trying to get these things working if it's impossible in Win7. I think it's annoying if those two are not available in win7. Win7 is still officially supported, and is a fine OS...

thanks, in advance!

wifi on iOS

$
0
0

I'm trying to connect to wifi in iOS. I have the Android wifi working great.

The code I'm running in Main.cs is below. Any pointers are appreciated.

using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using NetworkExtension;
using TLXStatus.Droid;
using TLXStatus.iOS;
using UIKit;

[assembly: DefaultDependency(typeof(IWifiConnector))]

namespace TLXStatus.iOS { } 

public class Application
{

    static async Task Main(string[] args)
    {
        // if you want to use a different Application Delegate class from "AppDelegate"
        // you can specify it here.
        UIApplication.Main(args, null, "AppDelegate");

        bool x = await ConnectWpa("TLX_F8F005F4DF6B", "");

        var config = new NEHotspotConfiguration("TLX_F8F005F4DF6B", "", false);
        config.JoinOnce = false;
    }

Task<bool> ConnectWpa(string ssid, string password)
{
    try
    {
        var wifiConfig = new NEHotspotConfiguration(ssid, password, false) { JoinOnce = true };
        var wifiManager = new NEHotspotConfigurationManager();

        wifiManager.ApplyConfiguration(wifiConfig, (error) =>
        {
            if (error != null)
            {
                Console.WriteLine($"Error while connecting to WiFi network {ssid}: {error}");
            }
        });

        Console.WriteLine("Connected!");
        return Task.FromResult(true);
    }
    catch (Foundation.NSErrorException error)
    {
        Console.WriteLine(error.ToString());
        return Task.FromResult(false);
    }
    catch (Exception e)
    {
        Console.WriteLine(e.ToString());
        return Task.FromResult(false);
    }
}

IWifiConnector wifiConnector;

public interface IWifiConnector
{
    void ConnecttoWifi(string ssid, string password);
}

Is dynamically loading non-referenced DLL's allowed on iOS and Android?

$
0
0

Currently with our WinForms app we ship about 100+ vendor DLL's . These DLL's are not referenced by the WF app instead on app start we loop thru the folder where the DLL's reside and using reflection we examine each class type for a custom attribute and store off that type and some other info for a later point in time where the type's assembly will be dynamically loaded.

Is it permissible to carry out similar logic on iOS and Android? My initial hunch says no as I seem to remember reading somewhere that Apple does not allow you to ship un-referenced DLL's and load them dynamically on iOS but I don't know this for sure. Does anyone know whether or not this is allowed on iOS and Android? Thanks!

Convert Xamarin.Forms.Color to RGB

$
0
0

Hi there,

I have created a Page with RGB sliders for a custom app theming. Now I wanted to set the values of the sliders to the color which is the user about to change, so you can create a new theme from the base of the old one. This works relatively good, but I have problems with the Xamarin.Forms.color , when I have a colour like Dark green light pink the value of the sliders does not represent the color... Does anybody has an idea how I can convert those colors to RGB?

Cheers for your help
Martin Muenster

Is anybody monitoring the Mono Bugzilla?

Why do i get this Json exceptcion at parsing?

$
0
0

Hello there;

First than anything, my apologies for my English.

Well, i just started a few days ago with a new adventure, trying to make some apps for smartphones devices. So i pushed up a dev db and a php web service with just only a get request. When i get in my local network server "protocol://myip/webservicern/listado.php/" i get back this following JSON:

[{"codigo":"1","nombre":"Ivan","edad":"19","correo":"ivan.slytherin@gmail.com","pass":"123"}]

So, what i trying to do is from an android device do a http get request to parse this json in my app, for the moment just in a label.

So thats my class called User where is my "data structure"

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RN2.Clases
{
    public class User
    {
        public int codigo { get; set; }
        public string nombre { get; set; }
        public int edad { get; set; }
        public string correo { get; set; }
        public string pass { get; set; }

    }
}

Also this is my MainPage.cs

namespace RN2
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }

        protected override void OnAppearing()
        {
            base.OnAppearing();

        }

        private void Btn1_Clicked(object sender, EventArgs e)
        {
            Device.BeginInvokeOnMainThread(async () =>
            {
                Result client = new Result();
                var res = await client.Get<User>(myurlgoeshere); //cant publish the question if i keep the url 
                if (res != null)
                {
                    LabelChange.Text = "se cambio!!";

                }
            });

        }
    }
}

There suppose that when i touch the button, i call this method client.Get(myurlgoeshere).

Cause it wasnt working i commented the following class to see why it wasnt doing what it pretend.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Http;
using System.Threading.Tasks;

namespace RN2.Clases
{
 public class Result
    {
        public async Task<T> Get<T>(string url)
        {


                HttpClient client = new HttpClient();
                var response = await client.GetAsync(url);
                //if (response.StatusCode== System.Net.HttpStatusCode.OK)
                // {
                    var jsonstring = await response.Content.ReadAsStringAsync();
                    return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(jsonstring);
              //  }

             // return default(T);
        }
    }
}

Finally this is my excepction: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

Somewhere i read something about "Skip linking assamblies" under android option. It didnt work btw.

I tested this on virtual Android device and my own android device neither worked.

This is my first time posting something i hope that everything is clear.

By the way thank you


Suddenly can't debug and up against a deadline

$
0
0

I'm running VS 2017 15.6.4. Today I am unable to debug my Xamarin Forms app. I can run the app but the debugger will not start. Looking at the logs I am seeing this error. Any help would be great.

Mono.Debugging.VisualStudio.DebugLauncher|Error|0|Controller.Launch ()
Xamarin.VisualStudio.IOS.MonoTouchFlavoredProject|Error|0|An error occurred while lauching Application for debugging
System.Runtime.InteropServices.COMException (0x89710015): Unable to start debugging.

The system cannot find the file specified.

at Microsoft.VisualStudio.Shell.Interop.IVsDebugger4.LaunchDebugTargets4(UInt32 DebugTargetCount, VsDebugTargetInfo4[] pDebugTargets, VsDebugTargetProcessInfo[] pLaunchResults)
at Mono.Debugging.VisualStudio.DebugLauncher.StartDebugger(SoftDebuggerSession session, StartInfo startInfo) in E:\A_work\84\s\src\Debugging.VisualStudio\DebugLauncher.cs:line 49
at Mono.Debugging.VisualStudio.MonoDebuggerLauncher.StartSession(StartInfo startInfo, SoftDebuggerSession session) in E:\A_work\84\s\src\Debugging.VisualStudio\MonoDebuggerLauncher.cs:line 29
at Xamarin.VisualStudio.IOS.MonoTouchFlavoredProject.StartDebugging(MonoTouchDevice device, IProgressReport progress, MonoDebuggerLauncher debug_session) in E:\A_work\30\s\src\Core\VisualStudio.IOS\ProjectSystem\MonoTouchFlavoredProject.cs:line 985
at Xamarin.VisualStudio.IOS.MonoTouchFlavoredProject.<>c__DisplayClass77_0.b__0() in E:\A_work\30\s\src\Core\VisualStudio.IOS\ProjectSystem\MonoTouchFlavoredProject.cs:line 953

Create thumbnail from Video

$
0
0

I want to create 5 thumbnails from a video (at 5 different moment in the video) to let the user choose the thumbnail.
I did some search and I didn't find the good way to do that.
Can someone help me?
Thanks

Visual studio android emulator cannot connect to my local pc's asp.net web api

$
0
0

I have a web api running on iis on my pc. I start the visual studio 2015 android emulator and I want to reach the api through the browser on the emulator. It doesn't work and it gives me a time out.

When I go to other websites it works fine, so there is nothing wrong with the network switch setting (I guess). I tried the following things to get it working:
- I've checked the firewall settings the world wide webservices is switched on for inbound rules.

  • I have tried to reinstall the emulator also nothing works.
  • I typed the IP (http://192.168.135.145/myapi) on the browser of the computer it works fine. - I also turned off the firewall and tried it but with no succes.
  • I heve checked the virtual switch on the hyperv, it exists.

Am I missing something? It worked before but after updating windows, it doesn't.

I hope somebody can help me out.

Where is the DataSet and DataTable visualizer or previewer when debugging?

$
0
0

See here for visuals of how it's supposed to work: https://stackoverflow.com/a/1337092/10122542

This option is not there when I am debugging in Android. In the tiny popup I get when I hover over a DataSet variable while in break mode, I see my variable name, a vertical line, and then {System.Data.DataSet}. The magnifying glass between the vertical line and the data type is absent.

Is there any way to bring this back? It's super-helpful when debugging. If it makes a difference, I'm debugging in Android with Visual Studio 2017. Thanks.

1

Video-streaming with Mediarecorder over Sockets using ParcelFileDescriptor

$
0
0

Hi Every one,

I am facing problem to send video to server.

Why is there no EDIT Button on here?

$
0
0

Just wondering why I can't edit my posts, I have to reply to myself, and it's obnoxious. Especially when talking about code, where the smallest typo causes code to be unusable.


How to merge resource dictionaries from another assembly

$
0
0

This merges locally defined resource dictionaries:

<Application.Resources>


</Application.Resources>

How can I merge a resource dictionary located in another assembly?

The UWP syntax to accomplish this looks like this:
<ResourceDictionary.MergedDictionaries>

</ResourceDictionary.MergedDictionaries>

How do I do this in XAMARIN 3.x ??

web service automation using xamarin

$
0
0

Is it possible to do web service automation using xamarin?

Can't create SQLite DB :: System.IO.DirectoryNotFoundException

$
0
0

I'm new to mobile development in general and I tried following tutorials and already spent hours searching in forums for a solution for this problem. But here we go.
I'm using VS 2017 15.8.4 and Xamarin 4.11.0.756.
Here's the code that returns the dbPath:

                string filename = "dbManut.db3";
#if __ANDROID__
                string libraryPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
#else
                string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                string libraryPath = Path.Combine(documentsPath, "..", "Library");
#endif
                var path = Path.Combine(libraryPath, filename);
                return path;

And here's the line that creates the connection:

return new SQLiteConnection(dbName);

It doesn't detect any Exceptions when I debug, but when I try to run using amarin Live Player (unfortunately my PC does not have Acceleration, so no Virtualization for me):

(1,1): error: Failed to load assembly from stream: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path "/data/user/0/com.xamarin.live/files/.nuget/packages/sqlitepclraw.lib.e_sqlite3.android/1.1.11/lib/MonoAndroid/SQLitePCLRaw.lib.e_sqlite3.dll".
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0017d] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at System.IO.File.OpenRead (System.String path) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at <StartupCode$Continuous-Core-Droid>.$LocalFileSystem+Upsight-IFileSystem-OpenReadAsync@49-1.Invoke () [0x00011] in <5b4cad9611b47c3aa745038396ad4c5b>:0 
  at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.Threading.Tasks.Task.Execute () [0x00010] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path "/data/user/0/com.xamarin.live/files/.nuget/packages/sqlitepclraw.lib.e_sqlite3.android/1.1.11/lib/MonoAndroid/SQLitePCLRaw.lib.e_sqlite3.dll".
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0017d] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at System.IO.File.OpenRead (System.String path) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at <StartupCode$Continuous-Core-Droid>.$LocalFileSystem+Upsight-IFileSystem-OpenReadAsync@49-1.Invoke () [0x00011] in <5b4cad9611b47c3aa745038396ad4c5b>:0 
  at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.Threading.Tasks.Task.Execute () [0x00010] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.IO.DirectoryNotFoundException: Could not find a part of the path "/data/user/0/com.xamarin.live/files/.nuget/packages/sqlitepclraw.lib.e_sqlite3.android/1.1.11/lib/MonoAndroid/SQLitePCLRaw.lib.e_sqlite3.dll".
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0017d] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at System.IO.File.OpenRead (System.String path) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at <StartupCode$Continuous-Core-Droid>.$LocalFileSystem+Upsight-IFileSystem-OpenReadAsync@49-1.Invoke () [0x00011] in <5b4cad9611b47c3aa745038396ad4c5b>:0 
  at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.Threading.Tasks.Task.Execute () [0x00010] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 <---
<---

(1,1): error: Failed to load assembly from stream: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path "/data/user/0/com.xamarin.live/files/.nuget/packages/sqlitepclraw.provider.e_sqlite3.android/1.1.11/lib/MonoAndroid/SQLitePCLRaw.provider.e_sqlite3.dll".
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0017d] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at System.IO.File.OpenRead (System.String path) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at <StartupCode$Continuous-Core-Droid>.$LocalFileSystem+Upsight-IFileSystem-OpenReadAsync@49-1.Invoke () [0x00011] in <5b4cad9611b47c3aa745038396ad4c5b>:0 
  at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.Threading.Tasks.Task.Execute () [0x00010] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path "/data/user/0/com.xamarin.live/files/.nuget/packages/sqlitepclraw.provider.e_sqlite3.android/1.1.11/lib/MonoAndroid/SQLitePCLRaw.provider.e_sqlite3.dll".
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0017d] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at System.IO.File.OpenRead (System.String path) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at <StartupCode$Continuous-Core-Droid>.$LocalFileSystem+Upsight-IFileSystem-OpenReadAsync@49-1.Invoke () [0x00011] in <5b4cad9611b47c3aa745038396ad4c5b>:0 
  at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.Threading.Tasks.Task.Execute () [0x00010] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.IO.DirectoryNotFoundException: Could not find a part of the path "/data/user/0/com.xamarin.live/files/.nuget/packages/sqlitepclraw.provider.e_sqlite3.android/1.1.11/lib/MonoAndroid/SQLitePCLRaw.provider.e_sqlite3.dll".
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0017d] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at System.IO.File.OpenRead (System.String path) [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at <StartupCode$Continuous-Core-Droid>.$LocalFileSystem+Upsight-IFileSystem-OpenReadAsync@49-1.Invoke () [0x00011] in <5b4cad9611b47c3aa745038396ad4c5b>:0 
  at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.Threading.Tasks.Task.Execute () [0x00010] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 <---
<---

Don't know if it's something related to Live Player but I'm stuck in this for days.

Encryption/Decryption in Xamarin

$
0
0

Hi,
I'm working with local database, and I want to encrypt the strings when save to tables, when I want to show info from database to the user I want to decrypt the info.
I'm using an example that I found for .NET here http://www.codeproject.com/Articles/33350/Encrypting-Query-Strings
I'm not using it to encrypt querystrings but it works for everything.
the Encryption method works well, but the Decryption method always throws an System.Security.Cryptography.CryptographicException: Bad PKCS7 padding. Invalid length...
Searching on the web(google) I realized that is a general problem of Mono, but I cant find a solution that could make this example to work or any public solution.

It is possible to make the example to work in xamarin ?

IntuneMAMSdk

$
0
0

Hi,

Previously i have used IntuneMAMSDK-2.1.0.0 as a component in my project and its working fine.Now i have updated the intuneMAMsdk 8.1.1 with nuget package.
IPA is working fine. i have attached the screen shot also. please refer.

The following warnings are displayed in build.
warning MSB3491: Could not write lines to file "obj\iPhone\Release\_TelemetryProps".
2>~\packages\Microsoft.Intune.MAM.Xamarin.iOS.8.1.1\build\xamarinios10\Microsoft.Intune.MAM.Xamarin.iOS.targets(23,5): error MSB3098: "Exec" task received an invalid value for the "StdOutEncoding" parameter.
2>~\packages\Microsoft.Intune.MAM.Xamarin.iOS.8.1.1\build\xamarinios10\Microsoft.Intune.MAM.Xamarin.iOS.targets(23,5): error MSB3098: "Exec" task received an invalid value for the "StdErrEncoding" parameter.
2> IntuneMAMConfigurator[5709:45212] Success!!!

Viewing all 5066 articles
Browse latest View live