Comments (5)
Did you do this: https://github.com/jamesmontemagno/PermissionsPlugin#android-specific-in-your-baseactivity-or-mainactivity-for-xamarinforms-add-this-code
When you install this plugin it will also install a file called "MainApplication.cs" into your Android app and that needs to be there.
from permissionsplugin.
When I check in the code permissionStatus.Unknown is returned in the below scenario. Do I need to do anything in my application for this ? Debug.WriteLine("Unable to detect current Activity or App Context. Please ensure Plugin.CurrentActivity is installed in your Android project and your Application class is registering with Application.IActivityLifecycleCallbacks.")
from permissionsplugin.
It is now working. Application.cs class is missing from my project. Thankyou James for the reply
from permissionsplugin.
I had the exact same problem(status=unknown). but no application.cs was added nor a mainapplication.cs when i updated the Mediaplugin and installed PermissionsPlugin.
Being 'creative' i added two things mentione on the documentation on the link you provided to MainActivity.cs (it's an another developer's xamarin app ia am implementing the android version) Speicifically i added
1)
PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
on the OnRequestPermissionsResult (maybe i need to mention that there also exists a Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
on the same method)
and 2)
Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, savedInstanceState);
on the protected override void OnCreate(Bundle savedInstanceState) method.
Now the status=unkwown no longer waits but the code still has problems.namely the
await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions { CompressionQuality = 92 }); does not execute.no error , no nulls just that the debugger skips lines :(
Did I do the correct corrections?Do you have any idea why the takephotasync command is skipped?
(permissions were requested,camera opens when stepping in, but after that something is not working as it is supposed to work)
Thnx in advance,
from permissionsplugin.
Thanks @savvaskef
Helped me in solving the issue
from permissionsplugin.
Related Issues (20)
- RequestPermissionsAsync returns Denied directly if users denied the first time HOT 2
- Update samples to Generics HOT 1
- RequestPermissionsAsync hanging possibly with XPC Connection Error HOT 3
- Updated Plugin.Permissions implementation for current versions of android. HOT 1
- Bug : Camera and Microphone permissions are unknown. HOT 1
- Xamarin Forms project, Droid, app not asking for permissions HOT 1
- RequestPermission always returns Granted
- Android ACCESS_MEDIA_LOCATION Permission not handled by the plugin HOT 5
- Permission plugin version 6.0.1 crashes the app HOT 2
- Scoped storage permission on Xamarin Android 10+? HOT 3
- Error XA2006 TargetFrameworkVersion Android 10 HOT 1
- RequestPermissionAsync<LocationPermission>() hangs with Xcode 12/iOS 14 HOT 4
- [BUG] RequestPermissionAsync<>() in XCode12/IOS14 not returning any value. HOT 6
- Accessing Censor text to replace with -- instead of ** HOT 1
- RequestPermissionAsync on Application Load throws null ref HOT 4
- RequestPermissionAsync HOT 1
- await CrossPermissions.Current.RequestPermissionAsync<LocationPermission>() HOT 2
- Android ACCESS_MEDIA_LOCATION Permission not handled by Xamarin.Essentials HOT 1
- how Request accessibility Permission and Floating window Permission ?
- Path to Maui? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from permissionsplugin.