Nativescript how to make http requests in the backgroundHow do save an Android Activity state using save instance state?How do I center text horizontally and vertically in a TextView?Why is the Android emulator so slow? How can we speed up the Android emulator?How do I make links in a TextView clickable?Make an HTTP request with androidHow do I fix android.os.NetworkOnMainThreadException?How to make a background 20% transparent on AndroidIntegrate Android Service on NativeScript AppAndroid 8.0: java.lang.IllegalStateException: Not allowed to start service Intent
How much cash can I safely carry into the USA and avoid civil forfeiture?
How come there are so many candidates for the 2020 Democratic party presidential nomination?
Which big number is bigger?
Why does nature favour the Laplacian?
Extension of 2-adic valuation to the real numbers
How did Captain America manage to do this?
What makes accurate emulation of old systems a difficult task?
What does ゆーか mean?
Phrase for the opposite of "foolproof"
Don’t seats that recline flat defeat the purpose of having seatbelts?
Why do games have consumables?
Is there really no use for MD5 anymore?
How to write a column outside the braces in a matrix?
Can SQL Server create collisions in system generated constraint names?
Implications of cigar-shaped bodies having rings?
Aliens crash on Earth and go into stasis to wait for technology to fix their ship
Is it idiomatic to construct against `this`
Can an Area of Effect spell cast outside a Prismatic Wall extend inside it?
bldc motor, esc and battery draw, nominal vs peak
How to denote matrix elements succinctly?
How could Tony Stark make this in Endgame?
How to limit Drive Letters Windows assigns to new removable USB drives
Function pointer with named arguments?
a sore throat vs a strep throat vs strep throat
Nativescript how to make http requests in the background
How do save an Android Activity state using save instance state?How do I center text horizontally and vertically in a TextView?Why is the Android emulator so slow? How can we speed up the Android emulator?How do I make links in a TextView clickable?Make an HTTP request with androidHow do I fix android.os.NetworkOnMainThreadException?How to make a background 20% transparent on AndroidIntegrate Android Service on NativeScript AppAndroid 8.0: java.lang.IllegalStateException: Not allowed to start service Intent
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
hi as I would like to be able to run some code when the app is closed
(for closed I mean closed by the task manager).
my app must be able to make http requests via axios in the background on both android and ios (must send notifications using the local-notification plugin that reminds that one or more events in an external calendar will start in an hour), I searched in network and I saw the documentation but it is not clear how I should do, I also read that the way to run background code on android 8 changes radically.
Can someone explain to me what I have to do? what permissions should I request from the system? or if there is any example of code on the net.
android axios nativescript nativescript-vue vue-nativescript
add a comment |
hi as I would like to be able to run some code when the app is closed
(for closed I mean closed by the task manager).
my app must be able to make http requests via axios in the background on both android and ios (must send notifications using the local-notification plugin that reminds that one or more events in an external calendar will start in an hour), I searched in network and I saw the documentation but it is not clear how I should do, I also read that the way to run background code on android 8 changes radically.
Can someone explain to me what I have to do? what permissions should I request from the system? or if there is any example of code on the net.
android axios nativescript nativescript-vue vue-nativescript
add a comment |
hi as I would like to be able to run some code when the app is closed
(for closed I mean closed by the task manager).
my app must be able to make http requests via axios in the background on both android and ios (must send notifications using the local-notification plugin that reminds that one or more events in an external calendar will start in an hour), I searched in network and I saw the documentation but it is not clear how I should do, I also read that the way to run background code on android 8 changes radically.
Can someone explain to me what I have to do? what permissions should I request from the system? or if there is any example of code on the net.
android axios nativescript nativescript-vue vue-nativescript
hi as I would like to be able to run some code when the app is closed
(for closed I mean closed by the task manager).
my app must be able to make http requests via axios in the background on both android and ios (must send notifications using the local-notification plugin that reminds that one or more events in an external calendar will start in an hour), I searched in network and I saw the documentation but it is not clear how I should do, I also read that the way to run background code on android 8 changes radically.
Can someone explain to me what I have to do? what permissions should I request from the system? or if there is any example of code on the net.
android axios nativescript nativescript-vue vue-nativescript
android axios nativescript nativescript-vue vue-nativescript
edited Mar 9 at 9:30
Christopher Civitale
asked Mar 9 at 9:06
Christopher CivitaleChristopher Civitale
12
12
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Okay you should use a service in android.It's a simple class makes it happen in the background and after you're done you can stop the service.It works for android up to 26 api.(26 not included)
https://developer.android.com/guide/components/services
for 26 and higher you can use Managers there's a downloadManager already:
https://developer.android.com/reference/android/app/DownloadManager
You don't have to use it,you can also make yours in a Job Scheduler (above lollipop)
There's a nice tutorial about it here:
https://android.jlelse.eu/schedule-tasks-and-jobs-intelligently-in-android-e0b0d9201777
Using Android Background Services in NativeScript:
https://www.nativescript.org/blog/using-android-background-services-in-nativescript
Hi, this tutorial work on NativeScript Apps ?
– Christopher Civitale
Mar 9 at 9:37
@ChristopherCivitale No it's for android I added a new link for nativeScript at the end right now.
– steve moretz
Mar 9 at 9:42
hello I saw the documentation but it is not clear to me one thing. The example uses the tap event to start running in the background, how do I start the background service automatically without having to press the button?
– Christopher Civitale
Mar 9 at 15:01
You don't have to use a button.Start it whenever you want.on the start of the app.On server reply.On push notification.The limit is your imaginations.
– steve moretz
Mar 9 at 20:47
add a comment |
Here are the samples for implementing background services for iOS & Android.
There is also a plugin nativescript-background-fetch which might work for you.
tns plugin add nativescript-background-fetch
Invokes your callback function roughly every 15 mins while the app is not alive, so you could finish your background activities like downloading your content etc.,
Hi, yes, this is what I was looking for. But I have a problem, I installed the plugin but when the amount using import BackgroundFetch from "nativescript-background-fetch" gives me this error: Cannot read property 'CompletitionHandler' of undefined
– Christopher Civitale
Mar 11 at 8:45
Is it a runtime exception or compile one?
– Manoj
Mar 11 at 8:49
runtime java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:
– Christopher Civitale
Mar 11 at 8:54
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55075710%2fnativescript-how-to-make-http-requests-in-the-background%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Okay you should use a service in android.It's a simple class makes it happen in the background and after you're done you can stop the service.It works for android up to 26 api.(26 not included)
https://developer.android.com/guide/components/services
for 26 and higher you can use Managers there's a downloadManager already:
https://developer.android.com/reference/android/app/DownloadManager
You don't have to use it,you can also make yours in a Job Scheduler (above lollipop)
There's a nice tutorial about it here:
https://android.jlelse.eu/schedule-tasks-and-jobs-intelligently-in-android-e0b0d9201777
Using Android Background Services in NativeScript:
https://www.nativescript.org/blog/using-android-background-services-in-nativescript
Hi, this tutorial work on NativeScript Apps ?
– Christopher Civitale
Mar 9 at 9:37
@ChristopherCivitale No it's for android I added a new link for nativeScript at the end right now.
– steve moretz
Mar 9 at 9:42
hello I saw the documentation but it is not clear to me one thing. The example uses the tap event to start running in the background, how do I start the background service automatically without having to press the button?
– Christopher Civitale
Mar 9 at 15:01
You don't have to use a button.Start it whenever you want.on the start of the app.On server reply.On push notification.The limit is your imaginations.
– steve moretz
Mar 9 at 20:47
add a comment |
Okay you should use a service in android.It's a simple class makes it happen in the background and after you're done you can stop the service.It works for android up to 26 api.(26 not included)
https://developer.android.com/guide/components/services
for 26 and higher you can use Managers there's a downloadManager already:
https://developer.android.com/reference/android/app/DownloadManager
You don't have to use it,you can also make yours in a Job Scheduler (above lollipop)
There's a nice tutorial about it here:
https://android.jlelse.eu/schedule-tasks-and-jobs-intelligently-in-android-e0b0d9201777
Using Android Background Services in NativeScript:
https://www.nativescript.org/blog/using-android-background-services-in-nativescript
Hi, this tutorial work on NativeScript Apps ?
– Christopher Civitale
Mar 9 at 9:37
@ChristopherCivitale No it's for android I added a new link for nativeScript at the end right now.
– steve moretz
Mar 9 at 9:42
hello I saw the documentation but it is not clear to me one thing. The example uses the tap event to start running in the background, how do I start the background service automatically without having to press the button?
– Christopher Civitale
Mar 9 at 15:01
You don't have to use a button.Start it whenever you want.on the start of the app.On server reply.On push notification.The limit is your imaginations.
– steve moretz
Mar 9 at 20:47
add a comment |
Okay you should use a service in android.It's a simple class makes it happen in the background and after you're done you can stop the service.It works for android up to 26 api.(26 not included)
https://developer.android.com/guide/components/services
for 26 and higher you can use Managers there's a downloadManager already:
https://developer.android.com/reference/android/app/DownloadManager
You don't have to use it,you can also make yours in a Job Scheduler (above lollipop)
There's a nice tutorial about it here:
https://android.jlelse.eu/schedule-tasks-and-jobs-intelligently-in-android-e0b0d9201777
Using Android Background Services in NativeScript:
https://www.nativescript.org/blog/using-android-background-services-in-nativescript
Okay you should use a service in android.It's a simple class makes it happen in the background and after you're done you can stop the service.It works for android up to 26 api.(26 not included)
https://developer.android.com/guide/components/services
for 26 and higher you can use Managers there's a downloadManager already:
https://developer.android.com/reference/android/app/DownloadManager
You don't have to use it,you can also make yours in a Job Scheduler (above lollipop)
There's a nice tutorial about it here:
https://android.jlelse.eu/schedule-tasks-and-jobs-intelligently-in-android-e0b0d9201777
Using Android Background Services in NativeScript:
https://www.nativescript.org/blog/using-android-background-services-in-nativescript
edited Mar 9 at 9:43
answered Mar 9 at 9:26
steve moretzsteve moretz
605112
605112
Hi, this tutorial work on NativeScript Apps ?
– Christopher Civitale
Mar 9 at 9:37
@ChristopherCivitale No it's for android I added a new link for nativeScript at the end right now.
– steve moretz
Mar 9 at 9:42
hello I saw the documentation but it is not clear to me one thing. The example uses the tap event to start running in the background, how do I start the background service automatically without having to press the button?
– Christopher Civitale
Mar 9 at 15:01
You don't have to use a button.Start it whenever you want.on the start of the app.On server reply.On push notification.The limit is your imaginations.
– steve moretz
Mar 9 at 20:47
add a comment |
Hi, this tutorial work on NativeScript Apps ?
– Christopher Civitale
Mar 9 at 9:37
@ChristopherCivitale No it's for android I added a new link for nativeScript at the end right now.
– steve moretz
Mar 9 at 9:42
hello I saw the documentation but it is not clear to me one thing. The example uses the tap event to start running in the background, how do I start the background service automatically without having to press the button?
– Christopher Civitale
Mar 9 at 15:01
You don't have to use a button.Start it whenever you want.on the start of the app.On server reply.On push notification.The limit is your imaginations.
– steve moretz
Mar 9 at 20:47
Hi, this tutorial work on NativeScript Apps ?
– Christopher Civitale
Mar 9 at 9:37
Hi, this tutorial work on NativeScript Apps ?
– Christopher Civitale
Mar 9 at 9:37
@ChristopherCivitale No it's for android I added a new link for nativeScript at the end right now.
– steve moretz
Mar 9 at 9:42
@ChristopherCivitale No it's for android I added a new link for nativeScript at the end right now.
– steve moretz
Mar 9 at 9:42
hello I saw the documentation but it is not clear to me one thing. The example uses the tap event to start running in the background, how do I start the background service automatically without having to press the button?
– Christopher Civitale
Mar 9 at 15:01
hello I saw the documentation but it is not clear to me one thing. The example uses the tap event to start running in the background, how do I start the background service automatically without having to press the button?
– Christopher Civitale
Mar 9 at 15:01
You don't have to use a button.Start it whenever you want.on the start of the app.On server reply.On push notification.The limit is your imaginations.
– steve moretz
Mar 9 at 20:47
You don't have to use a button.Start it whenever you want.on the start of the app.On server reply.On push notification.The limit is your imaginations.
– steve moretz
Mar 9 at 20:47
add a comment |
Here are the samples for implementing background services for iOS & Android.
There is also a plugin nativescript-background-fetch which might work for you.
tns plugin add nativescript-background-fetch
Invokes your callback function roughly every 15 mins while the app is not alive, so you could finish your background activities like downloading your content etc.,
Hi, yes, this is what I was looking for. But I have a problem, I installed the plugin but when the amount using import BackgroundFetch from "nativescript-background-fetch" gives me this error: Cannot read property 'CompletitionHandler' of undefined
– Christopher Civitale
Mar 11 at 8:45
Is it a runtime exception or compile one?
– Manoj
Mar 11 at 8:49
runtime java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:
– Christopher Civitale
Mar 11 at 8:54
add a comment |
Here are the samples for implementing background services for iOS & Android.
There is also a plugin nativescript-background-fetch which might work for you.
tns plugin add nativescript-background-fetch
Invokes your callback function roughly every 15 mins while the app is not alive, so you could finish your background activities like downloading your content etc.,
Hi, yes, this is what I was looking for. But I have a problem, I installed the plugin but when the amount using import BackgroundFetch from "nativescript-background-fetch" gives me this error: Cannot read property 'CompletitionHandler' of undefined
– Christopher Civitale
Mar 11 at 8:45
Is it a runtime exception or compile one?
– Manoj
Mar 11 at 8:49
runtime java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:
– Christopher Civitale
Mar 11 at 8:54
add a comment |
Here are the samples for implementing background services for iOS & Android.
There is also a plugin nativescript-background-fetch which might work for you.
tns plugin add nativescript-background-fetch
Invokes your callback function roughly every 15 mins while the app is not alive, so you could finish your background activities like downloading your content etc.,
Here are the samples for implementing background services for iOS & Android.
There is also a plugin nativescript-background-fetch which might work for you.
tns plugin add nativescript-background-fetch
Invokes your callback function roughly every 15 mins while the app is not alive, so you could finish your background activities like downloading your content etc.,
answered Mar 9 at 13:32
ManojManoj
8,45921024
8,45921024
Hi, yes, this is what I was looking for. But I have a problem, I installed the plugin but when the amount using import BackgroundFetch from "nativescript-background-fetch" gives me this error: Cannot read property 'CompletitionHandler' of undefined
– Christopher Civitale
Mar 11 at 8:45
Is it a runtime exception or compile one?
– Manoj
Mar 11 at 8:49
runtime java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:
– Christopher Civitale
Mar 11 at 8:54
add a comment |
Hi, yes, this is what I was looking for. But I have a problem, I installed the plugin but when the amount using import BackgroundFetch from "nativescript-background-fetch" gives me this error: Cannot read property 'CompletitionHandler' of undefined
– Christopher Civitale
Mar 11 at 8:45
Is it a runtime exception or compile one?
– Manoj
Mar 11 at 8:49
runtime java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:
– Christopher Civitale
Mar 11 at 8:54
Hi, yes, this is what I was looking for. But I have a problem, I installed the plugin but when the amount using import BackgroundFetch from "nativescript-background-fetch" gives me this error: Cannot read property 'CompletitionHandler' of undefined
– Christopher Civitale
Mar 11 at 8:45
Hi, yes, this is what I was looking for. But I have a problem, I installed the plugin but when the amount using import BackgroundFetch from "nativescript-background-fetch" gives me this error: Cannot read property 'CompletitionHandler' of undefined
– Christopher Civitale
Mar 11 at 8:45
Is it a runtime exception or compile one?
– Manoj
Mar 11 at 8:49
Is it a runtime exception or compile one?
– Manoj
Mar 11 at 8:49
runtime java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:
– Christopher Civitale
Mar 11 at 8:54
runtime java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:
– Christopher Civitale
Mar 11 at 8:54
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55075710%2fnativescript-how-to-make-http-requests-in-the-background%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown