Ionic Cordova InAppBrowser - android

I have an hybrid app built with:
Ionic 5.4.16
Cordova 10.0.0
AngularCLI 9.0.2
Android sdk 29
I open an URL using Cordova In App Browser https://ionicframework.com/docs/native/in-app-browser .
This URL is a chat page, and in this URL i need access to front and back cameras and microphone, but when I open it, the page doesn't have the access.
It seems it doesn't use the permissions declared in my config.xml, while the app it uses these permissions in its lifecycle.
In my "Android platform" section i declared:
<config-file mode="merge" parent="/*" target="AndroidManifest.xml" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
</config-file>
private iab: InAppBrowser
....
const ref = this.iab.create(url, '_blank', 'location=no,zoom=no');
Is there any other permission I need to declare?
Do you have any suggest?

Related

cordova-plugin-scanbot-sdk not working in android 31+

I can't get the cordova-plugin-scanbot-sdk plugin to work with release builds (it works if I build in debug mode), all my plugins are with the latest version, my cordova and cordova android are also up to date.
I can use the camera and filesystem in the app without any problems, but if I try to use the scanbot the app stays on this screen but doesn't ask the user for permission to use the camera. I also tried to add the camera permission manually in config.xml using:
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</edit-config>
but it didn't work.
Here is a screenshot of what I see when I try to open the plugin.

ionic 4: android permission not working after prod built

I am using #ionic-native/android-permissions.
My code in app.component.ts:
this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.RECORD_AUDIO).then(
(result)=>{
if(!result.hasPermission)
{
this.androidPermissions.requestPermissions(
[this.androidPermissions.PERMISSION.RECORD_AUDIO,
this.androidPermissions.PERMISSION.GET_ACCOUNTS]
).then(()=>{
// this.rootPage = HomePage;
window.location.reload();
});
}
});
It is working when I do :
ionic cordova run android
or
ionic cordova build android
or
ionic cordova build android --release
But the app is not asking for permission if I add --prod. i.e. :
ionic cordova run android --prod
or
ionic cordova build android --prod --release
So the device mic is not working for the app.
I had this issue, and i solved it by adding permissions to config.xml
then, popup will show and ask client for permissions.
add permissions to config.xml
<platform name="android">
....
<config-file parent="/manifest" target="AndroidManifest.xml" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-feature android:name="android.hardware.microphone" android:required="true" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
</config-file>
....
</platform>

WebRTC in Cordova app: WebContentsDelegate::CheckMediaAccessPermission: Not supported

I was using WebRTC in Cordova app with Cordova 5.2.0 and Cordova Android 4.1 without problems. Since I upgraded to Cordova 6.3.1 and Cordova Android 6.1.1, I get the following error message on the console:
chromium: [ERROR:web_contents_delegate.cc(199)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
The permissions in the Android manifest include the following:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="true" />
so I would say everything should be just fine. But still I am getting this error. I also noticed that once I actually try to start streaming my local video, I also get these error messages:
[ERROR:voe_audio_processing_impl.cc(685)] SetTypingDetectionStatus: not supported
[WARNING:webrtcvoiceengine.cc(882)] SetTypingDetectionStatus(0) failed, err=8003
[ERROR:audio_manager_android.cc(264)] Unable to select audio device!
[ERROR:web_contents_delegate.cc(199)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
and this info:
[INFO:CONSOLE(0)] "Refused to load the image 'android-webview-video-poster:default_video_poster/8430923907866893907' because it violates the following Content Security Policy directive: "default-src * gap: data: blob: 'unsafe-inline' 'unsafe-eval' ws: wss:". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.
Not sure if the CSP is related to the problem, though. I was trying to fix this, but Meteor (which I am using as a wrapper) won't let me do so.
To answer my own question: Since Android Marshmallow, permissions have to be set programmatically. The settings defined in the manifest are ignored.
I could solve my problem using this Cordova plugin:
https://github.com/NeoLSN/cordova-plugin-android-permissions

ACCESS_FINE_LOCATION permissions update with uses-feature in Ionic mobile application

I recently received a notification from Google asking to update the way we declare the use of native geolocation in-app.
In Ionic (v1), cordova-plugin-geolocation 2.3.0 "Geolocation" installed.
Line declared in AndroidManifest.xml :
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Google is telling us to use instead :
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
Is there any clean way to insert it into the AndroidManifest.xml ?
Should it be with a hook ?
Should I wait cordova-plugin-geolocation to update the plugin in order to satisfy Google recommandations ?
The cordova-plugin-geolocation plugin has now been updated so updating to version 2.4.0 should include this requirement.
You can specify android manifest properties from the config.xml file like this:
<platform name="android">
<config-file target="AndroidManifest.xml">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.location.gps" android:required="false">
</config-file>
</platform>
Also if you are getting the unbound prefix's error, put xmlns:android="http://schemas.android.com/apk/res/android" at the top of your config.xml file
For example:
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
xmlns:android = "http://schemas.android.com/apk/res/android"
id = "com.akis.android"
version = "0.1"

Add android.permission.CAMERA with Cordova

I am using the latest version of Cordova (6.3.1) and I want the following permission to appear in the AndroidManifest.xml :
<uses-permission android:name="android.permission.CAMERA" />
Adding this line by hand does not work because the XML is regenerated each time I run the command cordova run android
I have added the cordova-plugin-camera to my project with
cordova plugin add cordova-plugin-camera
This plugin does NOT add the CAMERA permission in the AndroidManifest.xml
I don't know if this is normal
How can I add this permission to my project ?
Edit :
Usually, Cordova plugins are in charge of adding required permissions into the manifest. The camera plugin does not add this specific permission, I wonder :
if the plugin should add this permission (bug ? I have opened an issue on their Jira tracker)
if I can add this permission by hand myself, maybe in the Cordova's config.xml
I don't think the Camera plugin ever added this permission to AndroidManifest.xml. Looking through the Github repo, WRITE_EXTERNAL_STORAGE was added in June 2013 (CB-3654), but I don't see anything for the camera itself. Not sure why that would be, but you can either add the permission to AndroidManifest.xml yourself or add a config-file directive in your project's config.xml file, for example:
<config-file target="AndroidManifest.xml" parent="/*" mode="merge">
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
</config-file>
Are you building native or hybrid app?
For native you can refer this website:
https://developer.android.com/reference/android/hardware/Camera.html

Categories

Resources