I am creating an angular app, that will later be compiled on phonegap for android and ios. i have tried numerous plugins to integrate into facebook (mainly for login and sharing to facebook) on development - in the chrome browser while running on phonegap server, this works well.
I am able to click and share or have the pop up screen for permissions come up. however when i compile the the code and run it on a device it no longer works. i am suspecting this is because the the app does not have access to the device browser? or does not allow pop up in app? How can i resolve this problem? is cordova inapp the only way?
The updated cordova version doesn't allow the app to make any request outside the app. You need to follow the instructions in order to make it work.
Add the "Cordova Whitelist Plugin" in your config.xml
<gap:plugin name="cordova-plugin-whitelist" spec="1.1.0" />
Or simply
<plugin name="cordova-plugin-whitelist" spec="1.1.0" />
Try putting the following in your config.xml
<content src="index.html" />
is the path to your HTML file inside the source directory.
<access origin="*" />
will allow you to make a request anywhere from your app.
At the end, put the following intents
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
It will solve your problem. Give it a try and let me know!
Related
I'm developing an app which I need to include WebRTC using the WebView of Android. According to this article: [https://developer.chrome.com/multidevice/webview/overview] it is fully supported since WebView v36. (I'm testing on an Android 5.1.1 / Chrome 54 / Mobile Safari 537.36. And I confirm that it works on the standalone Chrome browser).
As of now, viewing of WebRTC works.
However, broadcasting (capturing video from the camera and sending it to the server) does not work. Note: it works on the standalone Chrome on the same Android.
I've included all these permissions in the codenameone_settings.properties file:
android.xpermissions=<uses-permission android:name="android.permission.CAMERA" android:required="true"/>\
<uses-permission android:name="android.permission.RECORD_AUDIO" android:required="true" />\
<uses-permission android:name="android.permission.INTERNET" android:required="true" />\
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:required="true" />\
<uses-permission android:name="android.permission.CAMERA" android:required="true" />\
<uses-feature android:name="android.hardware.audio.low_latency" android:required="true" />\
<uses-feature android:name="android.hardware.audio.pro" android:required="true" />\
<uses-feature android:name="android.hardware.microphone" android:required="true"/>\
<uses-feature android:name="android.hardware.camera" android:required="true" />\
<uses-feature android:name="android.hardware.camera.autofocus" android:required="true"/>\
<uses-feature android:name="android.hardware.camera" android:required="true" />\
<uses-feature android:name="android.hardware.camera.front" android:required="true" />
Is this the way to activate all the necessary Android permissions.
What do you think is causing the WebRTC not to function properly?
The WebView is called by the BrowserComponent class.
I understand that Android code is translated to native code and I believe that there is a way to make it work. Thanks!
I just took a look at a couple of examples (here and here, and it looks like the webview needs to grant some permissions in order to allow webrtc to work.
I have made a small change to our Android port that should allow you to grant these permissions. You just need to specify the origin in which permissions should be allowed. You would do this by setting the "android.WebView.grantPermissionsFrom" display property to the URL (or space delimited URLs) that you want to grant the permissions on.
e.g.
Display.getInstance().setProperty(
"android.WebView.grantPermissionsFrom",
"https://www.example.com/"
);
Call this in your app's init() or start() method.
NOTE These changes won't be available until the next server update. I'm not sure exactly when that will be since the bootcamp is underway right now. Usually it is every Friday, but it may be delayed until the first week of May due to the bootcamp.
we've got an issue while trying to reach our back-end server from a Windows-10 cordova app with XHR (AngularJS $http call).
The back-end server is available (test with a RESTclient plugin in a browser).
The application is installed on a windows-10 desktop pc with VisualStudio 2015 enables (to view logs).
Here's the error in log (sorry in french):
SCRIPT7002: XMLHttpRequest: Erreur réseau 0x2efd, Impossible d’effectuer l’opération à cause de l’erreur suivante 00002efd.
We added the following meta-tag in our index.html file (we also tried the wildcard *):
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: http://10.148.118.68/* gap: http://10.148.118.68/* 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
And here's the config.xml settings:
<access origin="*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
For information, we've built and deployed successfully the application on an Android Device and the app reached the back-end.
Thanks for any help.
we've got an issue while trying to reach our back-end server from a Windows-10 cordova app with XHR (AngularJS $http call).
This is by design as extensions don’t support loopback. Please refer to Edge Extension cannot request to localnets.
default project settings in config.xml created with cordova CLI doesn't include capabilities for PrivateNetwork XHR.
We have to add it "manually":
<Capabilities>
<Capability Name="privateNetworkClientServer" />
</Capabilities>
I have an app using cordova and angularjs. Some features on the app require access to the Google Maps API and Yahoo Weather API.
When I compile to Android and iOS platforms everything works fine, but not on windows platform (windows phone 8.1). I get these errors on both calls (google and yahoo):
"**APPHOST9601** An app can't load remote web content in the local context".
I think I have the cordova-plugin-whitelist correctly configured with the proper intent, navigation and network tags on config.xml (I also have the meta tag on index.html).
Strangely if I add wp8 cordova platform and run it, I have no errors. Only on the windows platform running the windows phone 8.1 project inside the solution.
This is what I have in the config.XML
<!--Controls which URLs the WebView itself can be navigated to. Applies to top-level navigations only.-->
<allow-navigation href="*" />
<!-- Controls which URLs the app is allowed to ask the system to open. By default, no external URLs are allowed. -->
<allow-intent href="comgooglemaps:*" />
<allow-intent href="sms:*" />
<allow-intent href="tel:*" />
<allow-intent href="geo:*" />
<allow-intent href="*" />
<!-- Controls which network requests (images, XHRs, etc) are allowed to be made (via cordova native hooks). -->
<access origin="https://tel:*" launch-external="yes" />
<access origin="https://mailto:*" launch-external="yes" />
<access origin="https://geo:*" launch-external="yes" />
<access origin="https://comgooglemaps:*" launch-external="yes" />
<access origin="https://*" />
<access origin="http://maps.google.com/*" />
<access origin="content:///*" />
<access origin="*"/> and I also have this in the HTML page <!-- Enable all requests, inline styles, and eval() -->
And in the HTML I have the following metadata
<meta http-equiv="Content-Security-Policy" content="default-src *; media-src *; style-src 'self' * 'unsafe-inline' * 'unsafe-eval' *; script-src 'self' * 'unsafe-inline' * 'unsafe-eval' *" />
I'm developing a Windows Phone 8.1 app using WinJs 2.1 and AngularJS 1.4. It worked fine until I needed to add either Google or Bing maps. I tried the following example but I got the following error.
Network request to https://maps.googleapis.com/maps/api/js?sensor=false&libraries=visualization did not succeed.
Your application manifest does not declare the following capabilities: internetClient privateNetworkClientServer
http://www.creepyed.com/2012/11/how-to-use-the-google-maps-api-on-windows-8/
Does anyone gone through the same issue or used something I missed to get this done?
I have added the following lines in my manifest
<ApplicationContentUriRules>
<Rule Type="include" Match="https://maps.googleapis.com/maps/api/js*" />
<Rule Type="include" Match="https://www.google.com/" />
<Rule Type="include" Match="https://earthquake.usgs.gov/" />
<Rule Type="include" Match="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx"/>
</ApplicationContentUriRules>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClientServer" />
<Capability Name="internetClient" />
<Capability Name="privateNetworkClientServer" />
<DeviceCapability Name="location" />
</Capabilities>
Thanks!
This is driving me nuts.
I have two versions of my app, a barebones version and an advanced version. I messed up some modules/plugins in the advanced version so I rebuilt it from scratch in a new directory. Copied all the necessary www/js/img folders to the newly created one.
I verified i have installed all the same plugins, modules and packages - I then am able to build the app successfully and run it successfully. However, any reference to external scripts or files are getting a "404 (Not Found)" error on the console logs. The barebones app can still pull in the google maps script and I have compared the two config.xml files and can't see anything that would cause an issue.
One is in the index.html:
And the other are jpg images loaded from the IONIC website - part of their standard tabs template.
The errors I am getting:
Failed to load resource: the server responded with a status of 404 (Not Found) http://maps.google.com/maps/api/js?sensor=false&
and
GET https://pbs.twimg.com/profile_images/514549811765211136/9SgAuHeY.png 404 (Not Found) ionic.bundle.js:11568
...and 5 more img png/jpg errors similar to this one.
For the life of me I cant' figure out why the newly rebuilt app isn't allowed to pull in external files or scripts. Any and all help is appreciated.
In my config.xml file I have the following defined:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.testapp765534"
version="0.0.1" xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<name>TestApp</name>
<description>
A test mapping app.
</description>
<author href="http://testapp.org/" email="info#testapp.org">
testapp DEV TEAM
</author>
<access origin="*" />
<access origin="http://*.google.com" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<content src="index.html"/>
<platform name="android">
<allow-intent href="market:*" />
</platform>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="BackupWebStorage" value="none"/>
<feature name="StatusBar">
<param onload="true" name="ios-package" value="CDVStatusBar"/>
</feature>
</widget>
For the record I also have the following plugins installed:
android.support.v4 21.0.1 "Android Support v4"
com.google.playservices 23.0.0 "Google Play Services for Android"
com.ionic.keyboard 1.0.4 "Keyboard"
cordova-plugin-device 1.0.0 "Device"
net.orworks.cordovaplugins.cordovasqlite 1.5.0 "CordovaSQLite"
org.apache.cordova.console 0.2.13 "Console"
org.apache.cordova.device-motion 0.2.11 "Device Motion"
org.apache.cordova.device-orientation 0.3.11 "Device Orientation"
org.apache.cordova.dialogs 0.3.0 "Notification"
org.apache.cordova.geolocation 0.3.12 "Geolocation"
org.apache.cordova.globalization 0.3.4 "Globalization"
org.apache.cordova.splashscreen 1.0.0 "Splashscreen"
org.apache.cordova.statusbar 0.1.10 "StatusBar"
org.apache.cordova.vibration 0.3.13 "Vibration"
Install https://github.com/apache/cordova-plugin-whitelist this plugin then it works.