-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error BackgroundFetch.configure is not a function while using in Android App #9
Comments
I see I haven't provided an Your Environment
|
Hi Chris, here is the Environment info:
|
Change this: var BackgroundFetch = require("nativescript-background-fetch"); to this: import {BackgroundFetch} from "nativescript-background-fetch"; |
Changing to below line gives error "unexpected token {" (its a opening curly bracket after import) on load of that page and view is not rendered.
|
are you not using typescript? |
No. |
try this: var BackgroundFetch = require("nativescript-background-fetch").BackgroundFetch; |
Now, above errors are resolved but getting new error: TypeError: Cannot read property 'Builder' of undefined. |
I've created a new blank app (without typescript) and it works.
var Observable = require("data/observable").Observable;
var BackgroundFetch = require("nativescript-background-fetch").BackgroundFetch;
function getMessage(counter) {
if (counter <= 0) {
return "Hoorraaay! You unlocked the NativeScript clicker achievement!";
} else {
return counter + " taps left";
}
}
function createViewModel() {
var viewModel = new Observable();
viewModel.counter = 42;
viewModel.message = getMessage(viewModel.counter);
BackgroundFetch.configure({
minimumFetchInterval: 15
}, function() {
console.log('- NativeScript BackgroundFetch Received');
}, function() {
console.log('- NativeScript BackgroundFetch error');
});
viewModel.onTap = function() {
this.counter--;
this.set("message", getMessage(this.counter));
}
return viewModel;
}
exports.createViewModel = createViewModel; |
Hi, I am trying to use nativescript-background-fetch in Android App but it gives me error that BackgroundFetch.configure is not a function. I am using Javascript to develop android native app. My code in home-view-model.js is as below:
The text was updated successfully, but these errors were encountered: