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

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

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.

Fatal Exception: java.lang.SecurityException: Missing permission to insert badges

I am new in Android development, I am facing below exception on some of the device after publishing it on play store. It is completly unknown exception for me. This exception force stop/crash my application.
Complete stacktrace logged:
Exception java.lang.SecurityException: Missing permission to insert badges
android.os.Parcel.readException (Parcel.java:1553)
android.database.DatabaseUtils.readExceptionFromParcel (DatabaseUtils.java:185)
android.database.DatabaseUtils.readExceptionFromParcel (DatabaseUtils.java:137)
android.content.ContentProviderProxy.insert (ContentProviderProxy.java:476)
android.content.ContentResolver.insert (ContentResolver.java:1213)
android.content.AsyncQueryHandler$WorkerHandler.handleMessage (AsyncQueryHandler.java:96)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:211)
android.os.HandlerThread.run (HandlerThread.java:61)
As mentioned above exception dose not contains any part of code that relate to my application, and also I am not found any satisfactory solution for above issue.
EDIT:
I am using an external library(SDK) for push notification, after adding that my App start showing 11 new permission on play store 'Required permission' section when I am going to update my app
Some of those permissions are:
com.htc.launcher.permission.READ_SETTINGS
com.htc.launcher.permission.UPDATE_SHORTCUT
com.huawei.android.launcher.permission.CHANGE_BADGE
com.huawei.android.launcher.permission.READ_SETTINGS
com.huawei.launcher.permission.WRITE_SETTINGS
com.sec.android.provider.badge.permission.READ
com.sec.android.provider.badge.permission.WRITE
com.sonyericsson.home.permission.BROADCAST_BADGE
com.sonymobile.home.permission.PROVIDE_INSERT_BADGE
I am not added these permission in my own manifest file, So that I modified my 'AndroidManifest' file by adding following line of code into application tag:
<application
<--some code-->
tools:replace="android:icon, android:allowBackup"
>
and use a .jar file of SDK instead of compile it like
compile 'com.abc.xyz:3.+#aar' //suggested for android studio in (build.gradle)
After applying above process those permission are removed and I upload my Application.
Only These thing I have performed into my new version of app. I also looked that library project recentally and it contains a folder 'shortcutbadger' that contains some sub-folder and .class file internally
Is due to above changes I am start receiving that exception ? please explain/help!
As you said, you can change a gradle dependency with a Jar of the same SDK. But when using Jar, you should make sure all the permissions are added appropriately in manifest in order to make the SDK work properly.
The OneSignal SDK which you have used recommends gradle dependency for Android Studio & Jar file with additional permissions in Manifest for Eclipse. Since you replaced gradle with Jar in Studio, make sure you have the following permissions added to manifest file.
<permission android:name="${manifestApplicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="${manifestApplicationId}.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!-- START: ShortcutBadger -->
<!-- Samsung -->
<uses-permission android:name="com.sec.android.provider.badge.permission.READ"/>
<uses-permission android:name="com.sec.android.provider.badge.permission.WRITE"/>
<!-- HTC -->
<uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS"/>
<uses-permission android:name="com.htc.launcher.permission.UPDATE_SHORTCUT"/>
<!-- Sony -->
<uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE"/>
<uses-permission android:name="com.sonymobile.home.permission.PROVIDER_INSERT_BADGE"/>
<!-- Apex -->
<uses-permission android:name="com.anddoes.launcher.permission.UPDATE_COUNT"/>
<!-- Solid -->
<uses-permission android:name="com.majeur.launcher.permission.UPDATE_BADGE"/>
<!-- Huawei -->
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" />
<uses-permission android:name="com.huawei.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" />
<!-- End: ShortcutBadger -->
Are the devices Samsung? Samsung and some other brands have launchers where you can add badges to app icons, perhaps your code or code from a library is trying to use it?
You need to add the correct permission for it to your App Manifest.
<uses-permission android:name="com.sec.android.provider.badge.permission.READ" />
<uses-permission android:name="com.sec.android.provider.badge.permission.WRITE" />
If you are using "ShortcutBadger" Android Library then you need to follow this instruction
API >= 23 now require special permission. Try to make it through onRequestPermissionsResult
also check this url

Enable permission to get WiFi details - Android marshmallow

I am using wifiwizard, a cordova plugin to get the available wifi networks in ionic framework. It works fine for all the android os except marshmallow. In marshmallow, I need to enable the location to get the same. How to resolve this issue?
Things tried:
Provided permissions in the wifiwizard-> plugin.xml.
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
Could anybody help?
Thanks in advance.
You need to update your plugins if you are using old plugins.
https://cordova.apache.org/announcements/2015/11/09/cordova-android-5.0.0.html
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

cordova build android AndroidManifest.xml bad lines

I'm extending an ios app to the android platform - I'm unfamiliar with the android tools but following the tuts.
I have added the platform but when I run the 'cordova build android' I get errors on the AndroidManifest.xml
When I trace this it seems that lines are being added in the uses-permission section (see the last 3) that have no android namespace
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission name="android.permission.READ_PHONE_STATE" />
if I add the namespace and rebuild, the error becomes one of duplication. If I delete the offending lines, then the rebuild just re-writes them.
The ios version of my app works perfecto, so I'm assuming its something to do with how the plugins write to this file on android build.
Before I start to debug by unpicking the plugins, has anyone else been here before and resolved it, and are hungry for upvotes?
I am afraid you need to setup the issue manually as that is not resolved yet, its still alive.
You have to open your plugins/android.json and remove the duplicate keys in there. In your case search for WRITE_EXTERNAL_STORAGE, MODIFY_AUDIO_SETTINGS, READ_PHONE_STATE in android.json and remove the duplicates.
Then open up platforms/android/AndroidManifest.xml and remove the duplicate <uses-permission... /> tags. And then rebuild and try again.

application requires feature(s) not available on your device

I have an Android application on Android Market, but some users are complaining about an error shown when the installation starts, just after the download:
One of them sent me a video of this error showing up, and I could see that this error is not caused by the application, but probably in the verification of permission/features process.
As far as I know, this error is just happening on Motorola Droid/Milestone devices running Eclair, it doesn't happen with Froyo. Unfortunately, I don't have access to any device like this one in order to run logcat and check what's going on.
Here are my permission/features on AndroidManifest.xml:
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.location" />
<uses-feature android:name="android.hardware.telephony" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
I finally found out what's happening by getting a Droid device and running logcat:
E/PackageManager( 1280): Package com.mycompany.myapp requires unavailable feature android.hardware.telephony; failing!
Motorola Droid devices running Eclair are not able to install applications that declare
<uses-feature android:name="android.hardware.telephony" />
in their manifest. It's very strange, though, because the Android Market should hide it from these devices. This is probably a bug caused by the changes made to the Eclair by Motorola, since it doesn't happen with other devices running Eclair, neither with the same Droid running Froyo.
According to the docs:
Android Market attempts to discover an application's implied feature
requirements by examining other elements declared in the manifest
file, specifically, <uses-permission> elements.
Given that, have you tried removing the uses-feature tags? Since those are implied by the uses-permissions tags, and you aren't using the "android:required" attribute.
The device say " this feature is not available in this device " when I'm installing an app downloaded from play store and i have to give it permission

Categories

Resources