Recent Posts

Site Creator

Notification Demo in Android Marshmallow : Part 1

Posted on

Dear Friends

So we are planning to develop an android project in which whenever a user reaches to a place near a GEOFence object we already created , our android application will throw a notification to user.
This notification will be visible in User notification Bar.

User can touch this notification and can enter into the application. We will keep our discussion narrow so that we don’t fall into analysis paralysis. For more information on other blogs or material please visit android section of my blogs. Definitely you will find something of use.

So as you might have heard when we develop an android application we develop in separate modules. First module in the series would be Notification . The best way to learn android programming is to develop a simple demo android application to check a functionality. Later on when we will have a good hold over the subject we can use this functionality in our existing application.

Notification Demo for android

Please have a look at below service class

* For beginner I would like to tell a service is a component of android application that remains alive even if activity that started it has got vanished. ( Right now you need to know this only )for more details regarding services you can have a look at my blog Link would be updated soon.

So when this service is started . it starts an Asynctask (link to be updated) which offloads the task to a different thread , and frees the UI Thread (link to be updated) to do some cooler things.

Please pay attention to below code to show notification

So now you know notification can be raised as per your requirements.

This notification will be raised in a loop that iterates every 5 sec. Also when you tap on notification you or user will again reach to the Main Screen of application.

Code Example : AndroidNotificationsDemo

if you have query regarding the blog , please share your query in Google form

Happy coding! Meet you soon.

Disclaimer: The aforesaid writeup by Relsell Global writer is for the general understanding of the readers. It does not render any professional advice or opinion.