javascript - Dropbox-sdk not loading on cordova app? -
i'm trying make app using cordova make calls dropbox api via official dropbox-sdk-min.js.
when run app on web browser, including android web browser, working , when try on phonegap app or compiled apk via phonegap, seems dropbox js not being loading or crashing @ point, can't access browser log in app.
this js
var dbx = new dropbox({ accesstoken: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' }); dbx.fileslistfolder({path: ''}) .then(function(response) { var entries = response.entries; alert(entries) $$.each(entries,function(v,i){ var cards=myapp.virtuallist($$("#vlcatalogo"),{ items:entries, template: strvar }); }) }) .catch(function(error) { console.log(error); });
this index.html
<!doctype html> <html> <head> <!-- customize policy fit own app's needs. more guidance, see: https://github.com/apache/cordova-plugin-whitelist/blob/master/readme.md#content-security-policy notes: * gap: required on ios (when using uiwebview) , needed js->native communication * https://ssl.gstatic.com required on android , needed talkback function * disables use of inline scripts in order mitigate risk of xss vulnerabilities. change this: * enable inline js: add 'unsafe-inline' default-src --> <!-- <meta http-equiv="content-security-policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *"> <meta http-equiv="content-security-policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *;**script-src 'self' http://onlineerp.solution.quebec 'unsafe-inline' 'unsafe-eval';** "> --> <!-- required meta tags--> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui"> <meta name="theme-color" content="#880e4f"> <meta name="mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta http-equiv="content-security-policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"/> <!-- app title --> <title>my app</title> <!-- template defaults ios css theme. support both ios , material design themes, see framework7 tutorial @ link below: http://www.idangero.us/framework7/tutorials/maintain-both-ios-and-material-themes-in-single-app.html --> <!-- path framework7 library css, material theme --> <link rel="stylesheet" href="lib/framework7/css/framework7.ios.min.css"> <!-- path framework7 color related styles, material theme --> <link rel="stylesheet" href="lib/framework7/css/framework7.ios.colors.min.css""> <link rel="stylesheet" href="css/styles.css"> <style> .demo-card-header-pic .card-header { height: 40vw; background-size: cover; background-position: center; } .app-head { background-image: url(resources/logololitaslauncher.png); padding-left: 12vw; background-repeat: no-repeat; background-size: 10vw; } /* default status bar background */ .statusbar-overlay { background: pink; /* can add transition smooth color animation */ -webkit-transition: 400ms; transition: 400ms; } /* change status bar background when panel opened */ body.with-panel-left-cover .statusbar-overlay { background: #222; } </style> </head> <body> <div class = "statusbar-overlay"></div> <div class = "panel-overlay"></div> <!-- views --> <div class="views"> <!-- main view, should have "view-main" class --> <div class="view view-main"> <!-- pages container, because use fixed navbar , toolbar, has additional appropriate classes--> <div class="pages navbar-fixed toolbar-fixed"> <!-- page, "data-page" contains page name --> <div data-page="index" class="page"> <!-- top navbar. in material theme should inside of page--> <div class="navbar"> <div class="navbar-inner"> <div class="center app-head"> </div> </div> </div> <!-- toolbar. in material theme should inside of page--> <div class="toolbar"> <div class="toolbar-inner"> <a href="#" class="link"></a> <a href="#" class="link"></a> <a href="geo:38.897096,-77.036545" class="link ion-ios-location"><i class=""></i></a> </div> </div> <!-- scrollable page content --> <div class="page-content"> <div id="vlcatalogo" class="list-block virtual-list"> </div> </div> </div> </div> </div> </div> <script type="text/javascript" src="js/dropbox-sdk.min.js"></script> <script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" src="lib/framework7/js/framework7.min.js"></script> <script type="text/javascript" src="js/my-app.js"></script> </body> </html>
and config.xml
<?xml version='1.0' encoding='utf-8'?> <widget id="mx.focusdev.lolitas" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>lolitas hmo</name> <description> basic framework7 template phonegap. </description> <author email="dev@cordova.apache.org" href="http://cordova.io"> apache cordova team </author> <platform name="ios" /> <content src="index.html" /> <access origin="*" /> <access launch-external="yes" origin="whatsapp:*" /> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> <allow-intent href="tel:*" /> <allow-intent href="sms:*" /> <allow-intent href="mailto:*" /> <allow-intent href="geo:*" /> <allow-navigation href="https://*/*" /> <platform name="android"> <preference name="android-minsdkversion" value="14" /> <allow-intent href="market:*" /> </platform> <platform name="ios"> <allow-intent href="itms:*" /> <allow-intent href="itms-apps:*" /> <preference name="backupwebstorage" value="none" /> </platform> <preference name="disallowoverscroll" value="true" /> <plugin name="cordova-plugin-whitelist" spec="~1.2.0" /> <plugin name="cordova-plugin-console" spec="~1.0.1" /> <plugin name="cordova-plugin-statusbar" spec="~1.0.1" /> <plugin name="cordova-plugin-inappbrowser" spec="~1.7.1" /> </widget>
Comments
Post a Comment