I just use wifiwizard to enable WLAN in ionic app.
I have give the app all the permission in the system settings.
Android 5.0 can work without the Pop-ups, but 7.0 always need confirm.
Android 5.0 is based on the older install time permission model, while android 7.0 has run time permission system. This means that on Android 7.0 the permissions to apps are not granted at install time, but rather are requested on the fly during the time when the resource is required to be used.
Read more about it here : Android runtime permission system.
Related
What I'd like to accomplish:
If the user's location service is preventing me from getting his/her phone's location by default I'd like to ask for location permission on every API between 16-25 (Android 4.1.2-7.1.1)
Since on iOS I haven't met this problem I'd like to focus on android.
What I've already tried:
<uses-permission android:name="android.premission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.premission.ACCESS_FINE_LOCATION" />
cordova-plugin-android-premissions
The plugin mentioned above always returns with hasPermission: true even if the access to location is denied on the device so it's not working for me.
What I haven't tried yet:
cordova-diagnostic-plugin
Diagnostic plugin description says that I have choose between API 23 and above or API 22 and below in my understanding. (<preference name="android-targetSdkVersion" value="22"/> is the minimum target version.) Yet I don't know if it would still work on lower API versions.
My setup:
Cordova CLI: 6.2.0
Gulp CLI & local: 3.9.1
Ionic Framework: 1.3.1
Ionic CLI: 1.7.16
Node: 4.2.2
Device android: 5.0.1
Desired build target: 16
Current build target: 22
Diagnostic plugin description says that I have choose between API 23 and above or API 22 and below in my understanding. ( is the minimum target version.) Yet I don't know if it would still work on lower API versions.
cordova-diagnostic-plugin API level requirements are based around the SDK version being used to build, not the API version running on the target device.
So an app built with SDK for API 23 (Android 6.0) will still work on devices running older versions of Android.
You need to set your build target to API 23 (or above) to build with the primary version of the plugin (cordova.plugins.diagnostic as opposed to cordova.plugins.diagnostic.api-22) because it includes the run-time permissions code which requires a build environment of API 23+.
If the user's location service is preventing me from getting his/her phone's location by default I'd like to ask for location permission on every API between 16-25 (Android 4.1.2-7.1.1)
There's two different aspects to this:
ask for location permission on every API between 16-25 (Android 4.1.2-7.1.1)
Android run-time permissions were introduced in API 23 (Android 6.0)
You can check if the app has location authorization using isLocationAuthorized().
Calling it on a device running Android 5 (API 22) or below will always return TRUE as the permissions are already granted at installation time.
You can request runtime permission to use location with requestLocationAuthorization().
Calling it on a device running Android 5 (API 22) or below will have no effect as the permissions are already granted at installation time.
location service is preventing me from getting his/her phone's location
You can check if user has switched off location using isLocationEnabled().
If location is switched off, you can use switchToLocationSettings() to open the device location settings page to allow user to enable location services, or you can use the cordova-plugin-request-location-accuracy to request the desired location accuracy without needing the user to manually do this on the location settings page.
Disclaimer: I am the author of cordova-diagnostic-plugin and cordova-plugin-request-location-accuracy.
I updated xamarin android and now compile app using version 7.0(Nougat). But when I deploy app on 6.0.1(marshmallow), all permissions are already set. When I turn off location permission from settings, alert displays "this app was designed for an older version of android. denying permission may cause it to no longer function as intended". Then if we deny permission and method Context.CheckSelfPermission in the app return Permission.Granted anyway.
Is this xamarin issue or something change in SelfPermission behaviour?
Application.Context.CheckSelfPermission(Manifest.Permission.AccessCoarseLocation) == Permission.Granted//returns true, even if permission is off
Application.Context.CheckSelfPermission(Manifest.Permission.AccessFineLocation) == Permission.Granted//returns true, even if permission is off
My solution was to set the target SDK to 23 in the manifest. This way, it tells the device that you have tested for this API level, therefore the AppCompat method CheckSelfPermission will work.
I had a similar problem. What seems to have resolved my issue was changing the Project options in Xamarin. In the Android Application tab of the project options, I had "Automatic - use target framework version (API 24)" selected for Target Android version, when I changed it to "Override - Android 7.0 (API 24)" it seems to have resolved the issue.
Apparently you need to set and explicit targetSdkVersion, Automatic seems to result in < 23 behavior.
I have updated my device few days ago. Its an lollipop upgrade, but still it started asking permissions for my app at run time.
I have targetSDK 21
But when I open app it pops up for gps permission and if user denied it, it stops working.
I also used checkSelfPermission but it is retuning Granted(0) every time even user denied it.
My current android version of Phone is android 5.1.1
Device having android 5.1.1 but its OS is customised by MI like samsung phones. So after upgrade it started asking permission for resource like GPS, Contact and other. Its android sdk version is android 5.1.1 not Android 6.0 which have Runtime Permissions.
You require to implement runtime permission check for Android-21 plus device. Check the solution over here. You will find how array has been utilized in that, mostly that is were user stucks.
Additionally, if denied then you cannot force user to use that functionality. In short you need to bypass that module.
Lollipop have no runtime permission mechanism.
Runtime Premission came up with Android M.
change the sdk version under gradlebuild minSdkVersion 20 check from here https://developer.android.com/about/versions/android-5.0.html
Is there any way to get around the new Android 6.0 Permissions system if you need to build your App for Android 6.0 and use it on a 6.0 Device?
I ask because there are so many Apps in the App Store which are not asking for any permissions and that's kinda weird. For me that means there are two possibilities.
They all are not compiling their apps for android 6.0
They are somehow getting around the new permissions system using android 6.0
So is there a way around?
Change your targetSDK to 22 will work on all device without permissions runtime, If your targetSDK is 23 than you have to set permission you can't overcome this.
I have built an app with android sdk version 22 and now I want to upgrade it with sdk 23. I know that from Android 6.0 onwards user would have to allow or deny dangerous permissions at runtime. But in my case when I compiled my app with sdk 23 and run it on a Android Android 6.0 device(I tried with two devices) I can see the app is not crashing and all the dangerous permissions which are enlisted in Manifest are given by default. Can someone please help me finding out why this is happening?
Have you changed TargetSDK to 23?
Android checks the target sdk and loads apis of that target. Here even though you are compiling it to 23, android thinks that Marshmallow apis are not used and hence defaults to previous API. So run time permissions are not checked.