Last Phase – The Android App – Starting 3rd July 2017

Monday – 3rd July 2017. First things first.I need to get the environment built. I have a Cordova installation on my Mac from TM352 so I will be using that. I have used Cordova to build a 470Router project. I have also signed up for a “Projects in Phonegap” course which is a video course that shows how to build apps using lots of available add-ons. (PhoneGap is now Cordova).

My first task is to lay out my thoughts of the pages on paper before getting tied up in the code. Getting some good progress on the log in page. I have now arranged a backup of the code on Dropbox.

Finishing at 15.43. I have some drawn outlines. I have amended the index.html to display as I want the first page to look and am now trying to attach a JavaScript click to the login button. That is for another day.

Tuesday – 4th July 2017. Spent today playing around with text entry boxes. I just wanted to have, say, “User Name” aligned alongside the entry box on the same line. Nope, I couldn’t do it without an understanding of jQuery that is way beyond me. I went back to mu Udemy course and found out how to use a nice text box that has the prompt built in. Next step is to use the button to access the user info via REST. That is for Thursday (I have  Wednesdays off when working to a normal timetable).

Thursday – 6th July 2017. Struggled a bit with getting the JavaScript app to work. Finally, I got the } brackets in the right place and, at the end of a hard two hours, I got an alert from JavaScript showing that it had got hold of the userName and password from the login. That was enough for me. Saturday, I will access the database and get a logo, etc. I need to find out how to parse JSON, though.

Saturday – 8th July 2017. Another struggle. This time with:

“No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed access.”

It seems that Google Chrome won’t allow access out of the localhost if the page has come from a local file. I spent about an hour trying to sort this out – trying different browsers -executing code in the terminal that was supposed to launch Chrome without this restriction. Finally, I found an extension to Chrome which has sorted the problem. Yet again, web sites like Stackoverflow.com were worse than useless because, although they were (supposedly) explaining and giving solutions, these answers were opaque at the best of times and generally so full of jargon as to be unusable, certainly for the likes of me.

Anyway, I got it sorted and now I can extract the menu page from the web server within the Android app. I only need this to a) confirm the user name and b) to extract the user’s railroad name and the railroad logo url. Doing this is the task for tomorrow. Once that is done, I can construct a menu that will give access to all of the data (minimal views) and to process trains.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s