Found 1626 Articles for Android

How to schedule local notifications in Android?

Smita Kapse
Updated on 30-Jul-2019 22:30:26

2K+ Views

This example demonstrate about How to schedule local notification in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Add the following code to res/menu/main_menu.xml.             Step 4 − Add the following code to src/MainActivity.package app.tutorialspoint.com.notifyme ; import android.app.AlarmManager ; import android.app.Notification ; import android.app.NotificationManager ; import android.app.PendingIntent ; import android.content.Context ; import android.content.Intent ; import android.os.Bundle ; import android.os.SystemClock ; import android.support.v4.app.NotificationCompat ; import android.support.v7.app.AppCompatActivity ... Read More

How to Schedule Notification in Android?

Anvi Jain
Updated on 30-Jul-2019 22:30:26

631 Views

This example demonstrate about How to schedule notification in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Add the following code to res/menu/main_menu.xml.             Step 4 − Add the following code to src/MainActivity.package app.tutorialspoint.com.notifyme ; import android.app.AlarmManager ; import android.app.Notification ; import android.app.NotificationManager ; import android.app.PendingIntent ; import android.content.Context ; import android.content.Intent ; import android.os.Bundle ; import android.os.SystemClock ; import android.support.v4.app.NotificationCompat ; import android.support.v7.app.AppCompatActivity ; ... Read More

How to start an Android activity when use clicks on Notification?

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

229 Views

This example demonstrate about How to start an Android activity when use clicks on NotificationStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.package app.tutorialspoint.com.notifyme ; import android.app.NotificationChannel ; import android.app.NotificationManager ; import android.app.PendingIntent ; import android.content.Intent ; import android.os.Bundle ; import android.support.v4.app.NotificationCompat ; import android.support.v7.app.AppCompatActivity ; import android.view.View ; import android.widget.Button ; public class MainActivity extends AppCompatActivity {    public static final String ... Read More

How to add button to notifications in android?

Smita Kapse
Updated on 30-Jul-2019 22:30:26

2K+ Views

This example demonstrate about How to add button to notifications in androidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.package app.tutorialspoint.com.notifyme ; import android.app.NotificationChannel ; import android.app.NotificationManager ; import android.app.PendingIntent ; import android.content.Intent ; import android.os.Bundle ; import android.support.v4.app.NotificationCompat ; import android.support.v7.app.AppCompatActivity ; import android.view.View ; import android.widget.Button ; public class MainActivity extends AppCompatActivity {    public static final String NOTIFICATION_CHANNEL_ID = "10001" ... Read More

How to detect a new Android notification?

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

3K+ Views

This example demonstrate about How to detect a new Android notificationStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to src/MyListener.javapublic interface MyListener {    void setValue (String packageName) ; }Step 3 − Add the following code to src/MyListener.javapackage app.tutorialspoint.com.notifyme ; import android.content.Context ; import android.service.notification.NotificationListenerService ; import android.service.notification.StatusBarNotification ; import android.util.Log ; public class NotificationService extends NotificationListenerService {    private String TAG = this .getClass().getSimpleName() ;    Context context ;    static MyListener myListener ;    @Override ... Read More

How can I intercept the Status Bar Notifications in Android?

Anvi Jain
Updated on 30-Jul-2019 22:30:26

918 Views

This example demonstrate about How can I intercept the Status Bar Notifications in AndroidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to src/MyListener.javapublic interface MyListener {    void setValue (String packageName) ; }Step 3 − Add the following code to src/MyListener.javapackage app.tutorialspoint.com.notifyme ; import android.content.Context ; import android.service.notification.NotificationListenerService ; import android.service.notification.StatusBarNotification ; import android.util.Log ; public class NotificationService extends NotificationListenerService {    private String TAG = this .getClass().getSimpleName() ;    Context context ;    static MyListener ... Read More

How to read all the coming notifications in android?

Anvi Jain
Updated on 30-Jul-2019 22:30:26

5K+ Views

This example demonstrate about How to read all the coming notifications in androidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to src/MyListener.javapublic interface MyListener {    void setValue (String packageName) ; }Step 3 − Add the following code to src/MyListener.javapackage app.tutorialspoint.com.notifyme ; import android.content.Context ; import android.service.notification.NotificationListenerService ; import android.service.notification.StatusBarNotification ; import android.util.Log ; public class NotificationService extends NotificationListenerService {    private String TAG = this .getClass().getSimpleName() ;    Context context ;    static MyListener myListener ... Read More

How to remove the notification after the particular time in android?

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

755 Views

This example demonstrate about How to remove the notification after the particular time in androidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.notifyme ; import android.app.NotificationChannel ; import android.app.NotificationManager ; import android.app.PendingIntent ; import android.content.Context ; import android.content.Intent ; import android.os.Handler ; import android.support.v4.app.NotificationCompat ; import android.support.v7.app.AppCompatActivity ; import android.os.Bundle ; import android.view.View ; import android.widget.Button ; public class MainActivity extends AppCompatActivity ... Read More

How to clear an Android notification after a few seconds?

Smita Kapse
Updated on 30-Jul-2019 22:30:26

674 Views

This example demonstrate about How to clear an Android notification after a few seconds.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.notifyme ; import android.app.NotificationChannel ; import android.app.NotificationManager ; import android.app.PendingIntent ; import android.content.Context ; import android.content.Intent ; import android.os.Handler ; import android.support.v4.app.NotificationCompat ; import android.support.v7.app.AppCompatActivity ; import android.os.Bundle ; import android.view.View ; import android.widget.Button ; public class MainActivity extends AppCompatActivity {   ... Read More

How to create notifications that do not go away when clicked in Android?

Anvi Jain
Updated on 30-Jul-2019 22:30:26

122 Views

This example demonstrate about How to start an activity when user clicks a notification in AndroidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.javapackage app.tutorialspoint.com.notifyme ; import android.app.NotificationChannel ; import android.app.NotificationManager ; import android.app.PendingIntent ; import android.content.Context ; import android.content.Intent ; import android.support.v4.app.NotificationCompat ; import android.support.v7.app.AppCompatActivity ; import android.os.Bundle ; import android.view.View ; import android.widget.Button ; public class MainActivity extends AppCompatActivity {   ... Read More

Advertisements