Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing Application.Current.Properties from native Android Xamarin

I have a Xamarin Forms app and I am adding an AppWidget to the native Android Xamarin project to give users a widget which they can pin on their home screen and use to interact. The Xamarin Forms app stores state in

 Application.Current.Properties["MyId"]

How can I access this from the native Android Xamarin code, since Application is in the Xamarin.Forms namespace?

like image 700
dumbledad Avatar asked Sep 12 '26 19:09

dumbledad


1 Answers

To access Application.Properties from projects native like Android or iOS. Please use the simple code snippet

var myId = Xamarin.Forms.Application.Current.Properties["Id"];
like image 115
R15 Avatar answered Sep 15 '26 05:09

R15



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!