cordova

Pick an image / video using PhoneGap in Android

夙愿已清 提交于 2020-01-30 08:22:06
问题 How can I pick an image / video ( or take a photo / video ) using PhoneGap in Android ? I have a web form needs to pick image / video contents and submit the form to upload the contents. Is PhoneGap capable to do so? or I have to fall back to native Android codes? 回答1: Yes you can upload image to server with phonegap Here is the code to pick image or video document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { pictureSource = navigator.camera

Php in phone gap application

不想你离开。 提交于 2020-01-30 08:18:06
问题 We have to develop an application with more plattform. We would use the framework PhoneGap. For our application we need services of backend, the question is: Does PhoneGap support PHP? If it doesn't support PHP. In which way we can solve the problem? The most important thing is: make call server (Get and Post), parsing a json and other functions that PHP gives. 回答1: Phonegap does not have a server. You need to call via Ajax to remote servers. 回答2: The backend can be in any language which

Php in phone gap application

喜欢而已 提交于 2020-01-30 08:18:04
问题 We have to develop an application with more plattform. We would use the framework PhoneGap. For our application we need services of backend, the question is: Does PhoneGap support PHP? If it doesn't support PHP. In which way we can solve the problem? The most important thing is: make call server (Get and Post), parsing a json and other functions that PHP gives. 回答1: Phonegap does not have a server. You need to call via Ajax to remote servers. 回答2: The backend can be in any language which

How to use promises in javascript

瘦欲@ 提交于 2020-01-30 08:11:08
问题 I am making an app for Android in Cordova, with Typescript, and I bundle with Webpack. I don't understand very well how to do asynchronous tasks in Javascript. I saw several tutorials on callbacks and promises, but it's still very confused for me and I don't manage to adapt it to my code. I don't know if my problem comes from my code itself, or from Typescript/Cordova/Webpack. I created a function getAllSMS that return a big object, and takes some time to execute. I know the function works

How to play a simple sound clip (like a button click) when a div is clicked

[亡魂溺海] 提交于 2020-01-30 06:54:01
问题 I am developing an application with the Ionic Framework and searching for a (very) simple way to play a sound every time a div is clicked. Something similar to this: <div ng-click="sound()"></div> $scope.sound = function () { //sound play once here } If the solution could be in angularjs that would be great, but any help would be greatly appreciated. 回答1: $scope.sound=function(){ var audio = new Audio('audio_file.mp3'); audio.play(); } 回答2: I don't understand why people recommend the vanilla

How to play a simple sound clip (like a button click) when a div is clicked

雨燕双飞 提交于 2020-01-30 06:53:05
问题 I am developing an application with the Ionic Framework and searching for a (very) simple way to play a sound every time a div is clicked. Something similar to this: <div ng-click="sound()"></div> $scope.sound = function () { //sound play once here } If the solution could be in angularjs that would be great, but any help would be greatly appreciated. 回答1: $scope.sound=function(){ var audio = new Audio('audio_file.mp3'); audio.play(); } 回答2: I don't understand why people recommend the vanilla

How to wait till callback function returns?

百般思念 提交于 2020-01-30 05:39:27
问题 I'm making an android application using phonegap. I'm using phonegap's Storage api for querying a database. here's my code: function directPath(src, dest) { var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000); db.transaction(queryDB, errorCB); return arrayroute; } function queryDB(tx) { tx.executeSql(query, [], querySuccess, errorCB); } function querySuccess(tx,results) { //Write some code here. } function errorCB(err) { alert("Error in SQL: " + err); } The problem is I

phonegap background service in iOS5

戏子无情 提交于 2020-01-29 21:49:25
问题 I am writing update checker program in xcode, my program needs background process( it needs to be run in background), so is it possible in phonegap, and is there any phonegap plugin for background services? Thanks 回答1: iOS does not allow background task to run more than a specific time limit. Similar Post: iPhone background task stops running at some point Explanation: http://www.macworld.com/article/1164616/how_ios_multitasking_really_works.html The reasonable solution would be to implement

phonegap background service in iOS5

a 夏天 提交于 2020-01-29 21:48:09
问题 I am writing update checker program in xcode, my program needs background process( it needs to be run in background), so is it possible in phonegap, and is there any phonegap plugin for background services? Thanks 回答1: iOS does not allow background task to run more than a specific time limit. Similar Post: iPhone background task stops running at some point Explanation: http://www.macworld.com/article/1164616/how_ios_multitasking_really_works.html The reasonable solution would be to implement

How to get IMEI in ionic2 on an android device

吃可爱长大的小学妹 提交于 2020-01-29 20:26:18
问题 I am trying to obtain the imei of an android device in ionic 2, but so far no luck. In ionic 1 l just used an ngCordova plugin like cordova-uid https://github.com/hygieiasoft/cordova-plugin-uid. Is there a plugin for ionic-native that I can use to obtain the imei or is there any other way to get the imei. 回答1: Can use this code. cordova plugin add org.hygieiasoft.cordova.uid Or cordova plugin add https://github.com/hygieiasoft/cordova-plugin-uid For test use console.log declare var cordova: