How to: use the CloudDB as a News Feed to inform members of your group

School :school: NEWS :newspaper: Reader/Editor

CloudNews is a CloudDB based news feed example for schools, sports organizations, clubs etc. (any group wanting to disseminate real time information). All who install the original apk to their Android devices can access the news feeds for their individual organizations.

The app has only a few controls.

The app illustrates two methods to save/retrieve news bites to the CloudDB. News bites are stored either under a Tag or as a List under a Tag. Tags are used to group News under various categories. The example has two news Tags, News and Breaking News. News is a Tag that contains a List of news bites (items in the List). Breaking News news is stored as a single text in the Tag.

Developers can add more categories (up to you) or use the example as is. Use a Tag for a single news article; use a Tag as a List for multiple news bites. The News is hard coded to use four news bites at a time in a List. How you disseminate your news articles is up to you. Need more news categories; add a new Tag and provide the appropriate code to enable the news feed and appropriate editor for the Tag. The example is designed with an editor associated with each Tag. The editors display on virtual screens and only appear when in use.

TextToSpeech is reads the news out loud on request. By default, settings are set for English tts in code using the Designer Properties. To make the feature pause while reading text, it is important that news bites contain periods ( . ). Periods force the TTS engine to pause occasionally while reading. Code is provided to stop the app from reading. A simple way to stop reading a news bite is to add a Button to call TextToSpeech1.Speak set to a blank Text message is the way it is done in the example.

News items are edited by anyone who has a password key (see below). Only those who have been provided the key can edit news content.

The password to access the editing capability in the example is hard coded (1234). The password is required to edit any of the categories (Tags). Change the required password for your production app or someone who read this will use 1234. Editing a feed provides a note at the top of the app that shows how recently the news was edited (circled in green on the controls image).

Non-editor users of the app can read all the news feeds. The news feeds update when a user runs the app. Users select a category to read the latest news posted by the editor(s).

How the MIT CloudDB component works is described in Storage .

Test the Example using two Android devices

To test the app, install the app on two Androids (or install it on one device and live develop using the aia and Companion on the other).

When the example aia is run for the first time, the CloudDB news bites are populated with sample text. Modify and replace the individual news bites by editing News and Breaking News.


Save the edited text results to the CloudDB using the Button Update News or Update Breaking News Tag contents. The News and Breaking News Tags each need to be updated. The news will update on both devices after an editor updates. Edit the Tags for both the List Tag and the other Tag separately.

Is this news reader secure? Anyone who has the app installed can read the traffic, only editors can post revised text.

How I Tested

The example was tested on a Samsung A10 Android 8.1 tablet and a Samsung A13 Android 12 cell phone. No special permissions are required. The the app uses the MIT default CloudDB server. Your own Redis database server should be used for commercial projects.

Expanding the News categories (Tags).

How you expand to more news classifications is up to you. Create a new Tag with text or a new Tag with a List. Make a copy of your app before you attempt to modify and add news feeds. You want to be able to back out if you make a mistake. Hint: mirror the existing Tags. Create an editor for each Tag. If you are very clever you can use only a single editor and switch the name of the Tag and content of the TextBox you use to change the item text. Easy? Not actually.

Requirements
The app needs either a WIFI or cell to connect to the internet.

I hope you find this advanced tutorial useful.
cloudNews5.aia (14.5 KB)

Regards,
Steve

3 Likes