indexedDB with CDWKWebViewEngine in PhoneGap Build cli-6.0.0 - javascript

I'm having trouble opening an indexedDB store when using CDWKWebViewEngine within an app build with PhoneGap Build 6 running on iOS 9.2. window.indexedDB is not null and appears to be of type IDBFactory but when I use the code below I get "InvalidAccessError" reported.
var request = window.indexedDB.open("MyTestDatabase", 1);
request.onerror = function (event) {
alert("Database error: " + request.error.name);
};
Has anyone been able to get indexedDB working in the environment I've described?

Related

microsoft speech recognition + nodejs

Is the nodejs cognitive services speech sdk still supported? I know how to do this for the browser based sdk, but it looks like the nodejs version doesn't work, it doesn't capture any microphone input.
Notably, there are no examples publish that use AudioConfig.fromDefaultMicrophoneInput for nodejs. The nodejs sdk works perfectly fine with AudioConfig.fromStreamInput
Here's the relevant code:
var speechsdk = require("microsoft-cognitiveservices-speech-sdk");
var subscriptionKey = ";)";
var serviceRegion = "eastus"; // e.g., "westus"
const speech_Config = speechsdk.SpeechConfig.fromSubscription(subscriptionKey, serviceRegion, "en-US");
const audioConfig = speechsdk.AudioConfig.fromDefaultMicrophoneInput();
let speech_recognizer= new speechsdk.SpeechRecognizer(speech_Config, audioConfig);
speech_recognizer.recognizeOnceAsync(
function (result) {
console.log(result);
speech_recognizer.close();
speech_recognizer = undefined;
},
function (err) {
console.trace("err - " + err);
speech_recognizer.close();
speech_recognizer = undefined;
});
I get an error saying: window is not defined
npm: https://www.npmjs.com/package/microsoft-cognitiveservices-speech-sdk
For this error , Microsoft engineers has an explain for it here .
It is due to the default microphone support uses the Web Audio API to
conjure a microphone stream. The node environment doesn't support
this.
As a workaround , for pure node code you can use a file, push or pull
stream to get audio into the speech recognition engine.
Hope it helps : )

Certain $http request not working on iOS Emulators or Devices (but fine on everything else)

hope you are well.
I am currently trying to call an API we have designed on a C# WebAPI which will call successfully on devices. However, on occasion, it will not call on the iOS Platform. This is how I have the calling of the API setup:
$scope.RunNews = function() {
console.log("Testing 123. I don't know!")
var app_url_news = APP_URL.getUrl() + '/api/news/getallnewsinfo';
$http.get(app_url_news).success(function(data) {
console.log("Successful Transfer. Data Below")
console.log(data);
angular.forEach(data.data, function(obj) {
console.log(obj);
if (obj.videoUrl) {
if (Validators.isValidYoutubeUrl(obj.videoUrl)) {
var youtubeVideoId = obj.videoUrl.split('v=')[1].split('&')[0];
obj.videoUrl = 'http://www.youtube.com/embed/' + youtubeVideoId + '?html5=1&rel=0&hl=en_US&version=3';
}
obj.isVideo = true;
} else {
obj.imagePath = APP_URL.getUrl() + '/NewsImages/files/' + obj.imagePath;
obj.isVideo = MediaType.isVideo(obj.imagePath);
}
});
$scope.newsList = data.data;
$ionicLoading.hide();
});
}
}
Currently, this function calls on the ionic serve web browsing emulator and android devices... HOWEVER, on iOS, the $http is never called. I have noticed that this is apparent for multiple $http calls but for others, they work fine.
I'm here to ask if anyone has experienced this issue and has a fix for it? I believe it may have something to do with permissions but I cannot seem to find anything in my project.
I had a similar problem. GET requests couldn't be made on iOS devices but were working in the browser. I fixed the issue by installing cordova-plugin-whitelist. To use it, you must have Cordova version 4.0 or greater.
If the problem persists, you should debug the app for any logs in console and check the request's response and request headers. These will help you pin down what the problem is.

