I'm writing a app in ionic. The app relies on external api's.
I've made multiple functions to test the connection, to my own server, and my own server handles the api calls. My own server is needed for this because of ip-whitelistening.
All works well, but now i want to disable the application if the result from my own server is false. I make a call to test the connection everytime the app starts.
What is the best way to handle this with angular/ionic?
1 thought i had myself is to redirect to a landingpage, if no connection is available.
Any tips are welcome.
Yes, basically what you planned to do is OK.
So, just after your app loads up, check if the connection is available (you can read more about how to do that in my detailed post How to check network information change with Ionic framework), and if not then you can change the state to some page where it would clearly let the user know that "Currently the link to the server is not working" (or some better notification).
Also, probably you would want to put a refresh button on that page, so that one could click it and the whole availability process would be checked again (basically same as if someone restarted your app).
Hope this helps.
Related
I am creating a complex social networking website that is all one single page that never refreshes unless a user presses the refresh button on the browser.
The issue here is that when I edit files and upload them to the server they don't take effect unless the user refreshes the browser.
How would I go about and fix this problem? Should I do a time interval of browser refreshes? Or should I poll the server every 10 minutes to check if the browser should do a refresh?
Any suggestions?
Server
I would communicate the version number through whatever means you're already using for data transfer. Presumably that's some kind of API, but it may be sockets or whatever else.
Whatever the case, I would recommend that with each response - a tidy way is in the header, as suggested in comments by Kevin B - you transmit the current application version.
Client
It is then up to the client to handle changes to the version number supplied. It will know from initial load and more recent requests what the version number has been up until this point. You might want to consider different behaviour depending on what the change in version is.
For example, if it is a patch number change, you might want to present to the user the option of reloading, like Outlook.com does. A feature change might do the same with a different message advertising the fact that new functionality is available, and a major version change may just disable the site and tell the user to reload to regain access.
You'll notice that I've skated around automatic reloading. This is definitely not a technical issue so much as a UX one. Having a SPA reload with no warning (which may well result in data loss) is not the best and I'd advise against it, especially for patch version changes.
Edit
Of course, if you're not using any kind of API or other means of dynamically communicating data with the server, you will have to resort to polling an endpoint that will give you a version and then handle it on the client in the same way. Polling isn't super tidy, but it's certainly better - in my strong opinion - than reloading on a timer on the offchance that the application has updated in the interim.
Are you talking about changing the client side code of the app or the content? You can have the client call the server for updated content using AJAX requests, one possibility would be whenever the user changes states in the app or opens a page that loads a particular controller. If you are talking about changing the html or javascript, I believe the user would need to reload to get those updates.
Situation
I'm building a little chat using Symfony2. I'm wondering if there are possibilities to make the chat usable in offline mode. I'm not expecting to actively chat with connected user. I'm planning to make the user able to write message in offline mode (in the metro for instance), and then send it when connection is back again. Important: I would like to compute in the fact that connection can be gone for a long time. I remember beeing with people working in the Eurostar (Paris - London) and using their computers/phone while in a submarine tunnel for an hour or so. There was no connection at all. So in this case, how can you store a message for such a long time before sending it?
Problem
I found some interesting tutorial defining the HTML 5 offline mode. They define the capabilities of this offline mode with sending message but doesn't give example. Moreover, it seems that the only stuff we can put in the manifest are static files (css, javascript, html, pictures...)
My question is then, how do you store the written message from the user after she/he pressed the "send" button and is offline? Is it a javascript variable? Or is there html 5 features that exist?
Cheers!
You can do this via HTML5 local storage:
http://www.redrobotzoo.com/posts/html5-local-storage-and-local-databases-tutorial/
This example has very nice examples so it should not be a problem for you to make it work.
I am hoping for some help regarding an offline iPad application.
I have a form within the app that the user fills in, this form then links to a PHP script online. Obviously you can't run the script until you are on line. Is there any way at all of clicking the form submit button, if there is a connection it will connect to and run the PHP and if there is no connection it will automatically run the php in the background when a connection becomes available.
I have tried a number of different searches but have still been unsuccessful.
Thank you in advance!
It most likely is possible to solve this problem with JavaScript, but that's not so straightforward. Since you are dealing with an iOS app where it is possible to check network connection status and listen for changes, you probably should create a service that receives the form data within your app. That service should store the data locally, find out when your target server is accessible and send it.
UPDATE:
If you are dealing with a web-app, the way to go for it still to implement a service in JavaScript that uses timed events (i.e. setTimeout() or setInterval()) to check connection status. Upon submitting the form, prevent the default behaviour so the form is not submitted traditionally. Instead, store the data locally in sessionStorage or localStorage and when your service finds the target server available, read the locally stored data and send it via AJAX.
I need to get some spam messages from a set of gmail inboxes and post them to a server.
My initial idea was to write a chrome extension, which when installed would be activated every time the user visited its inbox, but I couldn't do it that way, since there is no access to spam messages (just unread ones through a XML file).
Then I discovered google APP script and succesfully wrote the script I needed.. but the problem is, how can I use that script for other accounts? At the moment a user needs a lot of configuration to make it work (script has to be shared, user has to install google app script, set a trigger for the function).
IS there a user friendly way to make this work? Even in other ways? I have no access to inbox passwords though.
Thanks in advace.
You should design a User Interface, deploy your app as a webApp with parameter 'run as user executing the app' and add the trigger creation in the script itself.
All this should not be too hard...
Feel free to ask for assistance if you meet some issue.
In this case don't forget to post your code if you want useful tips.
I've been toying with writing a web app using jquery mobile which makes use of forms (cehckboxes, text fields, combo boxes). The tasks the app requires are fairly trivial but the information needs to be updated and sent to a server.
So my question is, say someone uses the app, gets a bunch of data from a server, then loses connection. Will the browser still remember the form fields input and could the user still navigate between pages? From my understanding jquery mobile places all its pages in the same 'webpage' so it's not like it will have to be constantly loading up new data from the server.
My idea is that I'll run some script in the background to check for a connection to a server and when it gets this connection it can go ahead and sync data with the server.
Is this possible or is it a pipe dream?
for jquery mobile it append all the data it had in same page so user can use only those links which are already clicked for the links that user have not touch yet will create problem