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

PropertyChanged is not null although we don't subscribe any function to it. How come?

$
0
0

I implement INotifyPropertyChanged and it works fine.

There is something I don't understand though: PropertyChanged is a an event, which means it is a delegate.

Before we invoke event/delegate we need them to point on some function/eventHundler ("Subscribe") -
otherwise the event will be null.

How is it, that here we declare an event, I didn't subscribe no one to this event, and still - it is not null.

public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
   var changed = PropertyChanged;
    if (changed == null)   //It seems for me, this should be null for ever.  
       return;
    changed.Invoke(this, new PropertyChangedEventArgs(propertyName));
}~~~~

WindowSoftInputMode="Resize" SHELL issues

$
0
0
Hello,
I have a login screen with two entry fields for email and password with a login button.
I am using WindowSoftInputmode in android to make sure the entries are visible when the soft keyboard is displayed.
I am using The Xarin Forms Shell with bottom Navigation(tabbar). When the keyboard is displayed the bottom bar is being pushed up and displayed above the keyboard.
Any idea how I can tackle this issue and make sure my bottom navigation is not displayed above the keyboard?

App Crashes On IOS Start Up In PCL Xamarin

$
0
0

PCL Project Which Crashes after Splash Screen on IOS
I have a try catch on IOS StartUp
On Main.cs

try
{
     UIApplication.Main(args, null, "AppDelegate");
}
catch (System.Exception exception)
{
     Crashes.TrackError(exception);
}

So i debug the project and it goes to App()
And When InitializeComponent();
It goes into catch with
Exception Message: Cannot invoke method with stack pointers via reflection


What causing this exception?
can someone help me out with it
P.S. : I tried updating Xamarin.forms version to some extend but had same issue
I can't update it to latest version because of dependency issues coz it's an old PCL project

Issue with app.EnterText for Android API 29 ONLY Xamarin.UITest

$
0
0

I have been having an issue with Xamarin.UITest after the application that I am working on was updated to the latest android version (API 29). This issue did not happen before the application updates and automation worked as intended on API 29. Before the application was updated and you did a fresh install the application would have an "OS" prompt stating that the "Application was out of Date" once the application was updated that prompt no longer displayed however the Xamarin.UITest issues appeared.

The issue is that when automation runs on a device with API 29 ONLY and when the code app.EnterText runs the text that was requested via code to be inputted does not get input. The same applies to app.ClearText, once the command is done the text in the field does not get cleared. its as if there is a permission issue with the automation interacting with the application text fields only. Note, the test does not fail with an error and the test keeps running like it did the commend, which makes it header to know why it's doing this.

I did work with my DEV's to see if this is an application issue and his theory is that it's a permission issue but we are both not sure where the issue is of what permission is being blocked any help of shedding light would be very helpful.

Environment replication that I am seeing the issues on:
Device/OS: Pixel 3 XL (real device)/ Android version 10(API 29)
Xamarin.UITest version: 3.0.4

Application:
Rinning the latest updates for packages including Xamrin.Forms and the application is configured for API(29)
Note: the text fields work just fine outside of automation and if a user inputs the text it works as intended, just an Automation issue

VS/Xcode version:
Visual Studio Enterprise 2019 for Mac
Version 8.3.10 (build 2)
Installation UUID: 87bfc8d6-bb7e-4416-8725-c451ad424835
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 5.16.1.24 (d16-3 / 08809f5b)

Package version: 604000208

Mono Framework MDK
Runtime:
Mono 6.4.0.208 (2019-06/07c23f2ca43) (64-bit)
Package version: 604000208

NuGet
Version: 5.3.0.6192

.NET Core SDK
SDK: /usr/local/share/dotnet/sdk/3.0.100/Sdks
SDK Versions:
3.0.100
2.1.700
2.1.505
2.1.504
2.1.503
2.1.302
2.1.301
2.1.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/Sdks

.NET Core Runtime
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.0.0
2.1.13
2.1.11
2.1.9
2.1.8
2.1.7
2.1.2
2.1.1
2.0.5

