I am new to gear, We are using gear in our web application were flow
is ...
When ever user assign with some task user will get message attached
with static html file, In that html we are showing work assign to user
in html form once user submit we are creating local database and
saving data to local database, But the problem is we are not
getting google.gears Object ...
function init() {
var success = false;
if (window.google && google.gears) {
try {
db = google.gears.factory.create('beta.database');
if (db) {
db.open('local');
db.execute('create table if not exists user (name varchar
(100), user_req_desc varchar(100), status varchar(100), timestamp
int)');
} catch (ex) {
setError('Could not create database: ' + ex.message);
}
}
if (!window.google || !google.gears) {
if(confirm("Gears is not installed. Do you want to install Gears
now ?")) {
location.href = "http://gears.google.com/?action=install";
}
}
google.gears object is coming null
gear is already installed in my system.
The above code is working in goole chrome, mean it's finding the google.gear object in chrome.
Any Help Appreciated ...
I am sorry the problem was I am not including gears_init.js, but than also it was working with google chrome ...
After including the gears_init.js file it's working fine ...
Related
My app (html/JS with Cordova/Phonegap) gets push from the OneSignal system, everything works fine.
I send each time a small variable (additionalData) so that once the notification has been clicked my app opens and a specific action is done. This variabla is stocked into a sessionStorage var so it can be used everywhere i want on my app.
In my index.js, in onDeviceready i have :
var notificationOpenedCallback = function(jsonData) {
sessionStorage.setItem('pushToLoad', JSON.stringify(jsonData.notification.payload.additionalData.ADDITIONALVAR));
};
window.plugins.OneSignal
.startInit("USER CODE")
.handleNotificationOpened(notificationOpenedCallback)
.endInit();
Then, in a file called function.js I simply analyze the variable and I do my actions according to its value.
Like:
if(sessionStorage.getItem('pushToLoad') == 'blabla') { do stuff }
On Android, everything works fine ! But on iOS my var is empty/null, i don't know why, ive tryed a lot of piece of code and nothing works.
alert('Push var > ' + sessionStorage.getItem('pushToLoad'));
It returns me "null" on iOS.
Thanks for you help.
Please tell me the way to implement in-app-purchase using Cordova plugin.
I'm developing Android application using Cordova.
There are some in-app-purchase plugins but I decide to use Cordova Purchase Plugin.
I did some setups along README.md of In-App Purchase for PhoneGap / Cordova iOS and Android.
As a result, I could call the Plugin using Demo of the Purchase Plugin for Cordova with my little modification. (See the following, it is a portion of code.)
app.initStore = function() {
if (!window.store) {
log('Store not available');
return;
}
// Enable maximum logging level
store.verbosity = store.DEBUG;
// Enable remote receipt validation
// store.validator = "https://api.fovea.cc:1982/check-purchase";
// Inform the store of your products
log('registerProducts');
store.register({
id: 'myProductA',
alias: 'myProductA',
type: store.CONSUMABLE
});
// When any product gets updated, refresh the HTML.
store.when("product").updated(function (p) {
console.info("app.renderIAP is called");
app.renderIAP(p);
});
// Log all errors
store.error(function(error) {
log('ERROR ' + error.code + ': ' + error.message);
});
// When purchase of an extra life is approved,
// deliver it... by displaying logs in the console.
store.when("myProductA").approved(function (order) {
log("You got a ProductA");
order.finish();
});
// When the store is ready (i.e. all products are loaded and in their "final"
// state), we hide the "loading" indicator.
//
// Note that the "ready" function will be called immediately if the store
// is already ready.
store.ready(function() {
var el = document.getElementById("loading-indicator");
console.info(el + "ready is called")
if (el)
el.style.display = 'none';
});
// When store is ready, activate the "refresh" button;
store.ready(function() {
var el = document.getElementById('refresh-button');
console.info(el + "ready is called and refresh-button show?");
if (el) {
el.style.display = 'block';
el.onclick = function(ev) {
store.refresh();
};
}
});
// Refresh the store.
//
// This will contact the server to check all registered products
// validity and ownership status.
//
// It's fine to do this only at application startup, as it could be
// pretty expensive.
log('refresh');
store.refresh();
};
It did not show 'Store not available' that is shown when plugin is not available, show 'registerProducts', and 'refresh.'
(*Of course I added 'myProductA' to in-app Products on Google Play Developer Console.)
But I noticed that the below function is not called.
store.when("product").updated(function (p)
And also I couldn't understand what the parameter should fill in it, so I commented out the below.
(*I did remove the comment out, but it still not working.)
store.validator = "https://api.fovea.cc:1982/check-purchase";
I guess those things make something wrong.
I'm not sure what is stack on me, so my question is not clearly.
I want some clues to solve it... or I shouldn't implement in-app-purchase using Cordova plugin?
Please give me your hand.
(I'm not fluent in English, so I'm sorry for any confusion.)
You can try this plugin as an alternative: https://github.com/AlexDisler/cordova-plugin-inapppurchase
Here's an example of loading products and making a purchase:
inAppPurchase
.buy('com.yourapp.consumable_prod1')
.then(function (data) {
// ...then mark it as consumed:
return inAppPurchase.consume(data.productType, data.receipt, data.signature);
})
.then(function () {
console.log('product was successfully consumed!');
})
.catch(function (err) {
console.log(err);
});
It supports both Android and iOS.
Step for Integrate In-App billing in Phone-gap app.
1>> clone this project in your pc from this link In-App billing Library
2>> using CMD go to your root directory of your phonegap application
3>> then run this command cordova plugin add /path/to/your/cloned project --variable BILLING_KEY="QWINMERR..........RIGR"
Notes : for BILLING_KEY go to Developer console then open your application and go to Service& APIs for more info Please refer attached screenshots
I've built a Chrome Extension that takes a selection of text and when I right click and choose the context menu item, it sends that text to my Meteor app. This works fine, however, I can't figure out the process of using Oauth to authenticate users.
I'm using this package: https://github.com/eddflrs/meteor-ddp
Here is the JS within background.js (for Chrome Extension):
var ddp = new MeteorDdp("ws://localhost:3000/websocket");
ddp.connect().then(function() {
ddp.subscribe("textSnippets");
chrome.runtime.onMessage.addListener(function(message) {
ddp.call('transferSnippet', ['snippetContent', 'tag', snippetString]);
});
});
Here is the relevant portion of my other JS file within my Chrome Extension:
function genericOnClick(info) {
snippetString = [];
snippetString.push(info.selectionText);
var snippetTag = prompt('tag this thing')
snippetString.push(snippetTag);
chrome.runtime.sendMessage(snippetString);
}
And here is the relevant portion of my Meteor app:
'transferSnippet': function(field1, field2, value1, value2) {
var quickObject = {};
quickObject.field1 = value1[0];
quickObject.field2 = value1[1];
TextSnippets.insert({
snippetContent: value1[0],
tag: value1[1]
});
}
Basically I'm stuck and don't know how to go about making a DDP call that will talk to my Meteor app in order to authenticate a user
This question is a bit old, but if anyone is still looking for a solution. I had a similar problem that I was able to solve using the following plugin: https://github.com/mondora/asteroid. Here is an example of how to do it for twitter oauth:
https://github.com/mondora/asteroid/issues/41#issuecomment-72334353
I am now writing a new tab page replacement for Chrome 33.
While I am using chrome.management.getAll() to get app list, I found a strange thing.
Here is my code:
document.addEventListener('DOMContentLoaded', function () {
...
chrome.management.getAll(getAllApps);
...});
function getAllApps(data) {
...
console.log("Installed App Count:" + data.length);
for (var i = data.length - 1; i >= 0; i--) {
console.log("Found App: " + data[i].name + " type:" + data[i].type);
if (data[i].type == 'theme' ||
data[i].type == 'extension' ) {
continue;
};
...
}
}
The output never lists Chrome Store.
But if I use chrome.management.get(), I could get the record of Chrome Store by its id.
Is there anything wrong in my code? Or is the Store is intended to be hidden?
Thank you. It is my first question here, so if there is any inappropriate words in my question, please forgive me.
The Store app is a component extension. Those extensions are built in to Chrome, not installed. As you can see from the documentation, getAll() returns only the user's installed extensions.
Your best bet is to hardcode the list of extensions that appear in a brand-new profile, which will consist only of component items (unless you're on a machine you don't control). Over time that list will diverge from the canonical list in the source code.
Both chrome.management.get() and chrome.management.getAll() show information about apps/extensions/themes installed on local computer, not information from Chrome Web Store.
I built a basic phone app using HTML5 and JavaScript (including JQTouch), and then used PhoneGap to turn it into an Android app (after many traumas - seems that PhoneGap and Windows computers don't get along too well).
The app works well in Chrome, but on an Android emulator the following error shows up in LogCat:
06-07 21:38:51.711: DEBUG/WebCore(204): Console: ReferenceError: Can't find variable: openDatabase line: 9 source: file:///android_asset/www/handicap.js
This refers to the following line in handicap.js:
db = openDatabase('Handicaps', '1.0', 'Handicaps', 65536);
The wider context of this piece of code is:
// initialise all important functions
$(document).ready(function(){
$('#newrace form').submit(saveRace);
$('#newrace form').submit(setTitle);
$('#enterhandicaps form').submit(savePrediction);
$('#enterhandicaps form').submit(refreshEntries);
$('#calcraces').click(raceList);
// create database to hold data on predicted and actual times
db = openDatabase('Handicaps', '1.0', 'Handicaps', 65536);
db.transaction(
function(transaction) {
transaction.executeSql(
'CREATE TABLE IF NOT EXISTS predictions (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,racename TEXT NOT NULL, runner TEXT NOT NULL, prediction INTEGER, start TEXT, finish TEXT, position TEXT);'
);
transaction.executeSql(
'CREATE TABLE IF NOT EXISTS races (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,racename TEXT NOT NULL, date TEXT, distance REAL);'
);
transaction.executeSql(
'CREATE TABLE IF NOT EXISTS autocompletion (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,runner TEXT NOT NULL, value TEXT,racename TEXT NOT NULL);'
);
}
);
}
);
On looking at other people having similar problems on stackoverflow, I've tried the suggestion of using only Android versions below 2.2 but that has not helped. Any other suggestions?
Could be something very obvious that I've missed, as I'm completely new to this.
The complete code for the app in web browser form is at https://github.com/fhr/Handicap-timer-app if that helps.
Can you share your app code in the app format with all the references to phonegap.js and so on ? Also I do not see your code using the window object. As per the phonegap apis the correct way to use the openDatabase() is var db = window.openDatabase(). Also, it would help if you could also mention the version of pg that you are using.
well i think its trying to open the file "file:///android_asset/www/handicap.js"
as opposed to where a db normally is //data/data//database/dbfile (normally no extension)
please post more code
i think its the opendatabase that your using.
Override onExceededDatabaseQuota method in your WebChromeClient Object.
#Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier,
long currentQuota, long estimatedSize, long totalUsedQuota,
WebStorage.QuotaUpdater quotaUpdater) {
Log.d("test", "onExceededDatabaseQuota : " + " currentQuota=" + currentQuota
+ " estimatedSize=" + estimatedSize + " totalUsedQuota=" + totalUsedQuota);
quotaUpdater.updateQuota(estimatedSize * 2);
}