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

What is equivalent to Android.Widget.ListView.NestedScrollingEnabled in versions before 21?

$
0
0

I am developing custom renderer for android to enable the nested scrolling for a ListView and I'm using Android.Widget.ListView.NestedScrollingEnabled attribute and it works fine but that attribute is added in API level 21 and I am wondering what is equivalent to it in versions before 21?


Can't debug on android devices in visual studio

$
0
0

Since I have started with Xamarin I have had problems getting the android debugging to work.

Every time I deploy a Xamarin Forms (PCL) project to my phone (LG G Flex 2, Android 5.1 lollipop), the deploy succeeds, enters debug mode for about 6 or 7 seconds, then goes out of the debug mode without any errors and closes the app on my phone. The app is installed however and I can use it afterwards.

I have a laptop and a pc, both running Visual Studio 2015 update 2, both have the same problem with every project.
These problems only occur when debugging for Android, not for Windows or Windows Phone, (no idea about IOS).

The output tab (Debug) only shows:
Android application is debugging. Couldn't connect to logcat, GetProcessId returned: 0
That last line is only showed on my laptop and not on my pc.

The output from Xamarin Diagnostics :
[D:RunShellCommand]: LGH955833bfe56 getprop [D:RunShellCommand]: LGH955833bfe56 getprop [D:RunShellCommand]: LGH955833bfe56 date +%s [D:RunShellCommand]: LGH955833bfe56 setprop "debug.mono.extra" "debug=127.0.0.1:8865:8866,timeout=1464533426,loglevel=0,server=y" [D:RunShellCommand]: LGH955833bfe56 am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "Project.Droid/md5ebb414a62e6ccdc1a237d6523954780b.MainActivity" [D:RunShellCommand]: LGH955833bfe56 ps [D:RunShellCommand]: LGH955833bfe56 am force-stop Project.Droid [D:RunShellCommand]: LGH955833bfe56 setprop "debug.mono.connect" ""

As you can see it forces the application to close for some reason, but i have no idea what's causing it.
On my pc the output is about the same except for 2 extra lines concerning the logcat.

Any idea on how to fix this?

Custom tool ResXFileCodeGenerator failed to produce an output for input file

$
0
0

Severity Code Description Project File Line Suppression State
Error Custom tool ResXFileCodeGenerator failed to produce an output for input file 'Multilingual\AppMultilingualResource.he.resx' but did not log a specific error. shaot_standard

Xamarin Forms Draw grid over camera view

$
0
0

Hello,
I've been searching for some time now and the only thing I found was drawing over the camera view, but this was only in a Xamarin.Android project which is coded with .axml files. My question was: How can I draw a grid over the camera view using the xamarin cross platform project which is coded in xaml. I want to create something like what is done in photomath

UnitTest with FFImageLoading

$
0
0

I couldn't find any example for unit test, and I always get the error Could not load file or assembly 'FFImageLoading.Platform, Version=2.4.4.859, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified

ToolbarItem with Order="Secondary" not functional in iOS?

$
0
0

It is not a problem that they appear as Buttons (???) inbetween the Title and the ListView in iOS. But when I tap them the Clicked events are not fired.

Is that normal? How do I make them functional in iOS?

Three questions on ContextAction's behavior

$
0
0

First, Aren't ContextAction's available in UWP at all?

Second, I see the sliding for ContextAction buttons be visible is available in iOS only. Can't we get sliding for actions in Android?

Third, In iOS they appear only on sliding from right to left. I don't find any property to set to make them appear while sliding from left to right?

How can I get around these two issues?

Request permissions not working within PermissionsPlugin

$
0
0

For my Xamarin.Forms-App I'm using the PermissionsPlugin v2.0.1.

If no permission is granted, I want to request the user to do so by CrossPermissions.Current.RequestPermissionsAsync(Permission.Storage)

The problem is that the function always returns Unknown instead of requesting the user for the permission. One time, it worked...but I don't know what I changed that it's not working anymore..

Here my code:

MainActivity.cs (Android-project)

public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
{
    base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
    PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}

AndroidManifest.xml

<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="25" />
<uses-permission android:name="android.permission.CAMERA" />

PermissionsExample.xaml.cs

[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class PermissionExample
{
    public PermissionExample()
    {
        this.InitializeComponent();
    }

    private async void Button_OnClicked(object sender, EventArgs e)
    {
        var requestedPermissions = await CrossPermissions.Current.RequestPermissionsAsync(Permission.Camera);
        var requestedPermissionStatus = requestedPermissions[Permission.Camera];

        await this.DisplayAlert("", $"Permission: {requestedPermissionStatus}", "ok");
    }
}

Thanks for your help! :)


How to access child stacklayout into c#

$
0
0

In Xaml, I took one parent stacklayout and inside it, I took another child stacklayout. In c#, I can access parent Stacklayout but i am unable to access child stacklayout. how to access child stack layout in c#. Any suggestion please?

How to convert Base64 Image String to FileImageSource in xamarin forms?

$
0
0

