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

PCL vs SL for school project Xamarin app

$
0
0

Hello,

I am not very advanced with Xamarin.Forms, but I have to do school project for multiplatform app. I will use Visual studio for Mac to create Xamarin.Forms App for iOS and Android.

What shared code system it is better to use? Portable class library or Shared library?

My app will have connection to database to work with data. I will use SQLite or MySQL.

I suppose easier approach could be PCL because there I can use nuget packages. What do you think?

Thank you.


Simple PopupMenu Plugin for UWP/WinRT/Android/iOS

$
0
0

Hey all,
As a few of you sent me emails regarding this, I added some basic documentation for my popupmenu plugin.

Essentially, you pass it a view and an itemssource, and it will display a flyover next to the view. Its not very verbose and feature rich, but its not supposed to be! For anyone who wants a lot more, 100% check out rotorgames implemention: Rg.Plugins.Popup.

Feel free to give it a play, its pretty simple to implement and allows you a tad more flexibility over the forms actionsheets!

https://github.com/SKLn-Rad/Xam.Plugin.PopupMenu

~ Ry

Why in Xam.Forms UWP, OnAppearing and OnDisappearing are called when navigating to a content page?

$
0
0

Hey guys,

So I have an existing Xamarin.Forms app (android and iOS), and I'm recently starting to work on the UWP (which was included when I created the project, is just that I never worked on it), and for some reason the buttons on my MainPage weren't triggering my Clicked events.

Turns out that when I navigate to the MainPage, I noticed that the OnAppearing() method (where I declare all my event handlers) is invoked as expected, but then OnDisappearing() method is called immediately after, de-registering the event handlers from my controls.

Has this happened to someone else out there? Thanks.

Pairing to Mac for Xamarin.forms fails with vague error

$
0
0

I have followed a microsoft guide which i cant link attempting to connect my windows VS2017 to a macbook pro running High Sierra. I have installed the latest version of Xcode and VS for mac on the macbook. Both have the same version of Xamarin.IOS. I have never successfully paired the Mac. I get past authentication and it dies with non specific error:

Couldnt connect to {MacBook Name}. Please Try again.
There was an error while trying to connect the client vs2017068xxx to the 
server.

I can git bash in just fine, Here are the Xamarin logs, of which i can see nothing useful;

Xamarin.Messaging.Integration.State.ServerStateContext|Information|0|Checking host configuration for connecting to 'sMacBook'...
Xamarin.Messaging.Integration.State.ServerStateContext|Information|0|Server State transition from ConfiguringState to ConfiguredState on sMacBook (192.168.1.9)
Xamarin.Messaging.Integration.State.ServerStateContext|Information|0|Host 'sMacBook' is configured correctly
Xamarin.Messaging.Integration.State.ServerStateContext|Information|0|Server State transition from ConfiguredState to ConnectingState on sMacBook (192.168.1.9)
Xamarin.Messaging.Integration.State.ServerStateContext|Information|0|Starting connection to 'sMacBook'...
Xamarin.Messaging.Ssh.MessagingService|Information|0|Starting connection to sMacBook...
System.Net.Mqtt.Sdk.MqttClientImpl|Information|0|Client vs17068ab294 - Created new client session
System.Net.Mqtt.Sdk.Bindings.TcpChannel|Warning|0|The underlying communication stream has completed sending bytes. The observable sequence will be completed and the channel will be disposed
System.Net.Mqtt.Sdk.ClientPacketListener|Warning|0|Client vs17068ab294 - Packet Channel observable sequence has been completed
System.Net.Mqtt.Sdk.MqttClientImpl|Warning|0|Client - Packet observable sequence has been completed, hence closing the channel
System.Net.Mqtt.Sdk.MqttClientImpl|Information|0|Client  - Disposing. Reason: RemoteDisconnected
System.Net.Mqtt.Sdk.ClientPacketListener|Information|0|Disposing System.Net.Mqtt.Sdk.ClientPacketListener...
System.Net.Mqtt.Sdk.PacketChannel|Information|0|Disposing System.Net.Mqtt.Sdk.PacketChannel...
System.Net.Mqtt.Sdk.Bindings.TcpChannel|Information|0|Disposing System.Net.Mqtt.Sdk.Bindings.TcpChannel...
System.Net.Mqtt.Sdk.MqttClientImpl|Error|0|System.Net.Mqtt.MqttClientException: The client vs17068ab294 has been disconnected while trying to perform the connection
   at System.Net.Mqtt.Sdk.MqttClientImpl.<ConnectAsync>d__28.MoveNext()
