How to scuffle position of two Tabbar Shell Items programetically in run time using code behind c# .
How to scuffle position of two Tabbar Shell Items programetically in run time using code behind c#.
How to change text of a button in the main App from App.Android realtime?
Hi!
I'm receiving realtime data from platform-specific code (Firebase Realtime Database) with EventListener, but my UI is in the main App. I can't figure out how to change button text in the main App from the App.Android code realtime.
Tried Interfaces, Binding and MessagingCenter with no success.
I just want to show how many unread messages a person currently has. Like: $"You have {unreadMessagesSize} unread messages"
How do I move data files from one app to another
I have two apps where my "old" app are going to phase out and soon it will close down. My problem is that I have some historic data files placed where the app is installed and these data I need to move to my"new" app.
I guess that one solution is to first move all the data from the old app to an external location on the device and then - when starting up the new app - to move these files into the new app location. Problem is that it feels a bit clumsy that way. It would be nice if it's possible to just copy the data file directly from the old app to the new app some how e.g. when I start up the new app. Will that be possible .. otherwise what is the best way to handle this?
I need this for both Android and iOS :-)
Best Regards
Per
Forms + Shell + MVVM?
We've been developing our app for a 5years now using xamrin forms and MVVM (using FreshMVVM). We are thinking of moving to shell for new apps moving forward.
From https://nicksnettravels.builttoroam.com/mvvm-navigation/
"for commercial applications I would currently still be advocating the use of Prism or MvvmCross (rather than Shell)."
How seriously should I take this opinion?
Is there a good example to look at for Forms + Shell + MVVM?
Xamarin.forms PushNotificationPlugin, how to open a page passing data of the notification received?
So on my app.xaml.cs I have
CrossPushNotification.Current.OnNotificationReceived += (s, p) =>
{
//something like Navigation.PushAsync(new Page(Data from the notification));
}
How can I open 'Page' and give the data of the notification as an argoument?
Thanks to all.
Open Specific Page when click on Push Notification
Hi,
I am trying implement basic push notification example using Xamarin Forms with Prism MVVM, Azure & FCM.
I am receiving notification, but couldn't navigate to specific page when clicked on notification.
Trying basic functionality when app is running or in background (not closed).
It's throwing exception "PushAsync not supported globally on Android, please use a NavigationPage" at
ExploreXam.App.Current.MainPage.Navigation.PushAsync(page);
Here are MainActivity.cs and FireBaseMessagingService & App classes:
[Activity(LaunchMode = LaunchMode.SingleTask, MainLauncher = true]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
internal static readonly string CHANNEL_ID = "explore_xamarin";
internal static readonly int NOTIFICATION_ID = 1029;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
CreateNotificationChannel();
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
}
protected override void OnNewIntent(Intent intent)
{
base.OnNewIntent(intent);
Intent = intent;
NotificationClickedOn(intent);
}
private void NotificationClickedOn(Intent intent)
{
if (intent.Action == ExploreXamFirebaseMessagingService.ExploreXamNotification && intent.HasExtra("XamId"))
{
var page = new Xamarin.Forms.NavigationPage(new SpecificPage());
Xamarin.Forms.Application.Current.MainPage.Navigation.PushAsync(page);
ExploreXam.App.Current.MainPage.Navigation.PushAsync(page);
}
}
}
[Service]
[IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
public class ExploreXamFirebaseMessagingService : FirebaseMessagingService
{
private const string TAG = "ExploreXamFirebaseMsgService";
public const string ExploreXamNotification = "ExploreXamNotification";
public override void OnMessageReceived(RemoteMessage message)
{
SendNotification(message);
}
private void SendNotification(RemoteMessage message)
{
var intent = new Intent(this, typeof(MainActivity));
intent.AddFlags(ActivityFlags.SingleTop);
intent.AddFlags(ActivityFlags.NewTask);
intent.SetAction(ExploreXamNotification);
intent.PutExtra("XamId", message.Data["XamId"]);
var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot);
var defaultSoundUri = RingtoneManager.GetDefaultUri(RingtoneType.Notification);
var notficiationBuilder = new NotificationCompat.Builder(this, CHANNEL_ID)
.SetContentTitle(message.Data["title"] ?? "Explore Xam")
.SetSmallIcon(Resource.Drawable.Explore_Xam_Icon)
.SetContentText(message.Data["body"] ?? "You have a new message")
.SetAutoCancel(true)
.SetNumber(Int32.Parse(message.Data["badge"]))
.SetSound(defaultSoundUri)
.SetContentIntent(pendingIntent)
.SetSubText(message.Data["subtitle"] ?? "");
var notificationManager = NotificationManager.FromContext(this);
var localNotification = notficiationBuilder.Build();
localNotification.Defaults |= NotificationDefaults.Vibrate;
notificationManager.Notify(NOTIFICATION_ID, localNotification);
}
}
public partial class App : PrismApplication
{
public bool navigating;
public App(IPlatformInitializer initializer = null, bool shallNavigate=false) : base(initializer)
{
navigating = shallNavigate;
}
protected async override void OnInitialized()
{
BlobCache.ApplicationName = "ExploreXam";
InitializeComponent();
FlowListView.Init();
//await NavigationService.NavigateAsync("LoginPage");
await NavigationService.NavigateAsync("NavigationPage/LoginPage");
}
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
//mapping
}
}
Any help please....!
Tried ALL Xamarin BLE Demo Apps - None of them are working
It's the first time I register for a forum, because I couldn't find a solution somewhere in the internet.
I have an arduino and connected a bluetooth module. The module is a HM10 (i also have the HC08). This bluetooth module is for a bluetooth low energy (ble) connection.
Now I want to build an app for android and iOS which is able to communicate with the arduino over ble.
If I download the app "BLE Scanner" from the Play Store (guess it's written in java) I can connect to the arduino. So I have proof that my arduino setup works.
This is my concept:
1. Finding a working BLE Demo App
2. Looking in the source code and implement it in my own app.
Im searching in the internet for more than 3 months and couldn't find one single working BLE Demo app!!! Why? How in the world is this possible?
There are also many different Plugins for BLE, but none of them works. Can't someone delete this? It's just time wasting!
I tried ALL available Demo Apps in the internet for more than 3 months. Here are some links:
h-ttps://github.com/ricardoromo/BLEArduino/tree/master/BLEArduino
h-ttps://github.com/xabre/xamarin-bluetooth-le
h-ttps://github.com/aritchie/bluetoothle
h-ttps://github.com/xamarin/Monkey.BluetoothLE/tree/master/Sample%20Apps/BLE%20Explorer/BLEExplorer
h-ttps://github.com/nexussays/ble.net
very disappointed --> h-ttps://medium.com/@didourebai/integrate-and-use-the-ble-plugin-for-xamarin-edd6d8a1096d
h-ttps://acaliaro.wordpress.com/2017/02/07/connect-a-barcode-reader-to-a-xamarin-forms-app-via-bluetooth/comment-page-1/
h-ttps://greenfinch.ie/2016-07-06-bluetooth-le/
There were more links...so I'm pretty sure I don't need someone who's answer is just copying another link to a BLE demo app, because I tried them ALL!
Is there anybody who recently build a working Xamarin Forms BLE App? Or is this not possible anymore in Xamarin? I would be so so so thankful if there is someone who can send me his own source code to a real working BLE App.
Thanks in advance!
I'm new here so I couldn't post links, thats why I wrote h-ttps.
How do l ressolve System.Net.WebException Error .The Internet connection appears to be offline
The project l am building has some images on a file storage site and its consuming api's and it connected to the internet via my phone.After a lot of research l found out it has a bit to do with my using cellular network. l tried following this guide https://docs.microsoft.com/en-us/xamarin/cross-platform/macios/http-stack but it did not resolve my issue. Kindly Assist
Button click to navigate to existing page in SQLite database
I have an SQLite database in my app and want to navigate to a specific page by clicking the button (retrieving it from the database). I have GetPageAsync method in my database:
public Task<List<ArtistPageModel>> GetPageAsync(string keyword) { return database.Table<ArtistPageModel>().Where(i => i.Name == keyword).ToListAsync(); }
And ButtonClicked on page where it should be done:
private async void Button_Clicked(object sender, EventArgs e) { var keyword = "Text"; var page = await App.Database.GetPageAsync(keyword); await Navigation.PushAsync(page); }
I know this is wrong but I don't have any other solution because I'm just starting with it. Any help would be appreciated.
Is it possible to detect a long tap on a CollectionView item?
I started using the new CollectionView, but I can't figure out how to detect a long tap (and execute a command) on an item in the CollectionView.
So far I've been using the Syncfusion SfListView which comes with a HoldCommand, but i'd like to start using the CollectionView and I need to have that same feature.
Thanks in advance if someone can provide a simple example.
How to Change Shell Tabar Font to small letter.
Is it possible to use EventListener from Android through Interface in main App?
I tried to make it work modifying the official example (from docs.microsoft.com: the path: /en-us/xamarin/xamarin-forms/app-fundamentals/dependency-service/introduction), but seems like interface demands a value to return and the following doesn't work:
public interface IRetrieveDataService
{
RetrieveData();
}
The EventListner I'd like to use through Interface is described in this video from youtube.com: the path: /watch?v=OC-dy3YFLoo
Source code is in the video's description.
Sorry for paths, I can't post links yet
How can I get a list when I click on the button to navigate another page?
I am making a clone of Facebook (social network) that a publication has its list of comments
according to the id of the publication, I click on the button and get a list of comments on the publication.
Picker Title problem
Hey,
XF novice here.
How can I change Picker's Title property outside the window or above the default line (according to the Item selected)
but not so that it modifies the title within the popup window ?
To illustrate
I pick Satellite as an item
Which then gives me
after closing the pop-up window.
~~~~
I need a bindable subtitle of sort.
Rg.Plugins.Popup - Move animation not working
Hello,
I want to create a simple popup sliding from the bottom of the screen using Rg.Plugins.Popup. Here is my code for the popup page:
<?xml version="1.0" encoding="utf-8" ?>
<rgPages:PopupPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:rgPages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
xmlns:rgAnimations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
mc:Ignorable="d"
x:Class="App1.MyPopupPage">
<rgPages:PopupPage.Animation>
<rgAnimations:MoveAnimation PositionIn="Bottom" PositionOut="Bottom"
DurationIn="2400" DurationOut="2300"
/>
</rgPages:PopupPage.Animation>
<StackLayout Margin="12"
Padding="24"
BackgroundColor="White"
HorizontalOptions="Center"
VerticalOptions="Center">
<StackLayout>
<Label Text="Login" />
<Entry FontSize="30"
Text="username@email.com" />
</StackLayout>
<StackLayout>
<Label Text="Password" />
<Entry FontSize="30"
IsPassword="True"
Text="password123" />
</StackLayout>
<Button BackgroundColor="DodgerBlue"
FontSize="30"
Text="Login"
TextColor="White" />
</StackLayout>
</rgPages:PopupPage>
However, this is not working. Popup is just abruptly appearing in the center of the screen. It is not sliding from the bottom. Is it a bug in this plugin or maybe I am doing something wrong?
I am working on Android. I have uploaded the full project as an attachment.
I will be very glad for any help with this problem.
Return value from PushModalAsync
I have a few pages that I'd like to call like functions. As in, I'd like to show the page modally, then do something with a result.
Because awaiting PushModalAsync doesn't actually block until popped, i'm using messagecenter to subscript for the result. It seems kinda clunky. Is there a more elegant way to do this?
// what I think I have to do:
async Task TakePicture()
{
MessagingCenter.Subscribe<CameraPageViewModel, ImageSource>(this, "CameraImage", async (sender, imageSource) =>
{
ImageSource = imageSource;
});
await ViewModelNavigation.PushModalAsync(new CameraPageViewModel()); // This returns right away
}
// what I wish I could do:
async Task TakePicture()
{
var cameraPage = new CameraPageViewModel();
await ViewModelNavigation.PushModalAsync(cameraPage); // In my imagination, this blocks until Popped
ImageSource = cameraPage.Image;
}
PDF is not opened in iOS 13
I am using the following code to open the PDF file in Xamarin.Forms iOS platform. The below code is working fine before updating the Xcode version 11.2, after the update, the PDF document is not viewed, it shows the PDF name and format only in the viewer. Can you please anyone let me know why the PDF is not opened in iOS latest version (13.2).
public class PreviewControllerDS : QLPreviewControllerDataSource
{
private QLPreviewItem _item;
public PreviewControllerDS(QLPreviewItem item)
{
_item = item;
}
public override nint PreviewItemCount(QLPreviewController controller)
{
return 1;
}
public override IQLPreviewItem GetPreviewItem(QLPreviewController controller, nint index)
{
return _item;
}
}
public class QLPreviewItemBundle : QLPreviewItem
{
string _fileName, _filePath;
public QLPreviewItemBundle(string fileName, string filePath)
{
_fileName = fileName;
_filePath = filePath;
}
public override string ItemTitle
{
get
{
return _fileName;
}
}
public override NSUrl ItemUrl
{
get
{
var documents = NSBundle.MainBundle.BundlePath;
var lib = Path.Combine(documents, _filePath);
var url = NSUrl.FromFilename(lib);
return url;
}
}
}
Finally, write the PDF file to the file system and call it like below.
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
string filePath = Path.Combine(path, filename);
FileStream fileStream = File.Open(filePath, FileMode.Create);
stream.Position = 0;
stream.CopyTo(fileStream);
fileStream.Flush();
fileStream.Close();
QLPreviewController qlPreviewController = new QLPreviewController();
QLPreviewItem item = new QLPreviewItemBundle(filename, filePath);
qlPreviewController.DataSource = new PreviewControllerDS(item);
UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(qlPreviewController, true, null);
Getting error "Could not load the framework 'libsswiftCore.dylib'" not found.
I just updated Xcode to 11.2.1 and Xamarin forms to 4.3 latest. When I try to debug I get this error. error HE0003: Could not load the framework 'libswiftCore.dylib' (path: /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib): not found.
Moved: total value i want to in point plz help me i have tired
Slow graphic performance in a ContentPage when navigated through 3-4 views
I'm developing an application which has 6-7 pages. I noticed that when it has already been navigated between 2-3 pages, the performance is kinda awful on old devices.
Let's say I have this Navigation:
Page 1 -> Page 2 -> Page 3 -> Page 4
What I'm saying is that in that point, the performance of the Page 4 is bad (animations are not fluid, listview scroll is awful...). However, if I set the page 4 my first page (without having to navigate through the others), it is working as expected. I guess it is normal to lose some performance by the other way, but I don't know if I'm doing something wrong because it works too bad.
I'm using the prism navigation service, and I'm navigating by calling the NavigateAsync method with the name of the content pages, and setting the property to modal. My knowledge of the navigation in Xamarin Forms is basic (and even more with Prism) and I would like to know if I'm missing something.
I also noticed with the View Hierarchy, that when I navigate to the Page 4, there are all the other pages rendered too. Is this a normal behavior?
Thanks in advance.