My attached images are stored into local database as a Base64 String,I want to show the data to the ImageCarousel(Nuget plugin to view image sliding) View.so how to convert the base64 string to FileImageSource

here is my code
ObservableCollection imageSources = new ObservableCollection();
FileImageSource imageaData= FileImageSource.FromStream(() => new MemoryStream(Convert.FromBase64String(data)));
imageSources .Add(imageData);

how to convert base64 to FileImageSource?

hey guys, how can i implement a scratch screen or scratch ticket using skiasharp in xamarin forms

$
0
0

i have to overlay two canvas , so when i rub or drag my finger on the canvas then the second canvas or may be any image should appear in the area that i have rubbed ...Basically i want to achieve a scratch ticket effect, how can i achieve this
Thanks in advance

OpenTok Xamarin.Forms nuget Video Chat

What is the best way to do video conferencing in Xamarin Forms?

$
0
0

I'm looking at how to do video conferencing in IOS and Android,

Is there any SDK to do this? Or should it be done natively on each plataform?

Which is the best route?

I searched in the forum, but found only very old answers. And nothing concrete about the operation.

If someone has done something like this, please share it with us.

Thank you all

TokBox OpenTok SDK for Xamarin Forms.

$
0
0

Hi,
I have made proof of concept app for a video chat application in Xamarin Native using the below nuget packages (it works like a charm the source code is done by provider available here https://github.com/DreamTeamMobile/Xamarin.Opentok.Samples/tree/code-improvements)

https://www.nuget.org/packages/Xamarin.OpenTok.Android/
https://www.nuget.org/packages/Xamarin.OpenTok.iOS/

These nuget packages are basically a port of the native iOS/Android SDK's by TokBox for Xamarin, Created by DreamTeamMobile. I want to make use of them to for creating a Xamarin Forms application, I need some guidance how I can make the same functionality available to a Forms Project, considering that the package provider doesn't provides Xamarin Forms implementation. Would custom renderers help here.

Video Chat App Using the Xamarin forms

$
0
0

Hello Folks
Is there any to create the Video chat application using the xamarin forms.

Thanks
Laxman


Get information from Bluetooth with BLE plugin

$
0
0

I am using BLE plugin and try to make app to conect with Arduino using bluetooth. If I use some BLE terminal from store I get information from module. My app can find and connect to module, but I dont know how to read information from bluetooth.

Weird error while using MSBuild to get APK

$
0
0

Hi,

I am trying to make an APK from cmd line via this command:

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" /t:SignAndroidPackage /p:Configuration=Release C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.sln

It starts building but ultimately finishes with this message:

C:\prj\Demo\Xamarin2\WiFiManager>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe" /t:SignAndroidPackage /p:Configuration=Release C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.sln

Microsoft (R) Build Engine version 15.8.169+g1ccb72aefa for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 11/23/2018 3:56:18 PM.
Project "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.sln" on node 1 (SignAndroidPackage target(s)).
ValidateSolutionConfiguration:
Building solution configuration "Release|Any CPU".
Project "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.sln" (1) is building "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Android\WiFiManager.Android.csproj" (2) on node 1 (SignAndroidPackage target(s)).
RedirectMonoAndroidSdkPaths:
SOFTWARE\Xamarin\VisualStudio\15.0_15059c6d\Android
_CreatePropertiesCache:
Creating directory "obj\Release\MonoAndroid81\".
_SetLatestTargetFrameworkVersion:
Found Java SDK version 1.8.0.
Found Java SDK version 1.8.0.
_ValidateAndroidPackageProperties:
PackageName: WiFiManager.WiFiManager
PrepareForBuild:
Creating directory "bin\Release\".
Project "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Android\WiFiManager.Android.csproj" (2) is building "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Common\WiFiManager.Common.csproj" (3:2) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin\Release\netstandard2.0\".
Creating directory "obj\Release\netstandard2.0\".
C:\Program Files\dotnet\sdk\2.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error NETSDK1004: Assets file 'C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Common\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Common\WiFiManager.Common.csproj]
Done Building Project "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Common\WiFiManager.Common.csproj" (default targets) -- FAILED.
Project "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Android\WiFiManager.Android.csproj" (2) is building "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager\WiFiManager.csproj" (4:2) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin\Release\netstandard2.0\".
Creating directory "obj\Release\netstandard2.0\".
C:\Program Files\dotnet\sdk\2.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error NETSDK1004: Assets file 'C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager\WiFiManager.csproj]
Done Building Project "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager\WiFiManager.csproj" (default targets) -- FAILED.
Done Building Project "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Android\WiFiManager.Android.csproj" (SignAndroidPackage target(s)) -- FAILED.
Project "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.sln" (1) is building "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager\WiFiManager.csproj" (4:3) on node 1 (SignAndroidPackage target(s)).
C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager\WiFiManager.csproj : error MSB4057: The target "SignAndroidPackage" does not exist in the project.
Done Building Project "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager\WiFiManager.csproj" (SignAndroidPackage target(s)) -- FAILED.
Project "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.sln" (1) is building "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Common\WiFiManager.Common.csproj" (3:3) on node 1 (SignAndroidPackage target(s)).
C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Common\WiFiManager.Common.csproj : error MSB4057: The target "SignAndroidPackage" does not exist in the project.
Done Building Project "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Common\WiFiManager.Common.csproj" (SignAndroidPackage target(s)) -- FAILED.
Done Building Project "C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.sln" (SignAndroidPackage target(s)) -- FAILED.

Build FAILED.

"C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.sln" (SignAndroidPackage target) (1) ->
"C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Android\WiFiManager.Android.csproj" (SignAndroidPackage target) (2) ->
"C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Common\WiFiManager.Common.csproj" (default target) (3:2) ->
(ResolvePackageAssets target) ->
C:\Program Files\dotnet\sdk\2.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error NETSDK1004: Assets file 'C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Common\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Common\WiFiManager.Common.csproj]

"C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.sln" (SignAndroidPackage target) (1) ->
"C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Android\WiFiManager.Android.csproj" (SignAndroidPackage target) (2) ->
"C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager\WiFiManager.csproj" (default target) (4:2) ->
C:\Program Files\dotnet\sdk\2.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error NETSDK1004: Assets file 'C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager\WiFiManager.csproj]

"C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.sln" (SignAndroidPackage target) (1) ->
"C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager\WiFiManager.csproj" (SignAndroidPackage target) (4:3) ->
C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager\WiFiManager.csproj : error MSB4057: The target "SignAndroidPackage" does not exist in the project.

"C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.sln" (SignAndroidPackage target) (1) ->
"C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Common\WiFiManager.Common.csproj" (SignAndroidPackage target) (3:3) ->
C:\prj\Demo\Xamarin2\WiFiManager\WiFiManager.Common\WiFiManager.Common.csproj : error MSB4057: The target "SignAndroidPackage" does not exist in the project.

0 Warning(s)
4 Error(s)

Time Elapsed 00:00:02.94

This target, however, exists in "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets"

What am I doing wrong? How can I build a signed APK from cmd line?

Linking C# to additional Objective C header file.

$
0
0

Hi guys, I have created a UI on Mac OS recently (Not phone Apps), and I am trying to link it to an additional Objective C code.
The source of this approach is really limited as all I found was about phone apps development. Hence I am trying to verify whether my concept is do-able or not. My Approach is as below :

My solution consist of Objective C and C#, which is linked internally when I created a new solution. These are done in the background by developers of these templates, where C# is the main sequence of the whole User Interface operations. Now I have created an Objective C file (externally), with all the functions to be called in its header file. I would love to link my UI (C# and Objective-C) to this Objective C file, the similar way developers used to link C# to Objective C.

This is the only link related to the subject that I am looking for, unfortunately it is mainly about phone Apps development.
https://docs.microsoft.com/en-us/xamarin/ios/platform/binding-objective-c/index

Below are small parts of my code /:

UI code:

MainViewController.designer.cs (Visual Studio for Mac)

using Foundation;
using System.CodeDom.Compiler;

namespace Main
{
    [Register ("MainViewController")]
    partial class MainViewController
    {
        [Outlet]
        AppKit.NSButton btnConnect { get; set; }

        [Action ("btnSubWindow:")]
        partial void BtnPopOut (AppKit.NSButton sender);
    }

    void ReleaseDesignerOutlets ()
        {
            if (btnConnect != null) {
                btnConnect.Dispose ();
                btnConnect = null;
            }
        }
}

MainViewController.m (Xcode)

#import "TestLauncherViewController.h"

@implementation TestLauncherViewController

@synthesize btnConnect = _btnConnect;
- (IBAction)btnSubWindow:(NSButton *)sender {
}

@end

MainViewController.h (Xcode)

#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>


@interface TestLauncherViewController : NSViewController {
    NSButton *_btnConnect;
@property (nonatomic, retain) IBOutlet NSButton *btnConnect;
- (IBAction)btnSubWindow:(NSButton *)sender;

@end

From here, we know that Objective-C has been linked to C#, and ready to be altered from C#.

Below are part of my externally created Objective C file:

Addition.h

@interface Addition : NSObject{
    int     progress;
    Status  state;
}
-(instancetype)initWithIP:(char*)ipaddress andUIdelegate:(id)del;
-(void)startToRun;
-(int)Multiplication;
@end

I am trying to use C# to access this Objective C header file to search for the entry point of any functions that I wish to call.
Please tell me if my concept is doable or not.

If do-doable :
Please provide me some guidance to achieve this approach.
Thank you in advance.

Is it possible to detect left swipe multi-touch with “two fingers” on Xamarin.Forms?

How to verify Phone number?

$
0
0

I want to verify phone number at the time of sign up. I want to send verification code at given mobile number at the time of sign up and then verify this code for further process.
How to achieve this functionality in Xamarin.Forms App.
Could any one please put in right direction to achieve it or any sample code.

Thanks in advance..

Viewing all 91519 articles
Browse latest View live


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