Xamarin.Profiler
Version: 1.6.12.29
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Apple Developer Tools
Xcode 11.2.1 (15526.1)
Build 11B500

Xamarin Designer
Version: 16.3.0.256
Hash: 8a223bfd7
Branch: remotes/origin/d16-3
Build date: 2019-11-01 21:02:02 UTC

Xamarin.Mac
Version: 6.6.0.12 (Visual Studio Enterprise)
Hash: e3c2b406d
Branch: xcode11.2
Build date: 2019-11-01 00:12:07-0400

Xamarin.iOS
Version: 13.6.0.12 (Visual Studio Enterprise)
Hash: e3c2b406d
Branch: xcode11.2
Build date: 2019-11-01 00:12:08-0400

Xamarin.Android
Version: 10.0.6.2 (Visual Studio Enterprise)
Commit: xamarin-android/d16-3/c407838
Android SDK: /Users/{*}/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.5
SDK Build Tools Version: 28.0.3

Build Information:
Mono: mono/mono/2019-06@476d72b9e32
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip/rel-1-5-1@b95cf3fd
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.27.1@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

Microsoft Mobile OpenJDK
Java SDK: /Users/mmoadeb/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 1.4.0.65
Hash: c33b107
Branch: remotes/origin/d16-3
Build date: 2019-11-19 20:33:22 UTC

Android Device Manager
Version: 1.2.0.116
Hash: d2b2af0
Branch: remotes/origin/d16-3
Build date: 2019-11-19 20:33:42 UTC

Xamarin Inspector
Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

Build Information
Release ID: 803100002
Git revision: add3a4998a5cb5b081e0404e1fe13acfecb7801d
Build date: 2019-11-20 13:35:15+00
Build branch: release-8.3
Xamarin extensions: 79c69708816813b498283eeda7bcb4d464433a04

Operating System
Mac OS X 10.15.1
Darwin 19.0.0 Darwin Kernel Version 19.0.0
Thu Oct 17 16:17:15 PDT 2019
root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64

Enabled user installed extensions
Straight8's SpecFlow Integration 1.11.3.0
XAML Styler 1.1.5

The only error that I see when debugging the test is below, I am not sure if this has any relevance:

