Giter Site home page Giter Site logo

cordova-examples's Introduction

Cordova Demos

This repository contains a set of Cordova (PhoneGap) example apps. Each folder contains the www folder for a project. To use it, you may either copy the files manually into a www folder, or use the --copy-from option of the Cordova CLI.

Each folder has its own readme with individual instructions for the project.

cordova-examples's People

Contributors

cfjedimaster avatar nphyatt avatar ralscha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-examples's Issues

SMSComposer not working with direct Phonegap Desktop App.

Hello Raymond sir, the SMS Composer did not work with the Phonegap desktop app. I tried sending SMS but failed to work, should I build it with the cordova plugins to run it android or is there something else wrong? Please help.

some demo is too old, and some demo withou readme

would you add a readme file for each demo? and to upgrade your demo to the newest plugin for your demo ?
I don't know if my words fail to convey my meaning. I will apologize for my poor English if my words hurt you.
I think you do a good job, and I think you can do better.

media example did not work.

media example did not work.
Please show AndroidManifest.xml and config.xml

Mine, it returns Media is not defined and no audio played.

mp3 can't run

Are you sure the code is can run ? we test the mp3 can't run ?

barcodedemo not working

listening on 192.168.99.212:3000
200 /api/appzip
200 /socket.io/socket.io.js
200 /socket.io/?EIO=2&transport=polling&t=1452690074142-0
200 /socket.io/?EIO=2&transport=polling&t=1452690074267-1&sid=XIh2KUPHDdKOeNuMAAAA
undefined No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.
200 /socket.io/?EIO=2&transport=polling&t=1452690074356-2&sid=XIh2KUPHDdKOeNuMAAAA
200 /socket.io/?EIO=2&transport=polling&t=1452690074464-3&sid=XIh2KUPHDdKOeNuMAAAA
200 /api/autoreload
200 /api/autoreload
200 /api/autoreload
200 /api/autoreload
undefined No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.
200 /api/autoreload
200 /api/autoreload
200 /api/autoreload
undefined No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.
200 /api/autoreload

resolveLocalFileSystemURL is never true

It just downloads a new file every time. Which it does well, I thank you for that greatly. I would like to know what I am missing to open a file I know is there somewhere. Because adobe will open all of them offline. My code will not.

Question on Versions that works with barcode scanner

Hello

I have been struggling to get barcode scanner to work getting 'write settings false' error.

I would like to ask a question, which versions was the barcode scanner tested using so we can also use the correct versions?
What versions of:
Cordova?
Android sdk?
barcodescanner plugin?

Thank you

Dont Work

Hi Guys.

I copied the code exactly as in the example, but does not work .
I'm generating the .apk file and installing on my android device... but when I connect the USB can not find the file " log.txt " Editar

Write Text File example

Hi, I notice that there isn't an example on writing a text file to ex. cordova.file.dataDirectory,
do you have any plans to add one?

I really like the examples you've put up here - they're all really compact and to the point.
Thanks for putting them up!

contact picker problem

when i tried to copy the code and convert it to apk using build.phonegap.com its not working not even alert for error message do u think i have error in installation or wrong file has been uploaded to the site?

E/FileTransfer๏น• {"target":"file:\/\/\/data\/data\/pckg\/files\/image.png","http_status":0,"code":3,"source":"http://serverpath/image.png","exception":"socket failed: EMFILE (Too many open files)"}

Hi, I Have a question about checkandDownload Example when i download more than 1000 images from server to DataDirectory store but this error shown

E/FileTransfer๏น• {"target":"file:///data/data/pckg/files/image.png","http_status":0,"code":3,"source":"http://serverpath/image.png","exception":"socket failed: EMFILE (Too many open files)"}

How can i fix this Error?
Please I need Help
Thanks

ReferenceError: cordova is not defined in

Hi,
Thank you for your code sharing but I got falowing error for : Cordova-Examples/securestorage_ionicnative/app/pages/home/home.ts in run time
ReferenceError: cordova is not defined

    at securestorage.js:57
    at new t (polyfills.js:3)
    at SecureStorage.create (securestorage.js:56)
    at home.ts:28
    at t.invoke (polyfills.js:3)
    at Object.onInvoke (ng_zone.js:236)
    at t.invoke (polyfills.js:3)
    at e.run (polyfills.js:3)
    at polyfills.js:3
    at t.invokeTask (polyfills.js:3)

