Weekend 1 (An Android app )

Hello guys, I know it has being a long time since i wrote a blogpost or a story (more than 3 years). But i am trying to start writing about the stuff i am doing these days.

Today’s story is about a small app i made last weekend.

First of all, every app has a “why”. And for this case it’s that in order to receive the announcements from the Computer Department at Ege University you always have to check the website ( bilmuh.ege.edu.tr ) and see if there is anything new there. Which is a thing i never remembered to do and I always end up missing something there. So the app is made to solve this for me (and maybe other students who suffer the same thing ).

The general idea of the app is like the following. First it parses the html page of the website (There is no api to do this in an appropriate way). Jsoup library made this really easy for us . All what i had to do is :

Elements elements = document.select(".article");
for (Element element : elements) {
String title = element.select(".node-title").text();
String content = element.select(".field-item > p").html();
String date = element.select(".date-display-single").text();

The code above is doing the following :

Populate these items to your RecyclerView.Adapter and you have your announcements ready.

The second part of the app is for sending me a notification whenever there is a new announcement.

To do this, i made a service that run every 10 minutes and check the first announcement at the website (the same code above just without a loop) and compare it with a SharedReference i stored it in my last update for the RecyclerView.

SharedPreferences sharedPref = getApplicationContext().getSharedPreferences(getApplicationContext().getResources().getString(R.string.last_post), Context.MODE_PRIVATE);

String last_stored_title = sharedPref.getString(getApplicationContext().getResources().getString(R.string.last_post), "");

if (!last_stored_title.equals(title) && !title.equals("")) {
.putString(getApplicationContext().getResources().getString(R.string.last_post), last_title)
return true;

And if thee result is true, send a notification to the user with the new announcement

Intent resultIntent = new Intent(getApplicationContext(), PostActivity.class);
resultIntent.putExtra("title", mTitle);
resultIntent.putExtra("date", mDate);
resultIntent.putExtra("content", mContent);

PendingIntent pendingIntent = PendingIntent.getActivity(

NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(getApplicationContext())

// Sets an ID for the notification
int mNotificationId = 1;
// Gets an instance of the NotificationManager service
NotificationManager mNotifyMgr =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
// Builds the notification and issues it.
mNotifyMgr.notify(mNotificationId, mBuilder.build());

This is in general how the app is working. I hope you enjoyed reading it. And if you have any questions i would be happy to answer.

See you the next app ;)



Full Stack Developer| Loading…

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store