Nativescript webview set permission for mediaDevices.getUserMedia - webview

I am using Nativescript webview to run my web-app. But have problem when trying to do:
navigator.mediaDevices.getUserMedia({
audio: true,
video: false
}).then(function (stream) {
Anybody know how to set permission for WEBRTC related functions?
Thanks a lot!
Note:
it's for android and I have search for few hours but it seems no complete explanation about requesting permission, unlike for android studio (like this one: https://developer.android.com/reference/android/webkit/WebSettings).
the web-app is running well under google chrome.

Finally it works, but I am using standard java (android studio without the IDE), the most important parts are:
use webchromeclient.
set permission: android.webkit.resource.AUDIO_CAPTURE.
manifest:
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.MICROPHONE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature android:name="android.hardware.audio.low_latency" />
<uses-feature android:name="android.hardware.audio.pro" />
<uses-feature android:name="android.hardware.microphone" android:required="true"/>

Related

How to integrate Zoom Meeting SDK in MAUI Android and Windows

I am trying to integrate Zoom SDK in MAUI for both Android and Windows
I am using Xamarin tutorials to integrate for Android as I didn't found any code reference for MAUI.
I tried but it is not working and my App is crashing after Join Metting and giving the error:
[ame.zoomsdkpro] java_vm_ext.cc:579] JNI DETECTED ERROR IN APPLICATION: JNI CallIntMethodV called with pending exception java.lang.SecurityException: getCallState: Neither user 10154 nor current process has android.permission.READ_PHONE_STATE.
My Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:icon="#mipmap/appicon" android:roundIcon="#mipmap/appicon_round" android:supportsRtl="true"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.Manifest.permission.READ_PHONE_STATE" />
</manifest>
The android.permission.READ_PHONE_STATE is a dangerous permission. You need to not only declare it in the Manifest file, but also request it in the run time.
So you can use the following code to request the permission on the android:
# if ANDROID
var status = await Permissions.RequestAsync<Permissions.Phone>();
# endif
For more information,you can check the official document about the permissions.

Xamarin: Java.IO.IOException Message=Cleartext HTTP traffic to myapi.azurewebsites.net not permitted

I recently upgraded to the latest version of Xamarin 4.5.0.356. This forced me to change my Android build version to 9.0.
Since then, whenever I call my test Api I get:
Java.IO.IOException Message=Cleartext HTTP traffic to myapi.azurewebsites.net not permitted
I realise that API's should all be httpS but this is a test one (owned by me).
I searched the web (stack overflow) and it was suggested that I add the following to AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<application android:networkSecurityConfig="#xml/network_security_config" />
</manifest>
and then add a Resources/xml/network_security_config.xml file containing the following:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">myapi.azurewebsites.net</domain>
</domain-config>
</network-security-config>
However, I still get the error on the first call to the API. (iOS version works fine)
Anyone have any ideas?
Try add a base-config in your network_security_config.xml:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">myapi.azurewebsites.net</domain>
</domain-config>
</network-security-config>

background geolocation mauron85 app crashes after installing apk

I had the same issue referred on this link. So to resolve the issue i did what klaus-donnert did,and also went here to download the latest plugin.... below is my xml file:
<preference name="phonegap-version" value="cli-6.4.0" />
<plugin name="cordova-plugin-mauron85-background-geolocation" spec="^2.2.5">
<variable name="ALWAYS_USAGE_DESCRIPTION" value="This app requires background tracking enabled to calculate the distance between you and Ecocompub partners" />
</plugin>
Next step was to test the app on my android, so after uploading the zip on phonegap.build, i read the qr code as usual, and .... the app crashed! it opens for a few seconds, but then closes...if i simply don´t use the plugin, the app runs well...does anybody experienced this problem?, i´m completely stuck.
Regards
So to help others that might have the same situation, the problem is NOT with the background mauron85 plugin, it was with my phonegap-plugin-push which was outdated since i was using cli-6.4.0...so if you want to use both plugins, you have to have on your xml file the following:
for background geolocation mauron85 plugin:
<preference name="phonegap-version" value="cli-6.4.0" />
<plugin name="cordova-plugin-mauron85-background-geolocation" spec="^2.2.5">
<variable name="ALWAYS_USAGE_DESCRIPTION" value="set this value, otherwise apple will refuse your app" />
</plugin>
for push-plugin from here:
<plugin name="phonegap-plugin-push" spec="1.8.4" source="npm">
Regards.

RTCMultiConnection Demos cordva for IOS

We integrated RTCMultiConnection Demos cordva code in iOS app and also add iOS native code into it.
need to confirm one thing that how it will be linked with our web code i.e if i will call from my IOS app then how it will get connected within my website . Please confirm if possible and how.
Thanks in Advance plus Happy New Year
Your cordova app sets socketURL:
connection.socketURL = 'https://domain.com:9001/';
Your cordova app has a file named as loadRTCMultiConnection.js. This file MUST be using same RTCMultiConnection distribution as the your web page.
Conclusion:
Your cordova app MUST set socketURL parameter
Your cordova app MUST be using same RTCMultiConnection.js
Explanation:
socketURL is used to access your socket.io server. Both cordova app and web-browsers are using same socket.io server.
Updated at Jan 03, 2017
To use Firebase in the RTCMultiConnection-cordova-apps:
Open index.html and replace socket.io.js with Firebase.js
Add this script in the same index.html file: <script src="js/globals.js"></script>
Add this script in the same HTML file: <script src="js/FirebaseConnection.js"></script>
Opne index.js and add this line: connection.setCustomSocketHandler(FirebaseConnection);
As well as this line: connection.firebase = 'webrtc-experiment';
To recap it:
<!-- index.html file -->
<script src="js/Firebase.js"></script>
<script src="js/globals.js"></script>
<script src="js/FirebaseConnection.js"></script>
and:
// index.js
var connection = new RTCMultiConnection();
connection.setCustomSocketHandler(FirebaseConnection);
connection.firebase = 'webrtc-experiment';
PS. You may need to modify config.xml to enable websocket or XHR_polling requests from firebase.com. Simply replace rtcmulticonnection.herokuapp.com with firebase.com. E.g.
<?xml version='1.0' encoding='utf-8'?>
<widget>
<platform name="android">
<allow-navigation href="https://firebase.com/*" />
<allow-intent href="https://firebase.com/*" />
<access origin="https://firebase.com" />
</platform>
</widget>

ionic $cordovaGeolocation always requests permission for location access

I am running ionic and the ngCordova geolocation wrapper.
Here is a snippet from a controller using the plugin:
$ionicPlatform.ready(function () {
$cordovaGeolocation
.getCurrentPosition({timeout: 10000, enableHighAccuracy: false})
.then(permissionGranted)
.catch(permissionNotGranted)
.then(loadGmap)
.catch(handleGmapLoadError);
});
I run my app using:
ionic run ios --device
As the app comes up, I am asked permission to access the location of the phone as expected. I acknowledge it and my controller loads my location in google maps. I see the permission set in my ios settings reflect the setting made. when I open the app the second time, it asks again. This was unexpected behavior.
Most apps don't ask again and again. Has any one else seen this behavior and know what I should do?
you can try to add the permission in the config file (app/platforms/android/res/xml/config.xml)
<feature name="Geolocation">
<param name="android-package" value="org.apache.cordova.GeoBroker" />
</feature>
and in the(app/platforms/android/AndroidManifest.xml)
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />

Resources