Load new posts

Today I made the Load new posts button work. See the way the main screen of my app looks below.

Open board, Open moodle and Homework buttons are working like they did before and now the Load new posts button is working as well. You can type in time in the space above. I also adapted the keyboard so it shows only numbers. Using this button I have checked if the code is working properly.

After typing in time you can click on the Load new posts button and, depending on the entered time, an alert dialog saying either «Updates» or «No updates» appears. For example, in my database there are two posts with post_time 143615 and 1569316135. Post_time column is highlighted in blue in the screenshot below.

If the entered time is greater that or equal to 1569316135 this is what the screen looks like after pressing button.

Otherwise it looks like in the picture below.

I have reached this stage using BackgroundWorker and load.php file on the server. See the code below.

My first version of the code didn’t work so I had to debug it for quite a while. Finally, I realised that there were some mistakes in the php file. I had put the wrong type of inverted commas so it was impossible to get any information from the database. It was also important to add android:usesCleartextTraffic=»true» to the AndroidManifest otherwise it didn’t work.

Next steps to be made:

  1. To make push-notifications.
  2. To think about my matura paper structure.
  3. To make the Marks button work.

Оставьте комментарий