Search code examples
androidibm-mobilefirst

Running worklight app on realdevice


i try to run my worklight 6.2 app on a device, but the app is not getting loaded on to the device it is only showing the IBM screen.

How to run the app on the real device. the following screen shot is my structure enter image description here

and i have build this using build all environments now from the android folder i have taken unsigned apk and installed in on my device and also tried running directly throw right clicking and ran on the device but on my device it is showing only IBM screen the app is not getting displayed.


Solution

  • Your application fails to work (go past the splash screen, and anything else...) because in you've stripped out of the index.html file anything related to Worklight(!), which includes actually initializing the Worklight framework... which is mandatory for a Worklight application.

    Create a new Worklight application and take a look at the index.html, here's the default:

    <!DOCTYPE HTML>
    <html>
            <head>
                <meta charset="UTF-8">
                <title>test</title>
                <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
                <!--
                    <link rel="shortcut icon" href="images/favicon.png">
                    <link rel="apple-touch-icon" href="images/apple-touch-icon.png"> 
                -->
                <link rel="stylesheet" href="css/main.css">
                <script>window.$ = window.jQuery = WLJQ;</script>
            </head>
            <body style="display: none;">
                <!--application UI goes here-->
                Hello Worklight
                <script src="js/initOptions.js"></script>
                <script src="js/main.js"></script>
                <script src="js/messages.js"></script>
            </body>
    </html>
    

    In your index.html you've removed all references at the top and bottom to initoptions.js, main.js, messages.js as well as at the top, etc.

    Please go through the IBM Worklight Getting Started training modules, from the beginning where the structure of a Worklight application is thoroughly explained.