user2899728
user2899728

Reputation: 2319

PhoneGap: diagnostic plugin is not working in iphone

I am trying to use diagnostic plugin in my ios app built by phonegap Build. It's working fine for android but it's not working in ios.

It is not showing any error in remote debug (console).

I am using following two files to build this app:

index.html

<!DOCTYPE html>
<html>
   <head>
     <title>Using PhoneGap Audio Media</title>
     <meta content="text/html; charset=utf-8" http-equiv="Content-type">
     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">

    <script src='cordova.js'></script> 

    <script type="text/javascript">
    function onDeviceReady() {

    cordova.plugins.diagnostic.isLocationEnabledSetting(function(enabled){
            if(enabled)
            {
                alert("Location Setting is enabled");
            }
            else
            {
                alert("Location Setting is disabled");
            }
        }, function(error){
            alert("The following error occurred: "+error);
        });
                }
    document.addEventListener("deviceready", onDeviceReady, false);
</script>

</head>

<body>
 Checking...
</body>
</html>

config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.phonegap.location" version="1.0.0"    xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name>Location Tester</name>
<description>
    Hello World sample application that responds to the deviceready event.
</description>
<author email="[email protected]" href="http://phonegap.com">
    PhoneGap Team
</author>

<gap:platform name="ios" />
<gap:platform name="android" />
<gap:platform name="winphone" />
<preference name="android-build-tool" value="gradle" />

 <preference name="orientation" value="default" />
 <preference name="fullscreen" value="true" />
  <preference name="permissions" value="none" />
<preference name="target-device" value="universal" />
<preference name="webviewbounce" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="false" />
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="show-splash-screen-spinner" value="true" />
<preference name="auto-hide-splash-screen" value="true" />
<preference name="disable-cursor" value="false" />
<preference name="android-minSdkVersion" value="14" />
<preference name="android-installLocation" value="auto" />
<gap:plugin name="cordova-plugin-flashlight" source="npm" />
<gap:plugin name="cordova-plugin-request-location-accuracy" source="npm" />

<gap:plugin name="com.phonegap.plugins.barcodescanner" />
<gap:plugin name="org.apache.cordova.battery-status" />
<gap:plugin name="org.apache.cordova.camera" />
<gap:plugin name="org.apache.cordova.media-capture" />
<gap:plugin name="org.apache.cordova.console" />
<gap:plugin name="org.apache.cordova.contacts" />
<gap:plugin name="org.apache.cordova.device" />
<gap:plugin name="org.apache.cordova.device-motion" />
<gap:plugin name="org.apache.cordova.device-orientation" />
<gap:plugin name="org.apache.cordova.dialogs" />
<gap:plugin name="org.apache.cordova.file" />
<gap:plugin name="org.apache.cordova.file-transfer" />
<gap:plugin name="org.apache.cordova.geolocation" />
<gap:plugin name="org.apache.cordova.globalization" />
<gap:plugin name="org.apache.cordova.inappbrowser" />
<gap:plugin name="org.apache.cordova.media" />
<gap:plugin name="org.apache.cordova.network-information" />
<gap:plugin name="org.apache.cordova.splashscreen" />
<gap:plugin name="org.apache.cordova.vibration" />
 <preference name="webviewbounce" value="false" />

 <preference name="DisallowOverscroll" value="false" />

 <preference name="disallowOverscroll" value="false" />

 <preference name="exit-on-suspend" value="true" />

 <access origin="*" subdomains="true" />
 </widget>

The plugin I am trying to use in this app: https://www.npmjs.com/package/cordova.plugins.diagnostic

I am not getting any error. I reasearched alot about this issue but no vain. I'll really appreciate any response.

Thanks

Upvotes: 0

Views: 1028

Answers (1)

DaveAlden
DaveAlden

Reputation: 30366

Is that the exact config.xml you are using? Because I don't see any reference to cordova.plugins.diagnostic in it. Hence is the plugin actually being installed in the project?

I'd expect to see <gap:plugin name="cordova.plugins.diagnostic.api-22" /> if you're using the legacy branch.

Or <gap:plugin name="cordova.plugins.diagnostic.api" /> if you're using the master branch to build against Android API 23 with Cordova 6.0.0 on Phonegap Build:

<preference name="phonegap-version" value="cli-6.0.0" />

Other than that, you usage of the JS API in index.html looks correct.

Upvotes: 2

Related Questions