-1
using Xamarin.Forms.Xaml;
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Essentials;


[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
[assembly: UsesPermission(Android.Manifest.Permission.Vibrate)]

It seems the last line of code is not working, however after reading this > https://learn.microsoft.com/en-us/xamarin/essentials/vibrate?tabs=android. It states that all I have to add is the last line to my AssemblyInfo.cs file. Not sure how to fix it. It states that im required to add the last line for any android device. However it seems that it does not recognize the UsesPermission. How can I fix this?

Here is the actual error:

Error CS0246 The type or namespace name 'UsesPermissionAttribute' could not be found (are you missing a using directive or an assembly reference?)

Lee Taylor
  • 7,761
  • 16
  • 33
  • 49

1 Answers1

0

You are missing reference to Android.App namespace - UsesPermissionAttribute is in there. Try adding using Android.App;.

defaultUsernameN
  • 365
  • 5
  • 14