Accessing WebSQL Database object in PhoneGap

I am trying to access WebSQL database results using PhoneGap Developer App, but I cannot seem to access the object correctly. Here is an example piece of code:
db.transaction(function(tx) {
tx.executeSql('SELECT * FROM ' + table, [],
function (transaction, resultSet) {
console.log(resultSet.rows);
}, function (transaction, error) {
console.log(error);
});
});
This block works perfectly fine in Chrome while testing the PhoneGap app via the PhoneGap CLI. It returns the object in the console and the CLI says [object SQLResultSetRowList]. I can then access a specific row by calling:
console.log(resultSet.rows.item(0));
This works fine in both the desktop CLI and developer app. What I want to do though, is to iterate through the results using jQuery $.each:
$.each(resultSet.rows, function (k,v) {
console.log(JSON.stringify(v));
});
This is where I encounter a problem. In Desktop Chrome and using the CLI, each row is correctly printed to the console as a JSON string of key => value pairs. But when I try to run the exact same code using the PhoneGap Developer App on my testing device, the console instead only prints the following:
"100" which is the "length" key of the result set, and an empty output (the corresponding key being "item").
What is the correct way to iterate through the resultSet object? For reference, I am using an iPhone X on iOS 11 as my testing device.
I ended up working around this issue by building an object from scratch using the resultSet data:
function getIterableObjectFromResult(resultSet) {
for (var i = 0, data = {}; i < resultSet.rows.length; i++) {
data[i] = resultSet.rows.item(i);
}
return data;
}
The resulting output can then be iterated correctly in the PhoneGap Developer app.

Trouble during passing extension data along with session request in QuickBlox

I am working on a project which provides video calling from web to phone (iOS or Android). I am using QuickBlox + WebRTC to implement video calling. From web I want to pass some additional info along with call request like caller name, etc. I looked into the JavaScript documentation of QuickBlox + WebRTC which suggest to use the following code (JavaScript):
var array = {
me: "Hari Gangadharan",
}
QB.webrtc.call(callee.id, 'video', array);
I have implemented the same code but unable to get the info attached with session request on the receiver side (getting nil reference in iOS method).
- (void)didReceiveNewSession:(QBRTCSession *)session userInfo:(NSDictionary *)userInfo {
//Here userInfo is always nil
}
Please use the following structure
var array = {
"userInfo": {
"me":"Hari Gangadharan",
}
}
because our iOS SDK uses "userInfo" as a key for parsing custom user info
Check Signaling v1.0

PhoneGap iOS + DOM Exception 18

I'm going a window.onerror "SECURITY_ERR: DOM Exception 18: An attempt was made to break through the security policy of the user agent." Each time I load my iOS PhoneGap app. THe app uses local storage and webSQL. I have isolated this error to be throw when I open my db using: db = window.openDatabase("db", "1.0", "Test DB", 1000000);
I haven't had this issue before and my code hasn't changed - this just came out of now where. I've been looking at the iOS 5.1 web view storage bugs and fear it may be related.
Help?
It's a confirmed Apple bug in iOS 5.1. Details here in this PhoneGap/Cordova issue tracker: https://issues.apache.org/jira/browse/CB-347
I have used this and It is working perfectly.Try this
try {
if (!window.openDatabase) {
alert('not supported');
} else {
var shortName = 'WineDatabase';
var version = '1.0';
var displayName = 'PhoneGap Test Database';
var maxSize = 655367; // in bytes
mydb = openDatabase(shortName, version, displayName, maxSize);
}
} catch(e) {
// Error handling code goes here.
if (e == INVALID_STATE_ERR) {
// Version number mismatch.
alert("Invalid database version.");
} else {
alert("Unknown error "+e+".");
}
return;
}
EDIT:
At that time I was using Phonegap on ios.So I hadn't get it,Now on blackberry phonegap I am getting same issue and and found the cause that: while datacable is plugged app is not able to write anything on SDCard.So I unplugged it and run working fine.Sorry buddy not the solution for ios But people who are searching this issue for blackberry can use this solution.

Categories

Resources