Router and Route not working after convert framework & to apk


#1

Please i really need help on this …i have successfully design an android app with framework 7 everything works well in the browser but after converting with phonegap build, the buttons int the app doesnt work

html code




                        <div class="block">
                            <div class="row top-margin-large">
                                <a class="button col button-fill" href="/sign-up/">Sign Up</a>
                                <a class="button col button-fill color-white" href="/sign-in/" style="color:rgb(208, 94, 53)">Sign In</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

javacript code containng routes
// Add default routes
routes: [{
path: ‘/index/’,
url: ‘/index.html’,
name: ‘index’
},
{
path: ‘/sign-in/’,
url: ‘…/pages/sign-in.html’
},
{
path: ‘/sign-up/’,
url: ‘…/pages/sign-up.html’
},
{
path: ‘/home/’,
url: ‘…/pages/home.html’
},
{
path: ‘/profile-page/’,
url: ‘…/pages/profile-page.html’
},
{
path: ‘/profile-edit-page/’,
url: ‘…/pages/profile-page.html’
},
{
path: ‘/categories-page/’,
url: ‘…/pages/catergories-page.html’
},
{
path: ‘/near-me/’,
url: ‘…/pages/near-me-page.html’
}
],


#2

If it is an iOS app and you use WKWebView plugin then local XHR request don’t work there. Use ionic-wkwebview plugin instead
If it is an Android app make sure you have whitelisted requests correctly and you have correct CSP meta tag in index.html


#3

Thanks… i will try it out but sorry what are the correct whitelist request ? and can this csp meta tag work for it
<meta http-equiv="Content-Security-Policy" content="default-src * gap: ws: https://ssl.gstatic.com;style-src * 'unsafe-inline' 'self' data: blob:;script-src * 'unsafe-inline' 'unsafe-eval' data: blob:;img-src * data: 'unsafe-inline' 'self' content:;fmedia-src mediastream;"> (i’m building an adroid app)


#4

i tried what you said but it not working

this my index.html

<!-- Required meta tags-->
<!-- <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"> -->
<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self' foo.com"> -->
<meta http-equiv="Content-Security-Policy" content="default-src * gap: ws: https://ssl.gstatic.com;style-src * 'unsafe-inline' 'self' data: blob:;script-src * 'unsafe-inline' 'unsafe-eval' data: blob:;img-src * data: 'unsafe-inline' 'self' content:;fmedia-src mediastream;">

<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,height=device-height">
<meta name="format-detection" content="telephone=no">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#fc5e39">
<!-- Your app title -->
<title>GimBay</title>



<link rel="stylesheet" href="lib/framework7/css/framework7.md.min.css">
<link rel="stylesheet" href="lib/framework7/css/framework7.material.colors.min.css">

<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
                        <a class="item-content panel-close" href="/somepage/">
                            <div class="item-media">
                                <i class="icon fa fa-send"></i>
                            </div>
                            <div class="item-inner">
                                <div class="item-title">
                                    Send Feedback
                                </div>
                            </div>
                        </a>
                        <a class="item-content panel-close" href="/index/">
                            <div class="item-media">
                                <i class="icon fa fa-sign-out"></i>
                            </div>
                            <div class="item-inner">
                                <div class="item-title">
                                    Logout
                                </div>
                            </div>
                        </a>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class="view view-main">
        <div data-name="home" class="page">
            <!-- Scrollable page content -->
            <div class="page-content home">
                
                <div class="block">
                    <div class="row top-margin-large">
                        <a class="button col button-fill" href="/sign-up/">Sign Up</a>
                        <a class="button col button-fill color-white" href="/sign-in/" style="color:rgb(208, 94, 53)" id="clik">Sign In</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="lib/framework7/js/framework7.min.js"></script>
<script type="text/javascript" src="js/my-app.js"></script>
<script type="text/javascript" src="js/auth.controller.js"></script>

and my config.xml file

<?xml version='1.0' encoding='utf-8'?> GimBay A basic Framework7 template for PhoneGap. Apache Cordova Team

the link to app in my dropbox


#5

Then check the dev console in Chrome, maybe there are some issues in console


#6

no error in the console
i can perfectly use the app in the browser but the button wont work after converting to apk


#7

You need to check errors in Chrome debugger for your app running on Android


#8

Thanks i have seen the problem … it telling me it could get the pages…
what the perfect url path to write ,i want to navigate to sign-up.html which is present in a folder called pages
i have tried
…routes{[
path:’/sign-up/’,
url:’…/pages/sign-up.html/’
]
Thanks


#9

I finally solved it thanks for your help so far


#10

hi ! who you can solved this ?
pls help me

in apk file pages not working bot in emulator its work