You can't set your app to only share directly for Instagram & Whatsapp through UIActivityViewController. It seems like after iOS 6 setting UTI using setUri does not work. Any known issues regarding this?
Setting UIActivityViewController's UTI does not work.
There are five copies of my discussion post. How do I get rid of them?
HoloUrhoSharp not running
How to download file from secure server using dependency service
Hi,
I created a dependency service "downloadFileManager".
In Droid i implemented this function :
public void DownloadFile(string uri, string filename)
{
var cookies = GetCookies();
Android.Net.Uri contentUri = Android.Net.Uri.Parse(uri);
var deviceIdentifier = new DeviceHelper();
deviceIdentifier.GetIdentifier();
Android.App.DownloadManager.Request r = new Android.App.DownloadManager.Request(contentUri);
r.AddRequestHeader("Accept", "*/*");
r.AddRequestHeader("Accept-Encoding", "gzip, deflate, sdch, br");
r.AddRequestHeader("Uuid", deviceIdentifier.GetIdentifier());
foreach (var cookie in cookies)
{
r.AddRequestHeader("Cookie", cookie);
}
r.SetDestinationInExternalPublicDir(Android.OS.Environment.DirectoryDownloads, filename);
r.AllowScanningByMediaScanner();
r.SetNotificationVisibility(Android.App.DownloadVisibility.VisibleNotifyCompleted);
Android.App.DownloadManager dm = (Android.App.DownloadManager)Forms.Context.GetSystemService(Context.DownloadService);
dm.Enqueue(r);
}
When i try to download a file from demo site like "http://www.pdf995.com/samples/pdf.pdf" the download works fine but when i try to download from my (secured) server the download "unsucessful" and in the iis log i see that the request get "401" error.
I checked the request and got the session cookie.
What did i miss??
Thank you.
Default FirebaseApp is not initialized in this process
I face strange issue FireBase asking me to initializeApp before I can get token
Default FirebaseApp is not initialized in this process com.ready_apps.Nebka.Business. Make sure to call FirebaseApp.initializeApp(Context) first.
even I called FirebaseApp.InitializeApp(this);
in many places
MyApplication calls (that extend Application) , in the activity I ask for token FirebaseInstanceId.Instance?.Token;
but this crash keep appear to me , any one could tell me what I should to do
Click through a Subview if not touching a Button
I have a subview, containing a view controller with navigation buttons, that I want to pass touches through if the buttons aren't hit.
I've found some suggestions to override HitTest on the container view, but it either doesn't work or I'm not doing it correctly.
So I have a parent view controller, created with a storyboard, and I added my subview like so in ViewDidLoad:
containerOne = new TestView(new RectangleF(0, 0, (float)screenWidth, (float)screenHeight));
containerOne.TranslatesAutoresizingMaskIntoConstraints = false;
containerOne.AutosizesSubviews = true;
containerOne.BackgroundColor = UIColor.FromRGBA(0,0,0,0);
View.AddSubview(containerOne);
var firstChild = new TestController();
AddChildViewController(firstChild);
containerOne.AddSubview(firstChild.View);
containerOne.Frame = new RectangleF((float)containerOne.Frame.X, (float)containerOne.Frame.Y, (float)containerOne.Frame.Width, (float)firstChild.View.Frame.Height + 200);
firstChild.View.Frame = containerOne.Bounds;
firstChild.DidMoveToParentViewController(this);
And my Test View where I've attempted to implement a fix:
public class TestView : UIView
{
public TestView(CGRect frame) : base(frame)
{
}
public override UIKit.UIView HitTest(CoreGraphics.CGPoint point, UIKit.UIEvent uievent)
{
UIView hitView = base.HitTest(point, uievent);
if (hitView == this)
{
Console.WriteLine("null");
return null;
}
Console.WriteLine("hitTestView");
return hitView;
}
}
The subview's view controller (TestController referenced above) has a button at the bottom of the screen and the rest is empty. I'd like to be able to hit the parent view controllers buttons, but nothing happens and I can't get through my subview's layer. My Console.WriteLine("null") never appears.
I'd really appreciate some help on this so I can figure this out! Thanks!
XDocument.Load throws System.IO.IOException: Too many files opened.
System.IO.IOException: Too many files opened.
In the PCL project I am using XDocument.Load(filePath) to read Xml files,
It's used with a click event with shapes, and seems to have no correlation with the number of times XDocument.Load is called.
I found that the exception is coming from XmlReader.Create()
There are no issues when using this with UWP.
I've searched everywhere for a solution to this issue, with no luck.
Has anyone else ran into this issue, or knows of any solution to fix this issue?
Thank you,
Garrick
On UWP, is anybody else seeing ListView content disappearing when the Alt key is held down?
On UWP running on desktop with a physical keyboard, if I hold the Alt key down when the focus is on a ListView, the text content of the ListView sometimes disappears (background colors remain). Is anybody else seeing this? If so, I'll log a bug. If not, I'll start what will probably be a hairy piece of debugging...
How to change text color of a button in xml style file?
Hello guys, I have a button and his xml file, I want to change the text color:
But I don't know how can I do this, have my xml style file, could anyone can please help me to tell me wht's the property where I need to change text color?
`
<item android:right="5dp" android:top="5dp">
<shape>
<corners android:radius="2dp"/>
<solid android:color="#D6D6D6"/>
</shape>
</item>
<item android:bottom="2dp" android:left="2dp">
<shape>
<gradient android:angle="270" android:endColor="#4A6EA9" android:startColor="#4A6EA9"/>
<stroke android:width="1dp" android:color="#BABABA"/>
<corners android:radius="4dp"/>
<padding android:bottom="10dp" android:left="10dp" android:top="10dp"/>
</shape>
</item>
</layer-list>
<item android:right="5dp" android:top="5dp">
<shape>
<corners android:radius="2dp"/>
<solid android:color="#D6D6D6"/>
</shape>
</item>
<item android:bottom="2dp" android:left="2dp">
<shape>
<gradient android:angle="270" android:endColor="#4A6EA9" android:startColor="#4A6EA9"/>
<stroke android:width="1dp" android:color="#BABABA"/>
<corners android:radius="4dp"/>
<padding android:bottom="10dp" android:left="10dp" android:top="10dp"/>
</shape>
</item>
</layer-list>
<item android:right="5dp" android:top="5dp">
<shape>
<corners android:radius="2dp"/>
<solid android:color="#D6D6D6"/>
</shape>
</item>
<item android:bottom="2dp" android:left="2dp">
<shape>
<gradient android:angle="270" android:endColor="#7C97C1" android:startColor="#4A6EA9"/>
<stroke android:width="1dp" android:color="#BABABA"/>
<corners android:radius="4dp"/>
<padding android:bottom="10dp" android:left="10dp" android:top="10dp"/>
</shape>
</item>
</layer-list>
`
Activity indicator does not show up
When I want to show Activity indicator it does not appear. Actually, the page is frozen and after that display the next page.
Here is my code:
`private async void TapGestureRecognizer_Tapped_1(object sender, EventArgs e)
{
try
{
if (txtNumOrden.Text != null && txtNumOrden.Text != "")
{
actLoading.IsRunning = true;
EntregasModel entrega = new EntregasModel();
entrega.shipperID = txtNumOrden.Text.Trim();
entrega.token = this.cliente.token;
await Navigation.PushAsync(new DescripcionEntregas(entrega));
actLoading.IsRunning = false;
txtNumOrden.Text = string.Empty;
}
else
{
await DisplayAlert("Error", "Favor de Introducir # de Orden", "cancel");
txtNumOrden.Focus();
}
}
catch (Exception ex)
{
}
}`
Any ideas? I'll appreciate your help.
Thanks!
How to tap Android TabLayout tab (set up with ViewPager)?
I'm writing a UITest for an APK and trying to tap a tab in a TabLayout
. The TabLayout
has an id, but the individual TabViews do not, so I'm not sure how to access those. I've tried to access by text but it's now working for me. Thanks for any help.
I'm using a ViewPager
to set up the tabs, not sure it that matters.
How to add buttons to Push Notification?
Hey,
I'm developing an Xamarin.Forms app and I need to handle the Push Notifications on the Android app. I need to have a button on the notification that the user is seeing and he can click on it. Here is the notification that I'm building:
`
void createNotification(string title, string desc)
{
//Create notification
var notificationManager = GetSystemService(Context.NotificationService) as NotificationManager;
//Create an intent to show ui
var uiIntent = new Intent(this, typeof(MainActivity));
//Use Notification Builder
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
//Create the notification
//we use the pending intent, passing our ui intent over which will get called
//when the notification is tapped.
var notification = builder.SetContentIntent(PendingIntent.GetActivity(this, 0, uiIntent, 0))
.SetSmallIcon(Resource.Drawable.ic_stat_ic_notification)
.SetTicker(title)
.SetContentTitle(title)
.SetContentText(desc)
//.AddAction(new NotificationCompat.Action())
//Set the notification sound
.SetSound(RingtoneManager.GetDefaultUri(RingtoneType.Notification))
//Auto cancel will remove the notification once the user touches it
.SetAutoCancel(true).Build();
//Show the notification
notificationManager.Notify(1, notification);
}
`
Where do I put the button and the method it trigger when it has been clicked?
Thanks.
Facing issue in Test cloud for Tap Button in iPhones
Device : Apple iPhone 7 Plus
OS : iOS 10.0.3
Model : iPhone9,4
Release date : September 2016
Screen size : 5.5 in (13.97 cm)
Resolution : 1080 x 1920
Below is the error i am facing for above device, anyone please help me
NUnit-Console version 2.6.3.13283
Copyright (C) 2002-2012 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.
Runtime Environment -
OS Version: Unix 15.3.0.0
CLR Version: 4.0.30319.17020 ( Mono 4.0 ( 4.2.3 (explicit/832de4b Thu Mar 3 19:24:57 EST 2016) ) )
ProcessModel: Default DomainUsage: Single
Execution Runtime: mono-4.0
Installing test cloud reporter.
Connected to Xamarin.UITest.
Run list: runlist.txt
.F.16-10-2017 16:22:21.173 +02:00 - 0 - Full log file: /Volumes/Data/xamarin/workspaces/38761e62-4305-47b2-8bac-b57de55ccb30/workspace/tmp/uitest/log-2017-10-16_16-22-21-167.txt
16-10-2017 16:22:21.176 +02:00 - 3 - iOS test running Xamarin.UITest version: 2.0.10
16-10-2017 16:22:21.238 +02:00 - 64 - Using TEST_CLOUD configuration override.
16-10-2017 16:22:21.946 +02:00 - 773 - Running in Test Cloud, on device with iOS8 or higher.
16-10-2017 16:22:58.011 +02:00 - 36836 - Test server version: 0.20.7
16-10-2017 16:22:59.479 +02:00 - 38305 - Took screenshot. { Counter: 1, Title: "First screen.", FileName: "/Volumes/Data/xamarin/workspaces/38761e62-4305-47b2-8bac-b57de55ccb30/workspace/screenshot-1-873e0b26599e42ad8f305d6dcd9912d9.png", ElapsedMilliseconds: 294 }
16-10-2017 16:22:59.481 +02:00 - 38306 - XTC_STEP_DATA
16-10-2017 16:22:59.482 +02:00 - 38308 - {"Counter":1,"Title":"First screen.","StepHash":"XXXXXXXXXXXX","ScreenshotPath":"/Volumes/Data/xamarin/workspaces/38761e62-4305-47b2-8bac-b57de55ccb30/workspace/screenshot-1-873e0b26599e42ad8f305d6dcd9912d9.png","ScreenshotElapsedMilliseconds":294,"ScreenshotTotalElapsedMilliseconds":294,"ScreenshotMimeType":null,"ScreenshotRotation":"0"}
16-10-2017 16:22:59.482 +02:00 - 38308 - XTC_STEP_END
Took final screenshot. { Title: "After test", FileName: "/Volumes/Data/xamarin/workspaces/38761e62-4305-47b2-8bac-b57de55ccb30/workspace/screenshot-final-4e1b801168294d30819e402e2f3a4bc1.png", ElapsedMilliseconds: 223 }
.N.16-10-2017 16:23:00.808 +02:00 - 0 - Full log file: /Volumes/Data/xamarin/workspaces/38761e62-4305-47b2-8bac-b57de55ccb30/workspace/tmp/uitest/log-2017-10-16_16-23-00-808.txt
16-10-2017 16:23:00.808 +02:00 - 0 - iOS test running Xamarin.UITest version: 2.0.10
16-10-2017 16:23:00.808 +02:00 - 0 - Using TEST_CLOUD configuration override.
16-10-2017 16:23:01.267 +02:00 - 458 - Running in Test Cloud, on device with iOS8 or higher.
16-10-2017 16:23:35.988 +02:00 - 35178 - Test server version: 0.20.7
16-10-2017 16:23:38.445 +02:00 - 37635 - Waiting for element matching Marked("alertTitle").
16-10-2017 16:24:38.593 +02:00 - 97781 - Error while performing WaitForElement(Marked("alertTitle"), "Update Info not loaded", 00:01:00, null, null)
Exception: System.TimeoutException: Update Info not loaded
at Xamarin.UITest.Shared.WaitForHelper.WaitForAny[T] (System.Func1 query, System.String timeoutMessage, Nullable
1 timeout, Nullable1 retryFrequency, Nullable
1 postTimeout) <0x77b7988 + 0x000db> in :0
at Xamarin.UITest.iOS.iOSApp+c__AnonStorey1C.<>m__0 () <0x77b6b58 + 0x001fb> in :0
at Xamarin.UITest.Utils.ErrorReporting.With[T] (System.Func`1 func, System.Object[] args, System.String memberName) <0x6ef92a0 + 0x00034> in :0
Error while performing WaitForElement(Marked("alertTitle"), "Update Info not loaded", 00:01:00, null, null)
16-10-2017 16:24:39.410 +02:00 - 98598 - Took screenshot. { Counter: 1, Title: "Login Page", FileName: "/Volumes/Data/xamarin/workspaces/38761e62-4305-47b2-8bac-b57de55ccb30/workspace/screenshot-1-3840f86c0eb545b2a61cdc97e2f47dfe.png", ElapsedMilliseconds: 289 }
16-10-2017 16:24:39.411 +02:00 - 98598 - XTC_STEP_DATA
16-10-2017 16:24:39.411 +02:00 - 98599 - {"Counter":1,"Title":"Login Page","StepHash":"XXXXXXXXXXXXX","ScreenshotPath":"/Volumes/Data/xamarin/workspaces/38761e62-4305-47b2-8bac-b57de55ccb30/workspace/screenshot-1-3840f86c0eb545b2a61cdc97e2f47dfe.png","ScreenshotElapsedMilliseconds":289,"ScreenshotTotalElapsedMilliseconds":289,"ScreenshotMimeType":null,"ScreenshotRotation":"0"}
16-10-2017 16:24:39.411 +02:00 - 98599 - XTC_STEP_END
16-10-2017 16:24:39.614 +02:00 - 98802 - Waiting for element matching Marked("UserNameEntry").
16-10-2017 16:24:40.632 +02:00 - 99820 - Tapping element matching Marked("UserNameEntry") at coordinates [ 160, 202.67 ].
16-10-2017 16:24:43.724 +02:00 - 102912 - Error while performing EnterText("XXXXXXXX")
Exception: System.Exception: No keyboard is visible for text entry.
at Xamarin.UITest.iOS.iOSApp+c__AnonStorey5.<>m__0 () <0x7899478 + 0x0011f> in :0
at Xamarin.UITest.Utils.ErrorReporting.With (System.Action func, System.Object[] args, System.String memberName) <0x6eedc48 + 0x00030> in :0
16-10-2017 16:24:44.539 +02:00 - 103726 - Took screenshot. { Counter: 2, Title: "Test Fixture Ignored. Reason: Error while performing EnterText("XXXXX")", FileName: "/Volumes/Data/xamarin/workspaces/38761e62-4305-47b2-8bac-b57de55ccb30/workspace/screenshot-2-3840f86c0eb545b2a61cdc97e2f47dfe.png", ElapsedMilliseconds: 277 }
16-10-2017 16:24:44.540 +02:00 - 103727 - XTC_STEP_DATA
16-10-2017 16:24:44.540 +02:00 - 103727 - {"Counter":2,"Title":"Test Fixture Ignored. Reason: Error while performing EnterText("XXXXXX")","StepHash":"XXXXXX","ScreenshotPath":"/Volumes/Data/xamarin/workspaces/38761e62-4305-47b2-8bac-b57de55ccb30/workspace/screenshot-2-3840f86c0eb545b2a61cdc97e2f47dfe.png","ScreenshotElapsedMilliseconds":277,"ScreenshotTotalElapsedMilliseconds":277,"ScreenshotMimeType":null,"ScreenshotRotation":"0"}
16-10-2017 16:24:44.540 +02:00 - 103727 - XTC_STEP_END
NTook final screenshot. { Title: "After test", FileName: "/Volumes/Data/xamarin/workspaces/38761e62-4305-47b2-8bac-b57de55ccb30/workspace/screenshot-final-aced71c638ce4b23a155e8b2afe27060.png", ElapsedMilliseconds: 255 }
Completed run. 60 events collected.
[[[ XTC-Output-Path: '/Volumes/Data/xamarin/workspaces/38761e62-4305-47b2-8bac-b57de55ccb30/workspace/tmp/TestRun-20171016-142445-4287' ]]]
Tests run: 1, Errors: 0, Failures: 0, Inconclusive: 0, Time: 145.0684544 seconds
Not run: 3, Invalid: 0, Ignored: 3, Skipped: 0
WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v4.0.30319
Missing class in Xamarin binding project
I'm trying to create a binding for an Android library, .aar file. All of the classes get generated except for one. I see the missing class listed in the api.xml.class-parse file but it is not in the api.xml file and not in the obj/Debug/generate/src folder. I do not see any errors listed in the build output.
Is there anywhere that errors related to the missing class would be listed?
Visual Studio Pro 2017 not saving SDK, NDK or Java Paths when changed.
I am having an issue with Visual Studio Pro 2017 not saving the SDK, NDK or Java paths when I update them in Tools -> Options -> Xamarin -> Android Settings. I also have community edition loaded, and they get saved correctly there.
I have changed them in the following registry key, but when go back into VS, they are changed back:
"[HKEY_CURRENT_USER\Software\Xamarin\VisualStudio\15.0_91fab84c\Android]"
Permissions Plugin for Xamarin (Simplifying Runtime Permissions)
Just released my latest plugin to request permissions from shared code! Checkout my blog for details
Code: https://github.com/jamesmontemagno/Xamarin.Plugins/tree/master/Permissions
NuGet: http://www.nuget.org/packages/Plugin.Permissions
Example:
try
{
var status = await CrossPermissions.Current.CheckPermissionStatus(Permission.Location);
if (status != PermissionStatus.Granted)
{
if(await CrossPermissions.Current.ShouldShowRequestPermissionRationale(Permission.Location))
{
await DisplayAlert("Need location", "Gunna need that location", "OK");
}
var results = await CrossPermissions.Current.RequestPermissions(new[] {Permission.Location});
status = results[Permission.Location];
}
if (status == PermissionStatus.Granted)
{
var results = await CrossGeolocator.Current.GetPositionAsync(10000);
LabelGeolocation.Text = "Lat: " + results.Latitude + " Long: " + results.Longitude;
}
else if(status != PermissionStatus.Unknown)
{
await DisplayAlert("Location Denied", "Can not continue, try again.", "OK");
}
}
catch (Exception ex)
{
LabelGeolocation.Text = "Error: " + ex;
}
how to show display alert when httpClient.GetASync("uri") return response null ?
var httpClient = new HttpClient();
var response = await httpClient.GetAsync("url");
if (response.StatusCode == HttpStatusCode.NoContent)
{
await DisplayAlert("No Record!!", "No Record Found!! \n try another", "Cancel");
}
else
{
var result = response.Content.ReadAsStringAsync().Result;
var name = JsonConvert.DeserializeObject<List<AddDonorClass>>(result);
LvDonors.ItemsSource = name;
}
Ad a settings page that works for iOS and Android in PCL
First day here and second question...
I've noticed that you can add more than one tool bar item to the navigation bar, but cant work out how you add items to the left of it in iOS.
I've seen apps that have the three bar hamburger on the left and want to add my own, but I want to have it so the settings page that gets opened is opened in the same way for Android and iOS.
I'm very new to Xamarin development so please, if you have any examples of how this works id love to see them. If it can't be done (or is beyond my basic understanding so far) just let me know.
Also, is there a repository of default toolbar icons for iOS (3 bar burger, "+" sign for add etc) or do I have to make my own?
Thanks,
Karl
Bug in Label.LineBreakMode ?
Hi,
I'm having a lot of trouble to display text in my application with correct wordwrapping (LineBreakMode.WordWrap) . If I set the Label.Text directly in the XAML, there is no problem, it shows correctly. But if I take the same text, assign it to a variable in my ViewModel, and then databind the Label.Text to this variable, all of a sudden, the WordWrap is ignored, and it uses what looks like CharacterWrap. (But if i set it to truncation, it does truncate !)
I was going to add an image, but I'm getting "You have to be around for a little while longer before you can post links."
(Although I posted this message already over a year ago : forums.xamarin.com/discussion/75839/problem-with-word-wrapping-with-xamarin-forms-label - how long do I have to wait to be able to post an image ?)
any ideas ? This is with the latest Xamarin.Forms nuget, and I get it for both iOS and Android ...
Plugin and Permission Changes with iOS 11
Oct 18, 2017 - We just blogged about Plugin and permission changes with iOS 11!
Read the post here
Discuss below
Testing iOS in the Test Cloud -> EnterText() Timed out waiting for keyboard
@Glenn.Wilson In the Announcements of Xamarin.UITest 2.0.0 you made the statement that EnterText() can be slow or occasionally throw errors.
Do my errors correlate with what you are aware of?
When I am running the tests locally on my machine they all work. I am using Xcode 7 (because the failed to install device agent issue is not fixed!) and testing on an iOS 9.3 device.
When I run my tests in the Cloud all of them fail for the same reason:
System.Exception : Error while performing EnterText(Marked("foomarked"), "text to enter") ----> System.TimeoutException : Timed out waiting for keyboard.
at Xamarin.UITest.Utils.ErrorReporting.With (System.Action func, System.Object[] args, System.String memberName) <0x7803460 + 0x0018f> in :0
at Xamarin.UITest.iOS.iOSApp.EnterText (System.Func`2 query, System.String text) <0x801d678 + 0x00193> in :0
The Device I used in the Test Cloud is an Apple iPad Pro iOS 10.0.2
Locally they work!
Is there anything I can change to make EnterText() working in the cloud?
@dushyantanreddy
Are you having the same issues ?
Best Regards
Hubertus