[0x7000100bc000] The instruction pointer of the currently executing method(Xamarin.UITest.Queries.AppQuery:tokensFromObjectArray (object[])) is not on the recorded stack. This is likely due to a runtime bug. The 15 frames are as follow:
[0x7000100bc000] Frame (0 / 15): (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo:InternalInvoke (System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
[0x7000100bc000] Frame (1 / 15): System.Reflection.RuntimeMethodInfo:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
[0x7000100bc000] Frame (2 / 15): System.Reflection.MethodBase:Invoke (object,object[])
[0x7000100bc000] Frame (3 / 15): System.Delegate:DynamicInvokeImpl (object[])
[0x7000100bc000] Frame (4 / 15): System.MulticastDelegate:DynamicInvokeImpl (object[])
[0x7000100bc000] Frame (5 / 15): System.Delegate:DynamicInvoke (object[])
[0x7000100bc000] Frame (6 / 15): TechTalk.SpecFlow.Bindings.BindingInvoker:InvokeBinding (TechTalk.SpecFlow.Bindings.IBinding,TechTalk.SpecFlow.Infrastructure.IContextManager,object[],TechTalk.SpecFlow.Tracing.ITestTracer,System.TimeSpan&)
[0x7000100bc000] Frame (7 / 15): TechTalk.SpecFlow.Infrastructure.TestExecutionEngine:ExecuteStepMatch (TechTalk.SpecFlow.Bindings.BindingMatch,object[])
[0x7000100bc000] Frame (8 / 15): TechTalk.SpecFlow.Infrastructure.TestExecutionEngine:ExecuteStep (TechTalk.SpecFlow.Infrastructure.IContextManager,TechTalk.SpecFlow.Bindings.StepInstance)
[0x7000100bc000] Frame (9 / 15): TechTalk.SpecFlow.Infrastructure.TestExecutionEngine:Step (TechTalk.SpecFlow.Bindings.StepDefinitionKeyword,string,string,string,TechTalk.SpecFlow.Table)
[0x7000100bc000] Frame (10 / 15): TechTalk.SpecFlow.TestRunner:When (string,string,TechTalk.SpecFlow.Table,string)
[0x7000100bc000] Frame (11 / 15): TechTalk.SpecFlow.Steps:When (string,string,TechTalk.SpecFlow.Table)
[0x7000100bc000] Frame (12 / 15): TechTalk.SpecFlow.Steps:When (string)
[0x7000100bc000] Frame (13 / 15): WellRx.UITests.Steps.DashboardSteps:GivenIAmOnTheHomePage ()
[0x7000100bc000] Frame (14 / 15): (wrapper dynamic-method) object:lambda_method (System.Runtime.CompilerServices.Closure,TechTalk.SpecFlow.Infrastructure.IContextManager)

Post and Get Parameter In Webview

$
0
0

Hi,

Anyone knows on how to post url with parameters to payment gateway using webview in xamarin page? And get method to process the response received from payment gateway?

Thank you.

How to Hide button on Button click IsVisible property not works

$
0
0

I have to hide the button on button click and visible the other button on button click. But the IsVisible property not works. Please guide what is wrong and how to implement this?

if (SQLHelper._MeetingID == 0)
{

                    btnStartMeeting.IsVisible = true;
                    btnMarkAttendance.IsVisible = false;



                }

Google Drive API - Unable to list Folders

$
0
0

Using Google.Apis.Drive.v3 the following code is not extracting folders list, whatever I do. What could be wrong with my setup? It doesn't matter whether I use 'async' or otherwise, folders.Count is zero. As such no item contains anything other than "#drive/file" in MimeType. As such same code in another app get even files.Count as zero.

        public async Task<List<StorageItem>> ListAllFiles()
        {
            List<File> result = new List<File>();

            FilesResource.ListRequest request1 = driveService.Files.List();
            request1.Fields = "nextPageToken,files(*)";
            request1.Q = "trashed=false and mimeType='application/vnd.google-apps.folder'";
            IList<File> folders = request1.Execute().Files;

            FilesResource.ListRequest request = driveService.Files.List();
            request.Fields = "nextPageToken,files(*)";
            request.Q = "trashed=false";
            request.Corpora = "user";
            //request.IncludeItemsFromAllDrives = true;

            //IList<File> filesList = request.Execute().Files;

            do
            {
                try
                {
                    FileList files = await request.ExecuteAsync();

                    result.AddRange(files.Files);
                    request.PageToken = files.NextPageToken;
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("Error in listing files: " + ex.Message);
                    request.PageToken = null;
                }

            } while (!String.IsNullOrEmpty(request.PageToken));

            List<StorageItem> filesList = new List<StorageItem>();

            for (int i = 0; i < result.Count; i++)
            {
                StorageItem storageItem = new StorageItem();

                storageItem.Id = result[i].Id;
                storageItem.Name = result[i].Name;
                storageItem.IsFolder = result[i].Kind.Contains("folder");
                storageItem.MimeType = result[i].MimeType;
                storageItem.Size = (long)result[i].Size;
                storageItem.CreatedDT = (DateTime)(result[i].CreatedTime?.ToLocalTime());
                storageItem.LastModifiedDT = (DateTime)(result[i].ModifiedTime?.ToLocalTime());
                storageItem.Owner = result[i].Owners.FirstOrDefault().DisplayName;
                storageItem.LastModifiedBy = result[i].LastModifyingUser.DisplayName;
                storageItem.ParentPath = "";
                storageItem.ParentId = result[i].Parents.FirstOrDefault();

                filesList.Add(storageItem);
            }

            return filesList;
        }

What is the best approach to dynamically show/hide input controls

$
0
0

Hi there,

I am a web developer getting into mobile development, so I'll do my best to make myself clear...

I need to create a single page input form and would like to add dynamic displayed input fields.
In other words I want to display or hide specific controls based on check box or dropdown list selections BEFORE submission, so event based functionality.

I'm just not familiar with all the container / control types available in xamarin yet, so I'm asking for some good advice here.. with that said, what is the best approach to accomplish this in Xamarin.Forms?

Any hint is really appreciated!
Best regards
Bruno


[Android] App Crashing while Page Navigation with error as NavigationPageRenderer.UpdateToolbar ()

$
0
0

When I am trying to move from one page to another page, the app is getting crashed with the below error.

NavigationPageRenderer.UpdateToolbar () - System.NullReferenceException: Object reference not set to an instance of an object.

Xamarin Forms Version: 4.7.0.1080

PS: Sometime App not crashing but BackButton Icon & Header Label not showing.

AppCenter Stack Trace:

Android: 9
Android Build: PKQ1.180917.001
Manufacturer: Xiaomi
Model: Redmi 6 Pro

Xamarin Exception Stack:
System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.UpdateToolbar () [0x0007d] in <5cfeb6476b5641c5b43daf7d3f36a1c8>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer+<>c__DisplayClass97_0.b__0 () [0x0002b] in <5cfeb6476b5641c5b43daf7d3f36a1c8>:0
at Xamarin.Forms.Forms+AndroidPlatformServices+<>c__DisplayClass24_0.b__0 () [0x00000] in <5cfeb6476b5641c5b43daf7d3f36a1c8>:0
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in :0
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in :0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.28(intptr,intptr)

[Android]Attempt to invoke virtual method 'void android.graphics.Rect.set(android.graphics.Rect)'

$
0
0

Hi All, After I have updated Xamarin.Forms version to 4.7.0.1080, I am facing the below crash. But, It is happening at times only.

md5f92e0daf340890c9667469657ee2ece8.ButtonRenderer.onLayout
ButtonRenderer.java, line 72
Java.Lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.Rect.set(android.graphics.Rect)' on a null object reference

Scenario: When I scroll the ListView, I could see the app is getting crashed.

Xamarin Forms Version: 4.7.0.1080

AppCenter Trace:

md5f92e0daf340890c9667469657ee2ece8.ButtonRenderer.onLayout
ButtonRenderer.java, line 72
Java.Lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.Rect.set(android.graphics.Rect)' on a null object reference

Stack traces
JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args)
JniPeerMembers+JniInstanceMethods.InvokeNonvirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters)
Drawable.CopyBounds (Android.Graphics.Rect bounds)
ButtonLayoutManager.OnLayout (System.Boolean changed, System.Int32 left, System.Int32 top, System.Int32 right, System.Int32 bottom)
ButtonRenderer.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b)
View.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean changed, System.Int32 left, System.Int32 top, System.Int32 right, System.Int32 bottom)
(wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.59(intptr,intptr,bool,int,int,int,int)
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.Rect.set(android.graphics.Rect)' on a null object reference
android.graphics.drawable.Drawable.copyBounds Drawable.java:256
md5f92e0daf340890c9667469657ee2ece8.ButtonRenderer.n_onLayout(Native Method)
md5f92e0daf340890c9667469657ee2ece8.ButtonRenderer.onLayout ButtonRenderer.java:72
android.view.View.layout View.java:20707
md51558244f76c53b6aeda52c8a337f2c37.Platform_DefaultRenderer.n_onLayout(Native Method)
md51558244f76c53b6aeda52c8a337f2c37.Platform_DefaultRenderer.onLayout Platform_DefaultRenderer.java:72
android.view.View.layout View.java:20707
android.view.ViewGroup.layout ViewGroup.java:6198
com.xamarin.forms.platform.android.FormsViewGroup.measureAndLayout FormsViewGroup.java:37
md51558244f76c53b6aeda52c8a337f2c37.ListViewAdapter.n_getView(Native Method)
md51558244f76c53b6aeda52c8a337f2c37.ListViewAdapter.getView ListViewAdapter.java:100
android.widget.HeaderViewListAdapter.getView HeaderViewListAdapter.java:220
android.widget.AbsListView.obtainView AbsListView.java:2408
android.widget.ListView.makeAndAddView ListView.java:2126
android.widget.ListView.fillUp ListView.java:893
android.widget.ListView.fillGap ListView.java:767
android.widget.ListView.fillGap ListView.java:746
android.widget.AbsListView.trackMotionScroll AbsListView.java:5334
android.widget.ListView.trackMotionScroll ListView.java:2045
android.widget.AbsListView$FlingRunnable.run AbsListView.java:4878
android.view.Choreographer$CallbackRecord.run Choreographer.java:1009
android.view.Choreographer.doCallbacks Choreographer.java:821
android.view.Choreographer.doFrame Choreographer.java:753
android.view.Choreographer$FrameDisplayEventReceiver.run Choreographer.java:995
android.os.Handler.handleCallback Handler.java:873
android.os.Handler.dispatchMessage Handler.java:99
android.os.Looper.loop Looper.java:201
android.app.ActivityThread.main ActivityThread.java:6806
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:547
com.android.internal.os.ZygoteInit.main ZygoteInit.java:873

How to highlight newly added item to CollectionView

$
0
0

I am using Xamarin forms.I have CollectionView in Xamarins showing List of Tickets.I want to highlight new rows whenever its inserted.Like flashing or blinking the row with red background say for 5 seconds.After 5 seconds it should be normal row. Clients will add rows in real time using SignalR.


<CollectionView.ItemTemplate>

                        <Frame x:Name="frame1" BackgroundColor="White" BorderColor="#F0F0F0" Padding="3" Margin="0,0,0,5" HasShadow="False" CornerRadius="10" DescendantAdded="Frame_DescendantAdded">
                            <Grid HeightRequest="40" HorizontalOptions="FillAndExpand" VerticalOptions="Start">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="2*"/>
                                    <ColumnDefinition Width="2*" />
                                    <ColumnDefinition Width="6*" />
                                </Grid.ColumnDefinitions>

                            <Label Grid.Column="0" x:Name="lb_TicketNumber" Text="{Binding TicketNumber}" TextColor="Black" FontSize="Large" FontAttributes="Bold" VerticalOptions="Center" Margin="20,0" HorizontalTextAlignment="Center"  />
                            <Label Grid.Column="1" Text="{Binding DeskName}" TextColor="Black" FontSize="Large" FontAttributes="Bold" VerticalOptions="Center" HorizontalTextAlignment="Center"/>
                            <Label Grid.Column="2" Text="{Binding ServiceNameEng}" TextColor="Black" FontSize="Large" FontAttributes="Bold" VerticalOptions="Center" HorizontalTextAlignment="Center" />

                            </Grid>

                        </Frame>

                </DataTemplate>
            </CollectionView.ItemTemplate>

        </CollectionView>

Can i publish my app from mac on cloud

How to apply pagination in lisview using Xamarin forms cross platform?

$
0
0

How to apply pagination in lisview using Xamarin forms cross platform? Please help.I have searched on google but couldn't find the solution.
Thanks in advance

Android Binding after AndroidX migration

$
0
0

I'm having some issues with a library that I upgraded:

https://github.com/SupernovaIC/OMFM

I'm getting the following issue:

1>BINDINGSGENERATOR : warning BG8604: top ancestor OneMoreFabMenu not found for nested type Com.Dekoservidoni.Omfm.OneMoreFabMenu._1.
1>BINDINGSGENERATOR : warning BG8604: top ancestor OneMoreFabMenu not found for nested type Com.Dekoservidoni.Omfm.OneMoreFabMenu.IOptionsClick.
1>BINDINGSGENERATOR : warning BG8604: top ancestor OneMoreFabMenu not found for nested type Com.Dekoservidoni.Omfm.OneMoreFabMenu.FabClickListener._1.
1>BINDINGSGENERATOR : warning BG8604: top ancestor OneMoreFabMenu not found for nested type Com.Dekoservidoni.Omfm.OneMoreFabMenu.Hide._1.
1>BINDINGSGENERATOR : warning BG8604: top ancestor OneMoreFabMenu not found for nested type Com.Dekoservidoni.Omfm.OneMoreFabMenu.HideMenu._1.
1>BINDINGSGENERATOR : warning BG8604: top ancestor OneMoreFabMenu not found for nested type Com.Dekoservidoni.Omfm.OneMoreFabMenu.OnMeasure._1.
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.dekoservidoni.omfm.OneMoreFabMenu in method OnNestedPreScroll in managed type Com.Dekoservidoni.Omfm.Utils.OneMoreFabScrollBehaviour.
1>BINDINGSGENERATOR : warning BG8800: Unknown parameter type com.dekoservidoni.omfm.OneMoreFabMenu in method OnStartNestedScroll in managed type Com.Dekoservidoni.Omfm.Utils.OneMoreFabScrollBehaviour.

In that specific section, I have the following code:

override fun onStartNestedScroll(coordinatorLayout: androidx.coordinatorlayout.widget.CoordinatorLayout, child: OneMoreFabMenu,
                                     directTargetChild: View, target: View, nestedScrollAxes: Int, type: Int): Boolean {

        return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL || super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target,
                nestedScrollAxes, type)
    }

