Forum Stats

  • 3,733,845 Users
  • 2,246,829 Discussions
  • 7,856,892 Comments

Discussions

Phonegap API with Oracle APEX - Not Working

Arun Prakash K
Arun Prakash K Member Posts: 31
edited April 2016 in APEX Discussions

Hello All,

I developed an apex mobile application and integrated with phonegap cloud build.

The application is working like inbuilt application.

But I am not able to use any phonegap API.

Any ideas would be appreciated.

Added #WORKSPACE_IMAGES#cordova.js in File URLS


Execute when page loads

document.addEventListener("deviceready",onDeviceReady,false);

Function and Global Variable Declaration

function test()

{

alert('1');

document.addEventListener("deviceready",onDeviceReady,false);

}

    function onDeviceReady() {

        alert('2');

        //navigator.app.loadUrl('https://apex.oracle.com/pls/apex/f?p=IOT');

        //document.location.href = 'http://apex.oracle.com/pls/apex/f?p=IOT';

        //window.open('https://google.com', '_self ', 'location=yes');

       

       

        showAlert();

        playBeep();

        vibrate();

    }

// Show a custom alert

    //

    function showAlert() {

        alert('3');

        vibrate();

        navigator.notification.alert(

            'You are the winner!',  // message

            'Game Over',            // title

            'Done'                  // buttonName

        );

    }

    // Beep three times

    //

    function playBeep() {

        alert('4');

        navigator.notification.beep(3);

    }

    // Vibrate for 2 seconds

    //

    function vibrate() {

        alert('5');

navigator.vibrate(300);

    }

Index.html

<!DOCTYPE html>

<html>

  <head>

  <title>APEX DEMO</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />

<meta charset="utf-8">

  </head>

  <body onload="window.location.href='http://apex.oracle.com/pls/apex/f?p=IOT';">

    </body>

</html>

Config.xml

<?xml version="1.0" encoding="UTF-8"?>

<!-- config.xml reference: https://build.phonegap.com/docs/config-xml -->

<widget xmlns     = "http://www.w3.org/ns/widgets"

        xmlns:gap = "http://phonegap.com/ns/1.0"

        id        = "com.oracle.apex"

        version   = "1.0.0">

    <name>Hello World1</name>

    <description>

        Hello World sample application that responds to the deviceready event.

    </description>

    <author href="http://phonegap.com" email="[email protected]">

        PhoneGap Team

    </author>

    <!--

        If you do not want any permissions to be added to your app, add the

        following tag to your config.xml; you will still have the INTERNET

        permission on your app, which PhoneGap requires.

    -->

    <!-- Customize your app and platform with the preference element. -->

    <preference name="orientation"                value="default" />        <!-- all: default means both landscape and portrait are enabled -->

    <preference name="target-device"              value="universal" />      <!-- all: possible values handset, tablet, or universal -->

    <preference name="fullscreen"                 value="true" />           <!-- all: hides the status bar at the top of the screen -->

    <preference name="stay-in-webview" value="true" />

    <!--

        Define a specific version of PhoneGap to build into your app.

        <preference name="phonegap-version"       value="3.5.0" />

    -->

       <!-- Plugins -->

    <!-- Core plugins -->

    <gap:plugin name="org.apache.cordova.device" />

    <gap:plugin name="org.apache.cordova.dialogs" />

    <gap:plugin name="org.apache.cordova.inappbrowser" />

    <gap:plugin name="org.apache.cordova.network-information" />

    <gap:plugin name="org.apache.cordova.splashscreen" />

    <gap:plugin name="org.apache.cordova.vibration" />

    <!-- Third party plugins -->

    <!-- A list of available plugins are available at https://build.phonegap.com/plugins -->

    <!--

        <gap:plugin name="com.phonegap.plugins.barcodescanner" />

    -->

    <!--

        Define access to external domains.

        <access />            - a blank access tag denies access to all external resources.

        <access origin="*" /> - a wildcard access tag allows access to all external resource.

        Otherwise, you can specify specific domains:

        <access origin="http://phonegap.com" />                    - allow any secure requests to http://phonegap.com/

        <access origin="http://phonegap.com" subdomains="true" />  - same as above, but including subdomains, such as http://build.phonegap.com/

        <access origin="https://apex.oracle.com" subdomains="true" />

    -->

      

        <access origin="http://phonegap.com" />                  

        <access origin="http://phonegap.com" subdomains="true" />

        <access origin="https://apex.oracle.com" subdomains="true" />

        <access origin="http://apex.oracle.com" subdomains="true" />

        <access origin="*" />

  

  

    <access origin="*"/>

    <!-- Added the following intents to support the removal of whitelist code from base cordova to a plugin -->

    <!-- Whitelist configuration. Refer to https://cordova.apache.org/docs/en/edge/guide_appdev_whitelist_index.md.html -->

    <plugin name="cordova-plugin-whitelist" version="1" />

    <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="http://apex.oracle.com/*" />

    <allow-navigation href="https://apex.oracle.com/*" />

    <platform name="android">

        <allow-intent href="market:*" />

    </platform>

</widget>

This discussion has been closed.