and fallowing for data input and login button click:

Object {success: 0}
plugin.js:33 Native: tried calling Dialogs.alert, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
cordovaWarn @ plugin.js:33
callCordovaPlugin @ plugin.js:112
(anonymous) @ plugin.js:160
(anonymous) @ plugin.js:132
t @ polyfills.js:3
tryNativePromise @ plugin.js:131
getPromise @ plugin.js:153
wrapPromise @ plugin.js:159
(anonymous) @ plugin.js:326
value @ plugin.js:387
(anonymous) @ home.ts:79
SafeSubscriber.__tryOrSetError @ Subscriber.js:232
SafeSubscriber.next @ Subscriber.js:174
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
ArrayObservable._subscribe @ ArrayObservable.js:114
Observable.subscribe @ Observable.js:56
HomePage.login @ home.ts:58
View_HomePage0.handleEvent_35 @ component.ngfactory.js:507
(anonymous) @ view.js:408
(anonymous) @ dom_renderer.js:276
t.invokeTask @ polyfills.js:3
onInvokeTask @ ng_zone.js:227
t.invokeTask @ polyfills.js:3
e.runTask @ polyfills.js:3
invoke @ polyfills.js:3
error_handler.js:47 EXCEPTION: Uncaught (in promise): TypeError: Cannot read property 'remove' of undefined
TypeError: Cannot read property 'remove' of undefined
    at callInstance (http://localhost:8100/build/main.js:542:37)
    at http://localhost:8100/build/main.js:580:17
    at http://localhost:8100/build/main.js:466:17
    at new t (http://localhost:8100/build/polyfills.js:3:11329)
    at tryNativePromise (http://localhost:8100/build/main.js:465:20)
    at getPromise (http://localhost:8100/build/main.js:487:16)
    at SecureStorage.<anonymous> (http://localhost:8100/build/main.js:579:20)
    at SecureStorage.value [as remove] (http://localhost:8100/build/main.js:740:61)
    at SafeSubscriber._next (http://localhost:8100/build/main.js:55171:37)
    at SafeSubscriber.__tryOrSetError (http://localhost:8100/build/main.js:1284:16)
ErrorHandler.handleError @ error_handler.js:47
IonicErrorHandler.handleError @ ionic-error-handler.js:56
next @ application_ref.js:272
schedulerFn @ async.js:82
SafeSubscriber.__tryOrUnsub @ Subscriber.js:223
SafeSubscriber.next @ Subscriber.js:172
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
Subject.next @ Subject.js:55
EventEmitter.emit @ async.js:74
NgZone.triggerError @ ng_zone.js:278
onHandleError @ ng_zone.js:257
t.handleError @ polyfills.js:3
e.runGuarded @ polyfills.js:3
r @ polyfills.js:3
i @ polyfills.js:3
invoke @ polyfills.js:3
error_handler.js:52 ORIGINAL STACKTRACE:
ErrorHandler.handleError @ error_handler.js:52
IonicErrorHandler.handleError @ ionic-error-handler.js:56
next @ application_ref.js:272
schedulerFn @ async.js:82
SafeSubscriber.__tryOrUnsub @ Subscriber.js:223
SafeSubscriber.next @ Subscriber.js:172
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
Subject.next @ Subject.js:55
EventEmitter.emit @ async.js:74
NgZone.triggerError @ ng_zone.js:278
onHandleError @ ng_zone.js:257
t.handleError @ polyfills.js:3
e.runGuarded @ polyfills.js:3
r @ polyfills.js:3
i @ polyfills.js:3
invoke @ polyfills.js:3
error_handler.js:53 Error: Uncaught (in promise): TypeError: Cannot read property 'remove' of undefined
TypeError: Cannot read property 'remove' of undefined
    at callInstance (plugin.js:208)
    at plugin.js:246
    at plugin.js:132
    at new t (polyfills.js:3)
    at tryNativePromise (plugin.js:131)
    at getPromise (plugin.js:153)
    at SecureStorage.<anonymous> (plugin.js:245)
    at SecureStorage.value [as remove] (plugin.js:406)
    at SafeSubscriber._next (home.ts:80)
    at SafeSubscriber.__tryOrSetError (Subscriber.js:232)
    at s (polyfills.js:3)
    at new t (polyfills.js:3)
    at tryNativePromise (plugin.js:131)
    at getPromise (plugin.js:153)
    at SecureStorage.<anonymous> (plugin.js:245)
    at SecureStorage.value [as remove] (plugin.js:406)
    at SafeSubscriber._next (home.ts:80)
    at SafeSubscriber.__tryOrSetError (Subscriber.js:232)
    at SafeSubscriber.next (Subscriber.js:174)
    at Subscriber._next (Subscriber.js:125)

how ever it return 0 for login but it is not going to main-page also I am using the fallowings:

Ionic Framework: 2.0.0-rc.4
Ionic Native: 2.2.11
Ionic App Scripts: 0.0.47
Angular Core: 2.2.1
Angular Compiler CLI: 2.2.1
Node: 6.9.1
OS Platform: Windows 10
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Mobile Safari/537.36

Steal Contacts Demo not working

Hi @cfjedimaster

I tried running the steal contacts demo with the cordova contacts plugin.

here's an snippet of my deviceReady


 onDeviceReady: function() {
        this.receivedEvent('deviceready');
        console.log("Device ready event ");
       
        //get contacts on user's device
		navigator.contacts.find(
		[navigator.contacts.fieldType.displayName],
		gotContacts,
		errorHandler);
	  
	  function gotContacts(c) {
		console.log("gotContacts, number of results "+c.length);
	
		for(var i=0, len=c.length; i<len; i++) {
			console.dir(c[i]);
		}
	  }
		function errorHandler(e) {
		console.log("error " + e);
	
		
	  }
       
    }

And the result i get when i run on an actual device:


 Failed to get birthday for contact from cursor
                                                                                  java.lang.IllegalArgumentException
                                                                                      at java.sql.Date.valueOf(Date.java:219)
                                                                                      at org.apache.cordova.contacts.ContactAccessorSdk5.getBirthday(ContactAccessorSdk5.java:1977)
                                                                                      at org.apache.cordova.contacts.ContactAccessorSdk5.populateContactArray(ContactAccessorSdk5.java:466)
                                                                                      at org.apache.cordova.contacts.ContactAccessorSdk5.search(ContactAccessorSdk5.java:295)
                                                                                      at org.apache.cordova.contacts.ContactManager$3.run(ContactManager.java:209)
                                                                                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                                      at java.lang.Thread.run(Thread.java:818)

Please help with this as the stealcontacts demo isn't working

Sound playing some of the time

I am trying to build a circuit training app and found your code to be useful.

I tried the code for playing audio files you posted and it works however when I tried to play a sound through with a timeout function it works only after a certain point in time. After that no sound is played.

This is my code below;

beep.js

var beep = "sounds/Japanese Temple Bell.mp3";
var tone = "sounds/tone.mp3";
var time = 0, Ex_time = 0, Rest_time = 0, Sets_time = 0;
var RepeatsDisplay = 0, SetsDisplay = 0;
var num = 0;
var Exercise_Interval= 0, Rest_Interval= 0, Sets_Interval= 0;
var Sets = 0, Repeats = 0;
var interval = 0, global_Interval = -1, Global = -1;
var state = -1;
var context = 0;
var seconds = -1, minutes = -1, global_seconds = -1, global_minutes = -1, display_mins = 0, display_secs = 0;
g = 0, t = 0;

//functions used to play sounds
function playMP3(sound) {
var mp3URL = getMediaURL(sound);
var media = new Media(mp3URL, null, mediaError);
media.play();
}

function getMediaURL(s) {
if(device.platform.toLowerCase() === "android") return "/android_asset/www/" + s;
return s;
}

function mediaError(e) {
alert('Media Error');
alert(JSON.stringify(e));
}

//functions that show user inputs
function toggleRow(id) {
var row = document.getElementById(id) ;
if (row.style.display == 'none') {
row.style.display = 'inline';
}
else {
row.style.display = 'none';
}
}
function toggleData(table,id) {
var table = document.getElementById(table);
for (var i = 0, row; row = table.rows[i]; i++) {
if (row.className == id) {
for (var j = 0, col; col = row.cells[j]; j++) {

                if (col.style.display == '') {
                    col.style.display = 'inline';
                    }
                    else {
                col.style.display = '';
                    }
        }       
    }
}               

}

//Function that validates inputs
function minmax(value, min, max)
{
if(parseInt(value) < min || isNaN(value))
return min;
else if(parseInt(value) > max)
return max;
else return value;
}

//functions that show user inputs in the sets table
function getElementsByClassName(node,classname) {
if (node.getElementsByClassName) { // use native implementation if available
return node.getElementsByClassName(classname);
} else {
return (function getElementsByClass(searchClass,node) {
if ( node == null )
node = document;
var classElements = [],
els = node.getElementsByTagName("*"),
elsLen = els.length,
pattern = new RegExp("(^|\s)"+searchClass+"(\s|$)"), i, j;

    for (i = 0, j = 0; i < elsLen; i++) {
      if ( pattern.test(els[i].className) ) {
          classElements[j] = els[i];
          j++;
      }
    }
    return classElements;
})(classname, node);

}
}

function toggleRowByClassName(Table, ClassName) {
var table = getElementsByClassName(document, Table);
//var elements = getElementsByClassName(document, ClassName),
n = table.length;
for (var i = 0; i < n; i++) {
var e = table[i];
if (e.className == ClassName) {
if(e.style.display == 'none') {
e.style.display = 'inline';
} else {
e.style.display = 'none';
}
}
}
}

//function counts the exercise and rest time
function countdown() {
if (interval == 0 && seconds == 0 && minutes ==0) {
state++;
playMP3(beep);
interval = 0, seconds = -1, minutes = -1;
if (state % 2 == 0) {
Repeats--
document.getElementById('Repeats_Display').textContent = Repeats + "x";
}
start();
if (parseInt(Repeats) == 0) {
clearTimeout(t);
clearTimeout(g);
}
}
t = setTimeout(function() {startclock(time, context)}, 1000);
}

function countzero() {
if (interval == 0 && seconds == 0 && minutes ==0) {
state++;
interval = 0, seconds = -1, minutes = -1;
if (state % 2 == 0) {
Repeats--
document.getElementById('Repeats_Display').textContent = Repeats + "x";
}
start();
if (parseInt(Repeats) == 0) {
clearTimeout(t);
clearTimeout(g);
}
}
}

function startclock(time, context) {
if (parseInt(Repeats) == 0) {
return 0;
}
if (interval == 0) {
context = context
minutes = Math.floor(time / 60);
seconds = time - Math.round(minutes * 60);
interval = parseInt(time);
}
if (seconds == 0 && minutes > 0) {
minutes--
seconds = 60;
}
if (seconds > 1 && seconds < 5) {
playMP3(tone);
}
seconds--;
interval--;
context.textContent = (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" +
(seconds > 9 ? seconds : "0" + seconds);
if (seconds ==0 && minutes == 0) {
context.textContent = getTimeDisplay(time);
}
countdown();
}

//function that decreases global timer

function Globalcountdown() {
if (global_Interval == 0) {
global_Interval = -1
}
g = setTimeout(function() {startglobalclock(global_Interval)}, 1000);
}

function startglobalclock(startglobalInterval) {
if (Global < 0 && startglobalInterval > 0) {
global_minutes = Math.floor(global_Interval / 60);
global_seconds = global_Interval - Math.round(global_minutes * 60);
Global = global_Interval
}
if (global_seconds == 0 && global_minutes > 0) {
global_minutes--
global_seconds = 60;
}
global_seconds--;
Global--;
Global_time.textContent = (global_minutes ? (global_minutes > 9 ? global_minutes : "0" + global_minutes) : "00") + ":" +
(global_seconds > 9 ? global_seconds : "0" + global_seconds);
Globalcountdown();
}

function getTimeDisplay(time) {
display_mins = Math.floor(time / 60);
display_secs = time - Math.round(display_mins * 60);
var result = (display_mins < 10 ? "0" + display_mins : display_mins) + ":" + (display_secs < 10 ? "0" + display_secs : display_secs);
display_mins = 0, display_secs = -1;
return result;
}

//Set the variables
function setvar() {
Sets = document.getElementById('Sets').value;
Repeats = document.getElementById('Repeats').value;
Exercise_Interval = document.getElementById('Exercise_Interval').value;
Rest_Interval = document.getElementById('Rest_Interval').value;
Sets_Interval = document.getElementById('Sets_Interval').value;
Global_time = document.getElementById('Global_time');
Ex_time = document.getElementById('Ex_time');
Rest_time = document.getElementById('Rest_time');
Sets_time = document.getElementById('Sets_time');
RepeatsDisplay = document.getElementById('Repeats_Display');
SetsDisplay = document.getElementById('Sets_Display');
interval = 0, minutes = -1, seconds = -1;
}

function start() {
if (state == -2) {
clearTimeout(t);
t = 0, s = 0;
Repeats = document.getElementById('Repeats').value;
global_Interval = (parseInt(Exercise_Interval) + parseInt(Rest_Interval)) * parseInt(Repeats)
Global_time.textContent = getTimeDisplay(global_Interval);
Ex_time.textContent = getTimeDisplay(Exercise_Interval);
Rest_time.textContent = getTimeDisplay(Rest_Interval);
Sets_time.textContent = getTimeDisplay(Sets_Interval);
document.getElementById('Repeats_Display').textContent = Repeats + "x";
state = 0;
playMP3(beep);
Globalcountdown();
}
if (state == -1) {
setvar();
global_Interval = (parseInt(Exercise_Interval) + parseInt(Rest_Interval)) * parseInt(Repeats)
Global_time.textContent = getTimeDisplay(global_Interval);
Ex_time.textContent = getTimeDisplay(Exercise_Interval);
Rest_time.textContent = getTimeDisplay(Rest_Interval);
Sets_time.textContent = getTimeDisplay(Sets_Interval);
document.getElementById('Repeats_Display').textContent = Repeats + "x";
document.getElementById('Sets_Display').textContent = Sets + "x";
state = 0;
playMP3(beep);
Globalcountdown();
countdown();
}
if (state % 2 == 0) {
time = parseInt(Exercise_Interval);
context = Ex_time;
} else {
time = parseInt(Rest_Interval);
context = Rest_time;
if (time == 0) {
minutes = 0, seconds = 0;
countzero();
}
}
if (parseInt(Repeats) == 0) {
clearTimeout(t);
clearTimeout(g);
interval = 0, minutes = -1, seconds = -1, state = -3;
Global = -1, global_minutes =-1, global_seconds = -1;
if (parseInt(Sets) > 1) {
state = -3;
clearTimeout(t);
clearTimeout(g);
Repeats = document.getElementById('Repeats').value;
document.getElementById('Repeats_Display').textContent = Repeats + "x";
Sets--
document.getElementById('Sets_Display').textContent = Sets + "x";
time = parseInt(Sets_Interval);
context = Sets_time;
} else {
stop();
}
}

}
//clear interval and clear timeout
function stop() {
setvar();
global_Interval = (parseInt(Exercise_Interval) + parseInt(Rest_Interval)) * parseInt(Repeats);
Global_time.textContent = getTimeDisplay(global_Interval);
Ex_time.textContent = getTimeDisplay(Exercise_Interval);
Rest_time.textContent = getTimeDisplay(Rest_Interval);
Sets_time.textContent = getTimeDisplay(Sets_Interval);
document.getElementById('Repeats_Display').textContent = Repeats + "x";
document.getElementById('Sets_Display').textContent = Sets + "x";
clearTimeout(t);
clearTimeout(g);
Repeats = 0, Sets = 0;
interval = 0, minutes = 0, seconds = 0, state = -1;
Global = -1, global_minutes =-1, global_seconds = -1;
}

//function for start button
document.addEventListener('deviceready', onDeviceReady, false);

function onDeviceReady() {
document.querySelector("#start").addEventListener("touchend", start, false);
document.querySelector("#stop").addEventListener("touchend", stop, false);
};

index.html

<title></title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->

<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>

<!-- cordova script (this will be a 404 during development) -->
<script src="ng-cordova.min.js"></script>
<script src="cordova.js"></script>

<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>
<script src="js/beep.js"></script>
<ion-pane>
  <ion-header-bar class="bar-dark">

  <h1 class="title"> Beeper</h1>
  </ion-header-bar>

  <ion-content>
    <br><br><br>
    <div class ="card">
<table id="Exercise_table">
  <tr>
    <th>Exercise</th>
    <td class="time"><div ><time id="Ex_time"><b>00:30</b></time></div></td>  
  </tr>
  <tr>
    <td colspan="2" class="arrow"><button id="show-Exercise" onclick="toggleData('Exercise_table','data')"><img src="./img/arrow.png"></button></td>
  </tr>
  <tr class="data">
    <td id="Ex-a">Interval (in sec):</td>
        <td id="Ex-b"><input type="number" onkeyup="this.value = minmax(this.value, 0, 999)" id="Exercise_Interval" value="30"></td>
  </tr>
</table>
<table id="Rest_table">
  <tr>
    <th>Rest</th>
    <td class="time"><div id =Rest_time><time><b>00:00</b></time></div></td>
  </tr>
    <tr>
    <td colspan="2" class="arrow"><button id="show-Rest" onclick="toggleData('Rest_table','data')"><img src="./img/arrow.png"></button></td>
  </tr>
  <tr class="data">
    <td id="Rest-a">Interval (in sec):</td>
        <td id="Rest-b"><input  type="number" onkeyup="this.value = minmax(this.value, 0, 999)"  id="Rest_Interval" value="0"></td>  
  </tr>
</table>
<table id="Repeats_table">
  <tr>
    <th>Repeats</th>
    <td><div class="wrapper" id = "Repeats_Display">10x</div></td>
  </tr>
  <tr>
    <td colspan="2" class="arrow"><button id="show-Repeats" onclick="toggleData('Repeats_table','data')"><img src="./img/arrow.png"></button></td>
  </tr>
  <tr class="data">
    <td id="Repeats-a">Number of Repeats:</td>
        <td id="Repeats-b"> <input type="number" onkeyup="this.value = minmax(this.value, 1, 99)"  id="Repeats" value="10"></td>
  </tr>
</table>
<table id="Sets_table">
  <tr>
    <th>Sets</th>
    <td><div class="wrapper"id="Sets_Display">1x</div></td>
  </tr>
  <tr>
    <th>Sets-Rest</th>
    <td class="time"><div id=Sets_time><time><b>00:10</b></time></div></td>
  </tr>
  <tr>
    <td colspan="2" class="arrow"><button id="show-sets" onclick="toggleData('Sets_table','data')""><img src="./img/arrow.png"></button></td>
  </tr>
  <tr class="data">
        <td id="Sets-a">Number of Sets:</td>
    <td id="Sets-b"><input type="number" onkeyup="this.value = minmax(this.value, 1, 99)"  id="Sets" value="1"></td>
    <td id="Sets-c">Interval (in sec):</td>
        <td id="Sets-d"><input type="number" onkeyup="this.value = minmax(this.value, 0, 999)"  id="Sets_Interval" value="10"></td>
  </tr>     
</table>

<table class="main">
 <tr>
   <td class="container">
     <button class="start-button" data-l10n-id="start" id="start" type="button">Start</button>
     <button class="stop-button" data-l10n-id="stop" id="stop" type="button">Stop/Reset</button>
   </td>
  <td class="global"><h2><time id="Global_time">05:00</time></h2></td>  
 </tr>  
</table>
  </div>
  </ion-content>
</ion-pane>

Is there anyway to call the var resultDiv in ng-model?

var resultDiv;

document.addEventListener("deviceready", init, false);
function init() {
document.querySelector("#startScan").addEventListener("touchend", startScan, false);
resultDiv = document.querySelector("[ng-model='user.result']");
}
function startScan() {

    cordova.plugins.barcodeScanner.scan(
        function (result) {
            //var s = result.text;
            var s = result.text;
            resultDiv.innerHTML = s;
        }, 
        function (error) {
            alert("Scanning failed: " + error);
        }
    );

}

TypeError when dealing with files

cordova 3.6.3-0.2.13
org.apache.cordova.file 1.1.0 "File"
org.apache.cordova.file-transfer 0.4.6 "File Transfer"
org.chromium.zip 2.1.0 "Zip"

getfiledata example:
TypeError: 'undefined' is not an object (evaluating 'cordova.file.applicationDirectory')

readtextfile example:
TypeError: 'undefined' is not an object (evaluating 'cordova.file.dataDirectory')

Barcode is not working,What am I doing wrong.

Created a new folder using phonegap create, included the plugin using cordova command line and the plugin is present in plugin folders, replaced hello word www folder with whatever is give here, when I fireup the app I see the start scan button but after clicking that nothing happens...can someone pls help

local mp3 file doesn't play in demo

I've been trying to get the cordova-plugin-media to play a local file. I cannot get it to work in for my project so I've been trying to see if other demo projects work. Came across this mp3 demo and found I couldn't get it work on my phone. Curious if others are seeing this as well, if not, what is their working config.

I can get it working with remote urls but nothing local, neither ios nor android (with the android specific /android_asset/www/ path).

The plugin doesnt throw an error, it logs out: Playing audio sample 'sounds/button-1.mp3' into Xcode. But complete silence on both platforms.

If I use the same local sound file but use https://github.com/katzer/cordova-plugin-local-notifications, the sound file gets played on the device (thus ruling out a corrupt sound file and the device not playing sounds/silenced).

I've tried the ngCordova wrapper for the plugin as well to no avail. Also tried using .wav files for ios.
in my ionic project I have the following code:

$scope.vc.playMedia = function() {
            $ionicPlatform.ready(function() {
                console.log('playing media');
                var src = device.platform == 'Android' ? "/android_asset/www/sounds/file1.mp3" : "sounds/file1.wav";
                console.log('from source ' + src)
                // Remote source works
                // src = "http://www.stephaniequinn.com/Music/Commercial%20DEMO%20-%2013.mp3";
                var media = new Media(src, null, null, mediaStatusCallback);
                media.play();

                var mediaStatusCallback = function(status) {
                    if (status == 1) {
                        $ionicLoading.show({ template: 'Loading...' });
                    } else {
                        $ionicLoading.hide();
                    }
                }
                console.log('media: ')
                console.dir(media);
            })

        }

TIA,
Sante

Offline Data Loading Problems

Apps Works Fine When Data Connection as soon as data connection disconnected .........loading but do not load data from offline

Read Text File: File Error Code 1

Hi,

I just copy your code into a new cordova project after add android plataform and file plugin, then I get:

FileError
code 1

"1" is File not found

Promise don't return anythings

Code find and create list of events, if not found. I am facing issue with the function findEvents don't return anything, Can you please help me to resolve.

service.js

.factory('Events', function($log, $q, $http, $rootScope,$cordovaCalendar) {
 
    findEvents = function(events) {
        var deferred = $q.defer();
        var dftlyEvents = events;
        /*
        Logic is:
        For each, see if it exists an event.
        */
        var promises = [];
        dftlyEvents.forEach(function(ev) {
            promises.push($cordovaCalendar.findEvent({
                title:ev.title,
                startDate:ev.startDate,
            }));
        });
        
        $q.all(promises).then(function(results) {
            console.log("in the all done"+results);   
            //should be the same len as events
            for(var i=0;i<results.length;i++) {
                dftlyEvents[i].status = results[i].length === 1;
            }
            deferred.resolve(dftlyEvents);
        });
        return deferred.promise;
    }

    createEvents = function(events) {
        console.log("createEvent"+JSON.stringify(events));
        var deferred = $q.defer();
        var dftlyEvents = events;
        /*
        Logic is:
        For each, see if it exists an event.
        */
        var promises = [];
        dftlyEvents.forEach(function(ev) {
            if(typeof(ev.status) != 'undefined' && !ev.status){
                //console.log("for"+JSON.stringify(ev));
                promises.push($cordovaCalendar.createEvent({
                    title:ev.title,
                    startDate:ev.startDate,
                    endDate: ev.endDate
                }));
            }
        });
        
        $q.all(promises).then(function(results) {
            console.log(results);   
            //should be the same len as events
            for(var i=0;i<results.length;i++) {
                dftlyEvents[i].created = results[i].length === 1;
            }
            deferred.resolve(dftlyEvents);
        });
        return deferred.promise;
    }
    
  return {
        get:findEvents,
        add:createEvents
  };

});

controller.js

Events.get(response).then(function(events) {
            $scope.events = events;
            Events.add($scope.events).then(function(result) {
              console.log("result");
            },function(error){
               console.log(" error at function create"+ JSON.stringify(error));
            }).catch(function (error){
               console.log("error at create catch"+ JSON.stringify(error));
            });
          },function(error){
            console.log("error at Event find "+ JSON.stringify(error));
          }).catch(function (error){
            console.log("catch error"+ JSON.stringify(error));
          });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.