Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi, i'm having this weird problem when compiled on android with the command "cordova build android", at first i used web-app on settings and everything worked fine but then i decided to change the settings.js to phonegap.
I added the code script cordova.js and the file, but it freezes on splash screen with or without the cordova.js.
This is my code if you can figure the error:
<!DOCTYPE html>
<html>
<head>
<title>My Site</title>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=yes" />
<!-- My Module JS Extras-->
<!-- jQuery Mobile -->
<link rel="stylesheet" href="jquery.mobile-1.4.5.min.css" />
<script src="jquery-1.9.1.min.js"></script>
<script src="jquery.mobile-1.4.5.min.js"></script>
<!-- jDrupal -->
<script type="text/javascript" charset="utf-8" src="jdrupal-7.x-1.2.min.js"></script>
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=2.5, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=medium-dpi" />
<script>
$(function(){
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
var ww = ( $(window).width() < window.screen.width ) ? $(window).width() : window.screen.width;
var mw = 480;
var ratio = ww / mw;
if( ww < mw){
$('#Viewport').attr('content', 'initial-scale=' + ratio + ', maximum-scale=' + ratio + ', minimum-scale=' + ratio + ', user-scalable=yes, width=' + ww);
}else{
$('#Viewport').attr('content', 'initial-scale=1.0, maximum-scale=2, minimum-scale=1.0, user-scalable=yes, width=' + ww);
}
}
});
</script>
<!-- DrupalGap -->
<script type="text/javascript" charset="utf-8" src="bin/drupalgap.js"></script>
<script type="text/javascript" charset="utf-8" src="app/settings.js"></script>
<!-- My Module JS Extras-->
<script type="text/javascript" charset="utf-8" src="app/modules/custom/my_module6/my_module6.js"></script>
<script>
$(document).on('click', 'p .ui-link', function (e) {
e.preventDefault();
window.open(e.target.href, '_system', 'location=yes');
});
</script>
<link rel="stylesheet" href="drupalgap.css" />
</head>
<body>
<!-- Mobile Application Splash Screen -->
<div id="_drupalgap_splash" data-role="page">
<div data-role="header" data-theme="b"><h2><img src="images/header.png" alt="My Site"></h2></div>
<div class="ui-content" data-role="content">
<div id="_drupalgap_splash_content">
<img src="images/drupalgap.jpg" alt="DrupalGap" style="position: absolute; top: 50%; left: 50%; margin-left: -64px; margin-top: -64px;" />
</div>
</div>
</div>
<!-- Load PhoneGap (Cordova) -->
<script type="text/javascript" src="cordova.js"></script>
<!-- Load DrupalGap -->
<script type="text/javascript">
drupalgap_onload();
</script>
</body>
</html>
Thanks in advance!
Comments
Comment #2
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedHave you copied the cordova.js file into your www directory from the platforms/android/platform_www directory?
Either way, be sure to hook up Chrome's inspect device's tool, that way you can monitor the console log for error messages. Please advise.
Comment #3
HomerO CreditAttribution: HomerO commentedThis is what i've got
"q=services/session/token Failed to load resource: the server responded with a status of 404 (Not Found)q=services/session/token Failed to load resource: the server responded with a status of 404 (Not Found)"
Thanks!Comment #4
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedSounds like your site path is not properly set in the settings.js file.
Comment #5
HomerO CreditAttribution: HomerO commentedThe error that:
gave me was:
drupalgap_check_connection - TypeError: Cannot read property 'type' of undefined;
on phonegap mode. Don't know if it's a drupal problem...
Comment #6
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedDid you install all the cordova plugins? It sounds like the network information plugin may not be installed properly.
Comment #7
HomerO CreditAttribution: HomerO commentedYes, installed all and updated the cordova config.xml. Also the token is working... Don't know what the problem can be... It's only when "phonegap" mode, on "web-app" works like charm...
Comment #8
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedWhat version of cordova are you using? Older versions don't have the connection object on within the navigator object: https://github.com/signalpoint/DrupalGap/blob/7.x-1.x/src/dg.js#L595
Comment #9
HomerO CreditAttribution: HomerO commented6.3.1
Comment #10
HomerO CreditAttribution: HomerO commentedNow is not working on web-app also, it connects when you put the url but when compile. Nothing.
EDIT: Updated drupalgap and have the same problem with the app...
/?q=services/session/token Failed to load resource: the server responded with a status of 404 (Not Found)
Comment #11
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedservices/session/token is a built in path provided by the Services module, and there should be a full domain/url in front of the /?q= (unless you're ommitting it for privacy). If that's not working, then it sounds like your site_path variables is messed up, or there is a problem with your Services module.
Comment #12
HomerO CreditAttribution: HomerO commentedGuess what... It was a config.xml problem with the whitelist plugin. I don't know what the plugin does but if it helps someone, i recommend to install it. Thanks!
Comment #13
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedYes, that plugin gave cost me hours and hours one day and I had the same problem. I didn't remember that until you mentioned it just now. Thank you for reporting one of many symptoms that can cause the dreaded WSOD.
The plugin is used to secure your app, e.g. by only allowing your app to connect to your Drupal site at example.com, or approved sub domains, etc.