And I have added these NuGets:

Any idea, which one could I miss?

How to add Content files from referenced assembly in app bundle

$
0
0

I have Xamain.Mac project named MainApp (Xamarin Mac Full 4.8), which references the Class Library project named Lib (Net FW 4.8).
The Lib project have the txt file ContentFile.txt with Build Action = Content and Copy to output directory = Always. The ContentFile.txt contains some data, needed by Lib to work.

When building the solution, I expect that ContentFile.txt will be included in Application bundle (MainApp.app).
But actually I am observing following behaviour:

  • ContentFile.txt is present in the Lib project output folder (/Lib/bin/Debug/ContentFile.txt) along with the Lib.dll
  • ContentFile.txt is present in the MainApp project output folder (/MainApp/bin/Debug/ContentFile.txt) along with the Lib.dll and MainApp.exe
  • ContentFile.txt is not present in the MainApp.app application bundle (/MainApp/bin/Debug/MainApp.app). But Lib.dll is present inside the bundle (so, looks like the build system determined Lib.dll dependency correctly).

So, the question is - how to configure solution to include Content files from inside referenced projects to the main application bundle? Ideally, without any explicit references to these content files outside the Lib project.

What I already tried, but all of this looks not very good:

  • add explicit reference to ContentFile.txt in the MainApp project with Build action = bundle resource.
  • extract ContentFile.txt in the separate Shared project, then reference this shared project it both Lib and MainApp projects.
  • use postbuild events in MainApp project to copy file.