System.Net.Mqtt.Sdk.MqttClientImpl|Information|0|Client  - Disposing. Reason: Error
Xamarin.Messaging.Integration.State.ServerStateContext|Information|0|Server State transition from ConnectingState to DisconnectedState on sMacBook (192.168.1.9)
Xamarin.Messaging.Ssh.MessagingService|Error|0|An error occurred on the underlying client while executing an operation. Details: The client vs17068ab294 has been disconnected while trying to perform the connection
Xamarin.Messaging.Client.MessagingConnection|Error|0|There was an error while trying to connect the client vs17068ab294 to the Server.
System.Net.Mqtt.MqttClientException: The client vs17068ab294 has been disconnected while trying to perform the connection
   at System.Net.Mqtt.Sdk.MqttClientImpl.<ConnectAsync>d__28.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.Messaging.Client.MessagingConnection.<ConnectAsync>d__20.MoveNext() in E:\A\_work\16\s\External\messaging\src\Xamarin.Messaging.Client\MessagingConnection.cs:line 65
Xamarin.Messaging.Ssh.MessagingService|Warning|0|The underlying client has been disconnected by the remote host
Xamarin.Messaging.Integration.State.ServerStateContext|Information|0|Starting connection to 'sMacBook'...
Xamarin.Messaging.Integration.State.ServerStateContext|Information|0|Server State transition from DisconnectedState to DisconnectingState on sMacBook (192.168.1.9)
Xamarin.Messaging.Integration.State.ServerStateContext|Information|0|Starting disconnection from sMacBook...
Xamarin.Messaging.Integration.State.ServerStateContext|Information|0|Starting disconnection from sMacBook...
Xamarin.Messaging.Integration.State.ServerStateContext|Information|0|Server State transition from DisconnectingState to DisconnectedState on sMacBook (192.168.1.9)
Xamarin.Messaging.Integration.State.ServerStateContext|Information|0|The connection to 'sMacBook' has been finished
Xamarin.Messaging.Integration.State.ServerStateContext|Error|0|Couldn't connect to sMacBook. Please try again.
Xamarin.Messaging.Exceptions.MessagingException: There was an error while trying to connect the client vs17068ab294 to the Server. ---> System.Net.Mqtt.MqttClientException: The client vs17068ab294 has been disconnected while trying to perform the connection
   at System.Net.Mqtt.Sdk.MqttClientImpl.<ConnectAsync>d__28.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.Messaging.Client.MessagingConnection.<ConnectAsync>d__20.MoveNext() in E:\A\_work\16\s\External\messaging\src\Xamarin.Messaging.Client\MessagingConnection.cs:line 65
   --- End of inner exception stack trace ---
   at Xamarin.Messaging.Client.MessagingConnection.<ConnectAsync>d__20.MoveNext() in E:\A\_work\16\s\External\messaging\src\Xamarin.Messaging.Client\MessagingConnection.cs:line 89
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.Messaging.Ssh.SshMessagingConnection.<ConnectAsync>d__41.MoveNext() in E:\A\_work\16\s\External\messaging\src\Xamarin.Messaging.Ssh\SshMessagingConnection.cs:line 172
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.Messaging.Ssh.MessagingService.<ConnectMqttAsync>d__79.MoveNext() in E:\A\_work\16\s\External\messaging\src\Xamarin.Messaging.Ssh\MessagingService.cs:line 461
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Xamarin.Messaging.Ssh.MessagingService.<ConnectAsync>d__64.MoveNext() in E:\A\_work\16\s\External\messaging\src\Xamarin.Messaging.Ssh\MessagingService.cs:line 192

Is there a way to disable the predictive keyboard toolbar for a Forms Entry field?

$
0
0

There appears to be a way to do this directly in iOS by manipulating the UITextAutocorrectionType field. But can it be done in a platform-agnostic way in the Forms Entry field?

Dynamically change status bar text color on Xamarin Forms iOS

$
0
0

Hi guys!

I'm having some trouble changing the status bar text color dynamically in my app. I know that there is an info.plist property to modify it for the whole application but I wanted to change it dynamically. For instance click a button and change from dark to light.

Is it possible?

can't access rest-API after a while because of DB connection is closed.

can't get notification in android when app is in sleep mode

$
0
0

