How to restart cordova application - angularjs

I use AngularJS and Cordova build app android.
I want have a button with action restart app.
How to restart this app?

Whatever you exactly want, you can have a look at this post which gives you a very simple answer:
location.reload();
As stated in the comments, it does not properly restart your application (meaning completely stop and then start it again) but it should do the trick most of the time.

Related

Can synchronised browser testing be achieved when the user script (Tampermonkey) is developed locally?

I am developing a user script (Tampermonkey) locally. When the local JS changes, I want to automatically refresh the target URL of the user script instead of a local HTML file.
How can this be achieved? I checked every command and configuration information, but did not find a solution, so I came to ask for help.
The method of developing UserScript locally is seen here. The answerer mentioned that browser-sync can be used, but I did not find a way to achieve it.
livereload can solve this problem very well, because livereload is implemented through browser extensions and local programs. When the file changes, the target URL can be refreshed immediately.
http://livereload.com/
https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei/related

CRA PWA Service Worker not refreshing

I have create-react-app app that uses its stock service worker to cache files.
I want the app to be a downloadable PWA but whenever I update (with heroku & node expressjs..) the users downloaded app never updates.. Even when I refresh (drag down from top).
Have I missed some configuration in the docs to enable the auto update when its a PWA?
or
What is something I can do to either force refresh when updated. (I have read that's bad UI but I'm fine with that)
Notes:
It works as expected when viewing from a browser on a PC. (updates when tabs are all closed)
I found the solution.
The problem wasn't refreshing the app. I had to permanently close it. by swiping up from the multitask view.
Leaving this here in case anyone else didn't realize

How to update location in ionic from background?

So in my app i need to send my location's coordinates every 5 minutes through web service, I need to send it when app is in background state also. I am using background-geolocation plugin. Anyone please help me to do that. Thanks in advance
The other way running prcocess in background is by using android core if you know that.
I was also facing the problem of running process in background. I have installed the background plugin too. But it did not work. Then i wrote a customized code in android.
Steps i followed.
1.) Stored the data in cordova prefrences.
2.) Fetch the data from prefrences in android core file( a java file).
3.) Written service in android that check the prefrences after every 2 minutes.
I know this is quiet tuff but this was the only solution i got in hybrid app.

Is there a way to live update app while writing angularjs?

I want to create an angularjs app but each time it requires to press the refresh button in the browser to get the update. thus it bring to this question:
Is there any way to get live update while writing angularjs app? So I don't need to press the refresh button each time I make changes in my angularjs app.
Yes, you can use grunt which is a task runner written in node, grunt has a plugin called grunt-contrib-livereload that reloads the page whenever there are changes in the files/directories that you want to watch. Alternatively, there's a scaffolding tool for client side web applications in AngularJS called yeoman, that has a generator called generator-angular - this generator has an opinionated structure towards AngularJS application development and it comes with a basic setup that you can use for livereloading code changes from any files that you have configured to watch.
Start using yeoman. It has grunt that will solve yr problem plus lots of more exciting stuff.
Check this quick start guide : http://yeoman.io/learning/
I use the open source editor Brackets.io by Adobe. Just click the lightning icon button to the right of the editor to run your web page and will auto refresh for every save.
You can do this in many ways. Many of the options are already mentioned in this post. All of them are workable. In my experience the most simplistic way to do this by the following way.No configuration , No setting , No need to code anything.
Just add this line in your <head> </head> tag of the html file
<script src="http://livejs.com/live.js"></script>

How to create tutorial when the first time open an app?

Some apps got tutorial when the first time open.It seems cool.
I'm trying to create an opening tutorial that consists of four panes for my AngularJs app.
I build my app with css3 and html5 ,use cordova to generate apk.
How to create tutorial for my app when the first time open it?
Is there any solution?
Thanks a lot!
Sorry maybe I didn't make myself clear.The app is almost done,and splash screen has done.
But I need few pages or images on the first time run.
Use database. For example if you use localStorage, inside the deviceready function
check=localStorage.getItem('first_time');
if(check.length<0)
{
startTutorial();
localStorage.setItem('first_time','NO it is old');
}
After the first run value will be changed and tutorial will be shown once.
You can use other databases like indexedDB or webSQL.

Resources