All of this worked, but required to 'leak' internal information from inside Lib project and I wonder if the better solutions are exist.

Additional note: the Lib project is also used in Windows version of my app, so I can't change Lib project in any way that will make it incompatible with windows.


Change status bar colour on iOS13

$
0
0

Before iOS 13 I could change the status bar colour using the following bit of code:

        UIView statusBar = UIApplication.SharedApplication.ValueForKey(new NSString("statusBar")) as UIView;
        if (statusBar.RespondsToSelector(new ObjCRuntime.Selector("setBackgroundColor:")))
        {
            statusBar.BackgroundColor = UIColor.Clear.FromHex(0x323232);
            statusBar.TintColor = UIColor.White;
            app.StatusBarStyle = UIStatusBarStyle.BlackOpaque;
        }

However, on iOS13 I get the following runtime error

Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: App called -statusBar or -statusBarWindow on UIApplication: this code must be changed as there's no longer a status bar or status bar window. Use the statusBarManager object on the window scene instead.

Any idea on how to change the status bar on iOS13?

Error in android url scheme

$
0
0

Hi

I'm trying to make custom URL Scheme In Android

When I create a new xamarin forms app and add this code to manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.app7">
    <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
    <application android:label="App7.Android">
         <activity  android:name="com.companyname.app7.MainActivity">
          <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="myapp" />
          </intent-filter>
        </activity>
     </application>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