hello,i am trying to add onesignal pushnotification sdk in my app ,but when i am try to test app then i get notification in ios perfectly but in android when app is going to sleep mode at first time it does not get notification but when it reresume it works perfectly.
it does in all version of android.


Package restore failed.Rolling back package change for 'MapDemo.UWP'

$
0
0

Hello,
I add Google play Services package but not Install in My Project. So I add Google play Services Package but not Install and Display Error -package restore Failed.Rolling Back package change for 'MapDemo.UWP'.

how to get Id of entry in code behind?

$
0
0

Hi I want to get Id of entry(textbox) in code begind. How can I do it?

Thanks

How to implement speech(voice)-to-text using xamarin.Forms

$
0
0

Hello Guys. please help, how do i implement a speech(voice) and textbox gets the text in my application.

Weird error when I compile : IBTool exited with code 255

$
0
0

Hi,

using Visual studio comunity version 7.4.1, on Macos high sierra 10.13.3
I got on github a sample of RSS reader : https: // github.com/Mahabali/XamarinRSSFeed

when I compile, at first : I can run it.

the IOS project target IOS 10.0
the droid project target latest android 8.1

then, all package needed to be updated.
si I updated all package,
and now, I have 2 errors, which (for me) are not telling me what is wrong :
IBTool exited with code 255
the "IBTool" task failed unexpectedly

I tried to delete all bin and obj, and I tried to clean ll before build, without success.

what can I do ?
except delete visual studio, nuget packages, and reinstall everything ? (this is not an option for me :o)

thanks
Olivier

SIGABRT while debugging async methods

$
0
0

These methods used to work fine, but iOS rejected our latest App version because an unspecified error.

While debugging, they work fine, unless you go step by step after a breakpoint. After said methods finish, we get this exception:

´=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================´

We cannot progress and send the app to the store unless this gets corrected.

A brief example of one of our async methods:

async Task chargeLists () {
//Hide main screen
scroll.IsVisible = false;
//Show hidden screen with an ActivityIndicator and a "Loading" text
overlay.IsVisible = true;
await Task.Run (() => {
//Do something while thinking
});
//Hide creen with an ActivityIndicator
overlay.IsVisible = false;
//Show main screen
scroll.IsVisible = true;
}

This method is used in the first screen and is called by:

protected override async void OnAppearing () {
try {
await chargeLists ();
base.OnAppearing ();
} catch (Exception ex) {
Debug.WriteLine (string.Format ("Error: {0}", ex.Message));
}
}

protected override async void OnDisappearing () {
try {
await chargeLists ();
base.OnDisappearing ();
} catch (Exception ex) {
Debug.WriteLine (string.Format ("Error: {0}", ex.Message));
}
}

Please and thank you for your help.

How to Refresh page when Rg Popup is closed?

$
0
0

Hi,

I am opening Rg.Plugin.Popup here:

await Navigation.PushPopupAsync(new ZeeraPopupNewMerchantCategory());

and on the button I have a with a Click

When the Popup is closed from the 's Clicked and when returning to parent, how can I refresh the parent's page data which is in:

GetMerchantCategory()

This is the code in the parent which I need to run when the popup is closed..

Thanks,
Jassim

PageLifeCycleMethod when PopUp is open and closed in Xamarin forms.

$
0
0

Hi All, I am new to xamarin forms. In my app i need to show popup and need to fill value in pop Entry and after save button click i need to show those value on the behind screen of the popup, But I don't know which method will call when popup will close. Please Help

Thanks in Advance :smile:


Android Binding library resource not found

$
0
0

I have created the binding library, when i implement the function and build the android application i getting below error.

No resource found that matches the given name (at 'textColor' with value '@color/bt_white').
No resource found that matches the given name (at 'background' with value '@color/bt_blue').
No resource found that matches the given name (at 'drawable' with value '@color/bt_black_12').

how to fix it

How to solve unknown type in UWP app - Windows.UI.ViewManagement.StatusBar

$
0
0

Hi,
From what I can tell, I've got a pretty basic UWP app, but whenever I run it I get the following exception:

