I noticed that my ScrollView on UWP does not seem to track mouse position correctly.
I make a long ScrollView using RequestedHeight="1000", and add a Checkbox.
If the ScrollView is scrolled, then the CheckBox tracks the mouse position at the unscrolled location.
Same problem with touch, coordinates are not translated to the scrolled location.
It works fine on Android.
What gives? Is there something I need to do for UWP specifically?
Thanks,
Lars
ScrollView on UWP mouse position offset
CheckBox control won't render inside of a TabViewControl in a Rg.Plugins.Popup
Tis the strangest thing. I'm using Rg.Plugins.Popups with the Xam.Plugin.TabView (and the latest Xamarin.Forms, although I've tried a few of the 4.6 versions too).
On Android, the Xamarin.Forms CheckBox won't render inside of a TabViewControl in a popup. It'll render just fine if not in the TabView, but no matter where/how I place it (wrap in a grid, stacklayout, frame etc), it won't render inside of a TabView. Works fine in UWP though.
The weird thing is, if I create a stand-alone Xamarin.Forms Android project to replicate this, it renders just fine.
There are no exceptions at all, it just isn't there.
I'm at a loss as to figure out why it isn't rendering!
Change background color of ToolbarItems
How do I change the background color and text of ToolbarItems? The default color is black and I would like to change how to do it?
<ContentPage.ToolbarItems> <ToolbarItem Order="Secondary" Icon="morevert.png" Text="Atualizar" Command="{Binding Atualizar}"/> <ToolbarItem Order="Secondary" Text="Ajuda" Command="{Binding Ajuda}"/> <ToolbarItem Order="Secondary" Text="Sair" Command="{Binding Sair}"/> </ContentPage.ToolbarItems>
problem with this web site
hello, i am new here, and i am trying to ask a question but always receiving a code with exception, how this works?!
Cheap android devices to test with
How does Xamarin linker work with proguard? How is it related?
Does Xamarin Linker do same job as Proguard? how are they related? I am asking because other day i upgraded to AndroidX and Xamarin.facebook.Android latest version, although it was working in debug mode, it failed on Release. On debug mode, I enable r8 like release but not Linker. Error was as below,
androidx.core.app.CoreComponentFactory.instantiateActivity java.lang.InstantiationException: java.lang.Class<com.facebook.FacebookActivity> cannot be instantiated
I understood that it is the Linker error as i have user and sdk assemblies linker enbaled. So I added Skipp assembly for xamarin.facebook.Android but it didnt help. I tried both in the android settings as well as in my linker.xml.
Then I added this line into the proguard. It worked fine also in release mode.
-keep class com.facebook.FacebookActivity { public *; }
So my question is does linker use proguard also? if it was proguard issues, i would get also for debug configuration because I have code shrinker as r8 enabled.
I couldnt find detailed information how does linker work?
I also dont understand why Linker fails on below code if there is instance created. Can someone explain how linker works and how is it related to proguard?
https://docs.microsoft.com/en-us/xamarin/android/deploy-test/linker#control
// To play along at home, Example must be in a different assembly from MyActivity. public class Example { // Compiler provides default constructor... } [Activity (Label="Linker Example", MainLauncher=true)] public class MyActivity { protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Will this work? var o = Activator.CreateInstance (typeof (ExampleLibrary.Example)); } }
Xamarin.Android, AndroidManifest.xml, AndroidManifestMerger, xmlns:tools schema, replace always manu
When compile my Xamarin Forms Android application, visual studio, show me an error's list of AndroidManifest.xml conflict, for example:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(3,3): Error AMM0000: is also present at AndroidManifest.xml:14:9-41 value=(@string/app_name). (AMM0000) /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(3,3): Error AMM0000: Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:19:3-79:17 to override. (AMM0000)
So i open AndroidManifest.xml from debug folder, replace with tools:replace into application tag, add tools schema into manifest tag, save it, recompile my application and it run without error.
But WHENEVER i compile my Xamarin Forms Android application, must follow previous steps MANUALLY.
I also add manifestmerger.jar, into my Android .csproj
This issue is showed into DEBUG and RELEASE mode!!
Environment
- Visual Studio Community 2019 for Mac Version 8.6.4
- Xamarin Forms = 4.7.0.968
- Xamarin.Android = Versione: 10.3.1.4
Xamrain Forms app templates
Hi
I‘m a dot net developer but digging first time into Xamarin. My first Xamrain Forms app needs a few simple screens; a list screen, a simple vertical stacked gallery, a news page with pic, headline and synopsis. App would be mostly UI, bound to backend remote api.
I wondering if I there are any page/app templates that I can use to jump start development while I am still learning Xamrain Forms. Any pointers would be appreciated.
Thanks
Regards
ListView Itemsource
Dear Forum
I created a ListView, and I populated it with String, coming from a list..It is working:
List S_List = new List();
S_List.Add("A");
S_List.Add("B");
S_List.Add("C");
ListView LV1 = new ListView();
LV1.ItemsSource = S_List;
Content = LV1;
Now ,I want populate it with only 2 colored box (BoxView) ,but ,is not working:
//-- BoxView
BoxView BX1 = new BoxView();
BX1.Color = Color.Red;
BoxView BX2 = new BoxView();
BX2.Color = Color.Red;
List B_List = new List();
B_List.Add(BX1);
B_List.Add(BX2);
//ListView
ListView LV1 = new ListView();
LV1.ItemsSource = B_List;
Content = LV1;
I get 2 line with a string sayng Xamarin.Form.BoxView , that seems a conversion in String.
Why ?
Is possible to dont use DataTemplate, as shown in many example ?
Thanks
Roberto
Storing information in app
Hello,
I want to store information such as name and designation in app. so that, when the app opens next time i can pull it out and display it.
Can you please tell me how to do it?
Thanks in advance
How to change Text Atribute of Label using FadeTo Method when a Toggle Control in View is pressed
Hello everyone, this is my very first question, i just suscribed, I am using MVVM pattern and i need to change the Text value of a label in my View, when i press a toggle control. The thing is, when i switch between two values of text, the label shows a kind of unwanted blink before take the new value, according to this, i was wondering if using FadeTo method, i could avoid this effect of blink. Please, any idea on how to achieve this would be very appreciated. thanks in advance.
public bool KgToggled
{
get
{
ModifyTextAmount(_kgToggled);
return _kgToggled;
}
set => SetProperty(ref _kgToggled, value);
}
private void ModifyTextAmount(bool flag) { TextLabelKg = flag ? "By Kg" : "By Head"; Amount = flag ? Price * Kg : Price * Heads; }
How to upload music to deezer?
- Hi everybody!
- I just downloaded an app called Deezer to listen and download music very well.
- As a new user, I only know how to listen to music, not how to upload music to Deezer.
- Does anyone in our forum know how to upload music that can only help me?
Migration Android Support Library to AndroidX
I migrated android support library to AndroidX and using xamarin.androidx.migration, I found using Android.Support. and in the app implementation
using Android.Suppot. From using AndroidX. I thought it would change to. Is that the next step? or is it not necessary?
I removed all reference Android.Support.library but when build then can not restore nuget
"Version conflict detected for Xamarin.Android.Support.Collections. Install/reference Xamarin.Android.Support.Collections 28.0.0.3 directly to project ns_stock.Droid to resolve this issue. ns_stock.Droid -> Xamarin.Android.Support.Design 28.0.0.3 -> Xamarin.Android.Support.Compat 28.0.0.3 -> Xamarin.Android.Support.Collections 😊 28.0.0.3) ns_stock.Droid -> Xamarin.Auth 1.7.0 -> Xamarin.Android.Support.CustomTabs 28.0.0.1 -> Xamarin.Android.Support.Collections 😊 28.0.0.1). Restore failed." something wrong?
Thanks
Help me to add custom set of MSBuild Targets and Tasks for Dotfuscator for protecting App?
I am trying to protect my app using dotfuscator. i took this link as reference https://www.preemptive.com/dotfuscator/ce/docs/help/getting_started_xamarin.html#pctoc-android
i downloaded preEmtive dotfuscator into my VS2019 and activated dotfuscator using dotfuscatorCLI.exe /? . later i count add the below MSBuild
Tasks.can any one please guide me to go right path
PreEmptive.Dotfuscator.Xamarin.targets
PreEmptive.Dotfuscator.Internal.Tasks.dll
Provisioning Profile not showing up on IOS Bundle Signing
Hey I've been stuck on this for a while.
I have made a bunch of different provisioning profiles on apple: https://developer.apple.com/account/resources/profiles/list
And for some reason they are not showing up on the IOS Bundle Signing. I have changed the Signing Identity's and still nothing is showing up.
Also my computer is connected to it and I've followed all the steps on all the forms posts, nothing seems to work, can you please help me out.
It would be greatly appreciated if you could help
-- Thank you very much!
I didn't setup XCode before hand
'none of the currently installed provisioning profiles match the apps bundle id'
I have been trying and failing to deploy my app under a Dev provisioning profile.
First thing to note is I develop on a PC, and I then copy the VS files to the mac, and then build on the Mac directly, although I could get the PC to pair to the mac, it drops out often, so I just figure that the mac is there, might as well open Visual Studio and work on the mac.
So my problem:
VS for Mac v 8.6.5 Build 23, Catalina and xamarin, all fully up to date 26/6/2020
In VS Mac, Build -> Archive for publishing -> Sign and Upload -> 'none of the currently installed provisioning profiles match the apps bundle identifier'
I believe my Mac has the correct signing certificate I have done this process a few times the cert in developer.apple.com matches the developer cert on the Mac keychain certs
I have setup an App with an appropriate Bundle ID in developer.apple.com, this matches the BundleID in the info.plist file
I created a dev provisioning profile in developer.apple.com, downloaded it and installed in on the Mac
I use the same Bundle ID I use in Visual Studio for Mac, Xamarin iOS project. -> If I change this bundle identifier in info.plist and try to compile the project, it fails, but if I use the same one as above, the project compiles as expected. So BundleIDs match - all good! Code compiles!
However when: In VS Mac, Build -> Archive for publishing -> Sign and Upload ->
I get:
'none of the currently installed provisioning profiles match the apps bundle identifier'
If instead of trying to upload the file directly to apple from VS, I save the IPA file to disk and use Transporter to upload it:
I get:
'No suitable application records were found. Verify your bundle identifier is correct.'
Please note that when I look at the ios project properties in VS, under IOS bundle signing options, I see in the provisioning profile dropdown, the exact same provisioning profile that I had created in developer.apple.com, and installed on the Mac. It is clearly visible in this drop down and I select it.
I have been round and round, deleting provisioning profiles from:
~/Library/MobileDevice/Provisioning Profiles/
And re generating them in developer.apple.com reinstalling rebooting etc.. its killing me... round and round in circles..
If I examine the provisioning profle on disk at location ~/Library/MobileDevice/Provisioning Profiles/ it shows I have the correct certificate, and it shows me an appID (not bundleID)
The appID it shows is TeamID.BundleID, and this looks also 100% correct to match what is in info.plist, and what is in developer.apple.com
The fact everything matches is subtly telling me that this is another bug in Visual Studio, any one have any ideas and or contacts that could help with this one.
My sanity is on the line and I am hoping someone out there has the ability to help out!
Error when launching Android Emulator in Visual Studio 2019
I installed the mobile dev kit on VS 2019 Community edition (VS 2019 with all updates)
When i try to launch the test app i receive the error
Android SDK instance error
Android SDK instance is not found.
Please reinstall "Individual components -> Android SDK setup" using the Visual Studio Installer.
Do you want us to open Visual Studio Installer for you?
I open VS installer and search for Android and see Android SDK setup (API 28) with a check mark against it (so its installed). What else do i require to install to get this working?
Get number from Incoming call and then launch my app
Hi Geeks,
I have a requirement where I need to work in the following scenario.
When any user gets a call, identify the number, and launch my app in the background and insert a record in some table.
I searched through different forums and found BroadcastReceiver is the one by which I can get the incoming number.
However, I tried to implement this, but no success.
[BroadcastReceiver(Enabled =true)] [IntentFilter(new[] { "com.App.CALLER_RECEIVER" })] public class IncomingCallReader : BroadcastReceiver { public override void OnReceive(Context context, Intent intent) { switch (intent.Action) { case Intent.ActionNewOutgoingCall: Globals.ContactNumber = intent.GetStringExtra(Intent.ExtraPhoneNumber); var outboundPhoneNumber = intent.GetStringExtra(Intent.ExtraPhoneNumber); Toast.MakeText(context, $"Started: Outgoing Call to {outboundPhoneNumber}", ToastLength.Long).Show(); break; case TelephonyManager.ActionPhoneStateChanged: var state = intent.GetStringExtra(TelephonyManager.ExtraState); if (state == TelephonyManager.ExtraStateIdle) Toast.MakeText(context, "Phone Idle (call ended)", ToastLength.Long).Show(); else if (state == TelephonyManager.ExtraStateOffhook) Toast.MakeText(context, "Phone Off Hook", ToastLength.Long).Show(); else if (state == TelephonyManager.ExtraStateRinging) Toast.MakeText(context, "Phone Ringing", ToastLength.Long).Show(); else if (state == TelephonyManager.ExtraIncomingNumber) { var incomingPhoneNumber = intent.GetStringExtra(TelephonyManager.ExtraIncomingNumber); Toast.MakeText(context, $"Incoming Number: {incomingPhoneNumber}", ToastLength.Long).Show(); } break; default: break; } } protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); Xam.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); RegisterReceiver(new IncomingCallReader(), new IntentFilter("com.uniconta.mobile_new.app")); LoadApplication(new App()); }
Second Approach:
public interface ICallReceiver { void OnReceive(); } public class IncomingCallReceiver: ICallReceiver { public void OnReceive() { Intent intent = new Intent("com.uniconta.CALLER_RECEIVER"); var incomingPhoneNumber = intent.GetStringExtra(TelephonyManager.ExtraIncomingNumber); Globals.ContactNumber = incomingPhoneNumber; Forms.Context.SendBroadcast(intent); } }
DependencyService.Get().OnReceive();
I want this method to be called whenever the user gets a call.
1st question - Is it possible to get the incoming call number in Xamarin forms?
2nd Question - is it possible to launch an app in the background when someone gets a call and app can do things in the background?
Thanks
Anand
Xamarin Forms, cannot generate IPA file for IOS project
Hello,
I have a Xamarin.Forms app that we run on Android, IOS and Windows. Android and Windows work fine and we have them deployed. IOS works fine in the Simulator, and I can install to an iPad via a USB cable. But, I have been unable to generate an IPA file for wider distribution.
When running the Release build (Build IPA is checked), all seems to go well but no IPA file is generated.
The only thing that looks awry is this warning message: "There is no available connection to the Mac, hence the task Xamarin.Messaging.Tasks.CopyFileFromMac will not be executed".
Our MacInCloud server is paired for the build session, so should be "available". But I assume this is why we are not getting the IPA file? Does that message imply that I could/should be able to find the file out on the MacInCloud server somewhere? I looked around, but could not see one.
VS.2019 is latest build, and NuGet Xamarin packages are also latest.
Can anyone give me some guidance on how to get our IPA generated?
Thanks for any help.
Bryan Hunt
How to bind collection view selected items into a new listview using MVVM?
I have the following observableCollection:
Main View Model:
MainViewModel : INotifyProperyChanged public MainViewModel() { Accessories = new ObservableCollection<string>(); Accessories.Add("Cast"); Accessories.Add("Neck Ring"); Accessories.Add("Shoulder Wedges"); Accessories.Add("Grip Rings"); Accessories.Add("Head Rest"); Accessories.Add("Knee Roll"); Accessories.Add("Elbow Sling"); Accessories.Add("Thermoplastic Mask"); Accessories.Add("Vacuum Lock Bags"); Accessories.Add("Breast Board"); } public ObservableCollection<string> selectedAccessories = new ObservableCollection<string>(); public ObservableCollection<string> SelectedAccessories { get => selectedAccessories; set { if (selectedAccessories == value) return; else { selectedAccessories = value; OnPropertyChanged(nameof(SelectedAccessories)); } } public event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); }
Then on the XAML Side:
<CollectionView ItemsSource="{Binding Accessories}" SelectionMode="Multiple" SelectedItems="{Binding SelectedAccessories}" /> <Label x:Name="label1" Text="{Binding SelectedAccessories}" /> <ListView x:Name="list1" ItemsSource="{Binding SelectedAccessories}" />
I would like to display in either a label or listview (both work). Now, Selected Accessories is an observable collection that would need to be the ItemsSource for the new list.
I also tried a different PropertyChanged method and it still doesn't work:
public event PropertyChangedEventHandler PropertyChanged; publicvoid OnPropertyChanged2(ObservableCollection<string> selectedAccessories) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(selectedAccessories.ToString())); }
The same structure work for other data types but I can't make it work for ObservableCollections. Do I need to create a method to retrieve the strings of the selected items? How can I access the selectedItems?