And I call the app by clicking a link

<a href="myapp://hello-world"> Circle Here</a>

I get this error

Java.Lang.RuntimeException: 'Unable to instantiate activity ComponentInfo{com.companyname.app7/com.companyname.app7.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.companyname.app7.MainActivity" on path: DexPathList[[zip file "/data/app/com.companyname.app7-1/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.app7-1/lib/arm, /data/app/com.companyname.app7-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]'

How to load local geojson value to draw and fill the layer in xamarin.ios using c#

$
0
0
          NSData jsonData = NSData.FromString(Us_country_jsonSerialized, NSStringEncoding.UTF8);
           var shape = MGLShape.ShapeWithData(jsonData, 5, out err) as MGLShapeCollectionFeature;
            var source = new MGLShapeSource("identifier", shape.Shapes, null);
            source.Identifier = "identifier";
            MapView.Style?.AddSource(source);

            var layer = new MGLFillStyleLayer(identifier: "layerIdentifier", source);
            layer.SourceLayerIdentifier= "layerIdentifier";
            layer.FillColor = NSExpression.FromConstant(UIColor.Green);

This is the code. i try to draw and fill color using my local data values. Although i didn't get any crash or exception. My mapview doesnot render any fill layer.

In my shape.Shapes - i got NSObject[52] values. i mean all the state coord values from us states json. How am missing to draw line here. Please suggest me a solution... I almost tried and spent lots of time in finding my mistakes,..