System.TypeLoadException was unhandled by user code
HResult=-2146233054
Message=Could not find Windows Runtime type 'Windows.UI.ViewManagement.StatusBar'.
Source=Xamarin.Forms.Platform.UAP
TypeName=Windows.UI.ViewManagement.StatusBar
StackTrace:
at Xamarin.Forms.Platform.UWP.Platform..ctor(Page page)
at Xamarin.Forms.Platform.UWP.WindowsPage.CreatePlatform()
at Xamarin.Forms.Platform.UWP.WindowsBasePage.LoadApplication(Application application)
at MyApp.UWP.MainPage..ctor()
at MyApp.UWP.My_App_UWP_XamlTypeInfo.XamlTypeInfoProvider.Activate_4_MainPage()
at MyApp.UWP.My_App_UWP_XamlTypeInfo.XamlUserType.ActivateInstance()
InnerException:

I'm using Xamarin.Forms 2.1.0.6529 in my project. I also tried downloading a sample off GitHub (https://github.com/jamesmontemagno/MyWeather.Forms) and I'm seeing the same exception. Looks like that project is using 2.0.0.6490.

So, that makes this sound like something is missing from my system? I'm running Windows 10 which I just installed yesterday.

I'm new to UWP and Xamarin, so I don't even know where to start looking. I have noticed that if I comment out the line:

LoadApplication(new MyApp.App());

the application boots. Of course, nothing is there since I'm not starting the app, but the code to init Xamarin.Forms is still running in App.xaml.cs.

Thanks,
Nick

Basic Local Storage - How to?

$
0
0

Hi,

I have seen sqlite but I am asking what if I want a simple local storage just to save one variable user_id to determine the user ID?

What's the best way yo do it so even if the user closes the app or the phone it will still be stored?

Kindly advise...

Thanks,
Jassim

Pass info to another native android App

$
0
0

Hello everybody!

I send information from application A to application B (written in Java) with values of type Int all ok, but my string values: Username and Password in application B is always null.

Code Application A:

public void MakeReport(int jobId, int jobType)
        {
            var intent = Android.App.Application.Context.PackageManager.GetLaunchIntentForPackage(AppBundle);
            if (intent is null)
                throw new NullReferenceException();

            // Set Data
            intent.PutExtra(UsernameMessage, javaUsername);
            intent.PutExtra(PasswordMessage, javaPassword);
            intent.PutExtra(JobIdMessage, jobId);
            intent.PutExtra(JobTypeMessage, jobType);

// Test All OK
            string usernameTest = intent.GetStringExtra("USER_NAME_FROM_MDO_SCHEDULE");
            string passwordTest = intent.GetStringExtra("USER_PASSWORD_FROM_MDO_SCHEDULE");
            int jobIdTest = intent.GetIntExtra("JOB_ID_FROM_MDO_SCHEDULE", -1);
            int jobTypeTest = intent.GetIntExtra("JOB_TYPE_FROM_MDO_SCHEDULE", 0);

            Forms.Context.StartActivity(intent);
        }

        #endregion

Code Application B:

@Override
 protected void onNewIntent(Intent intent) {
  super.onNewIntent(intent);
  initLoginPopup();
  String login = intent.getStringExtra("USER_NAME_FROM_MDO_SCHEDULE");
  String password = intent.getStringExtra("USER_PASSWORD_FROM_MDO_SCHEDULE");
  int jobType =  intent.getIntExtra("JOB_TYPE_FROM_MDO_SCHEDULE", 0);
  int jobId = intent.getIntExtra("JOB_ID_FROM_MDO_SCHEDULE", 0);
  loginFromMdoSchedule(login, password, jobType, jobId).start();
 }

E/EXTRAS: [JOB_ID_FROM_MDO_SCHEDULE=0]
                   [USER_NAME_FROM_MDO_SCHEDULE=null]
                   [USER_PASSWORD_FROM_MDO_SCHEDULE=null]
                   [JOB_TYPE_FROM_MDO_SCHEDULE=2]
E/END@@@@: Dumping Intent end

ContextAction MenuItem icon not showing in iOS

$
0
0

I'm developing PCL based solution using Xamarin.Forms. I added ContextAction to listview. I have delete MenuItem with trash icon in ContextActions. The trash icon not showing in iOS not platform.But in android its working fine. the iOS not support MenuItem icon?
My XAML code is

        <ViewCell.ContextActions>
                <MenuItem Text="Edit" x:Name="MenuEdit" />
                <MenuItem Clicked="OnDeleteMenu" Icon="dustbin.png" Text="Delete" IsDestructive="true" CommandParameter {Binding .}" />
    </ViewCell.ContextActions> 

i am using latest Xamarin.Forms.Please Anyone give the solution

Thanks,
Mahabaleshwar Hegde

Viewing all 91519 articles
Browse latest View live


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