• Home
  • WP tuts
  • Blogger /blogspot
  • Digital Marketing
  • Hosting talk

RAaz Kumar .com

wordpress tutorials seo hosting etc

You are here: Home / Android syllabus Topics Course details / AlarmManager

AlarmManager

 

 

Alarm:

In Android, we perform all the future operations and recurring operations using Alarm.
Ex: To run a background service repeatedly with some interval, we use Alarm.

We have AlarmManager is the class in Android to work with Alarm.

Steps to create an Alarm:
1) Get Alarm manager object using the following code
AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
2) Create an Intent with the required component(service or broadcast)
Intent i = new Intent(MainActivity.this, AlarmReceiver.class);
//Here, AlarmReceiver is a BroadcastReceiver.
3) Create Pending Intent object from the above Intent
PendingIntent pi = PendingIntent.getBroadcast(MainActivity.this, 231, i, FLAG_UPDATE_CURRENT);
4) Set the alarm using alarm manager. Alarm can be set for one time or repeating with some interval.
long currentTime = System.currentTimeMillis();
long repeatingInterval = 60*1000; // 1 minute
am.setRepeating(RTC_WAKEUP, currentTime, repeatingInterval, pi);

Note: Refer https://developer.android.com for more on AlarmManager.

To cancel Alarm:

if(am!=null)
am.cancel(pi);

Create an Android application to work with AlarmManager

Refer the source from

 

 

 

 

 

 






Android syllabus Topics Course details

  • Options Menu
  • JSON parsing
  • Handling Views
  • RelativeLayout
  • ActionBar
  • ListView
  • Custom List View
  • Dialogs
  • AlarmManager
  • Notifications
  • Vibration
  • WebView
  • Fragments Runtime
  • SQLiteDatabase
  • Bluetooth
  • WiFi
  • Google Maps
  • Handling Activity Back Button
  • AsyncTask
  • Runtime Permissions
  • Logging
  • Activity Lifecycle
  • Toast
  • Service
  • Database with Cursor Adapter
  • SharedPreferences
  • Location
  • Libraries
  • Webservices
  • Creating Activity class
  • Creating XML
  • Registering Activity in AndroidManifest.xml:
  • Steps for creating an Android application:
  • Handling button clicks
  • Identifying Views
  • Getting Text from Views
  • intent with Data
  • Intent
  • Resources Handling in Android
  • Intent with Result Data
  • Broad cast Receiver
  • Fragment
  • Handling Button click by using On Click Listener:
  • Material Design
  • RecyclerView
  • JSON
  • Rename Android Package [with images 2018]

Connect WithMe

 

Twitter

Facebook

Youtube

 

PUBG Mobile Tips & Tricks