OIDC Client Logout

$
0
0

I am following the example to authenticate a user by using this sample:
https://github.com/IdentityModel/IdentityModel.OidcClient.Samples/tree/master/XamarinForms

I have the login working, it authenticates and closes the ChromeTabBrowser and redirects back to my app screen because of the RedirectURI setting, but this sample online doesn't have an example for the Logoff functionality. How would I do the same, Logoff, and then have it close the ChromeTabBrowser and redirect back to my app, I have set the same URI I am using for login, to the PostLogoutRedirectURI property in the OidcClientOptions, but no luck.

public static OidcClientOptions SetAuthOptionsPostLogout()
{
var browser = DependencyService.Get();

        return new OidcClientOptions
        {
            Authority = GlobalSetting.Instance.AuthAuthorityURI,
            ClientId = GlobalSetting.Instance.AuthClientID,
            Scope = GlobalSetting.Instance.AuthScope,
            RedirectUri = GlobalSetting.Instance.AuthReturnURI,
            PostLogoutRedirectUri = GlobalSetting.Instance.AuthReturnURI,                               
            Browser = browser,
            ResponseMode = OidcClientOptions.AuthorizeResponseMode.Redirect
        };
    }

and my call to logout is:

public ICommand Logout => new Command(async () =>
{
try
{
LoadingMessage = "Logging Off...";
IsBusy = true;

            var options = AuthService.SetAuthOptionsPostLogout();
            Client = new OidcClient(options);
            await Client.LogoutAsync();

            //DELETE OTHER SETTINGS HERE

            IsBusy = false;
            await _Navigation.PushAsync(new Login());
        }
        catch (Exception ex)
        {
            IsBusy = false;
            await ex.TrackAndShowAlert("VM", "Logout");
        }
    });

The authentication service logs me off, but that window never closes, so in the app, the spinning "Logging Off..." is still active awaiting the call.

Cant Access shared folder

$
0
0
Hi,
Iam new to xamarin. I want to read the files from shared folder.
From - access from android mobile
To - PC (contains shared folder. ).
Both this mobile and PC are in same wifi network.
I am developing in c#. Can anybody please help me to solve this.
Thanks,
Thiyagu.
Viewing all 204402 articles
Browse latest View live


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