Saturday, July 4, 2015

How To Add Notification On Your Android App Tutorial

How To Add Notification On Your Android App Tutorial


Today we all know how much far has android gone and it is the future of tomorrow.In today's world android app market is becoming big and more big day to day and that's the reason most of the young techies and programmer want's to build apps on android platform .And some of us face problem in How to add the notification part in your android app so don't worry friends that's the reason you are here so here is the the tutorial and code which will help you to add notification feature in your dream android app.So let's get started..........


What is Android Notification?
A notification is a message you can display to the user outside of your application's normal UI. When you tell the system to issue a notification, it first appears as an icon in the notification area. To see the details of the notification, the user opens the notification drawer. Both the notification area and the notification drawer are system-controlled areas that the user can view at any time.

What are we going to do?
Today, we will make an android notification and we will use an intent to respond to the user if the notification clicked.

1.

android notification tutorial
Notice the Notification (yeah bro)
2.
android notification tutorial
3.
android notification tutorial
responds when the notification clicked

activity_main.xml
?
1
2
3
4
5
<linearlayout android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
     
    <textview android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Look at the notification Window!" android:textsize="30sp">
</textview></linearlayout>
MainActivity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
NotifyActivity.java
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class NotifyActivity extends Activity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
     
    TextView txtdisplay=new TextView(this);
     
    txtdisplay.setText("Yeah you did it!");
    setContentView(txtdisplay);
  }
}
Strings.xml
?
1
2
3
4
<string name="message">hey you really great</string>
       
       <string name="noticeMe">Yeah bro!</string>
     <string name="title">you are excited, Yeah!</string>
Don't forget to add this in your Manifest before the :
?
1
<activity android:label="@string/app_name" android:name=".NotifyActivity"></activity>

Spark It Up

Posts You May Also Like

How To Add Notification On Your Android App Tutorial
4/ 5
Oleh

Subscribe via email

Love Our Post ? Suscribe and Get the Best Of them directly to your inbox.

thanks for commenting !!!