TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sys track
NA
3
2.8k
Alaram manager not working when app is killed
Jan 10 2020 1:58 AM
boolean alarm = (PendingIntent.getBroadcast(
this
, 0,
new
Intent(
"ALARM"
), PendingIntent.FLAG_NO_CREATE) ==
null
);
if
(alarm) {
Intent itAlarm =
new
Intent(
"ALARM"
);
PendingIntent pendingIntent = PendingIntent.getBroadcast(
this
, 0, itAlarm, 0);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.SECOND, 3);
AlarmManager alarme = (AlarmManager) getSystemService(ALARM_SERVICE);
int
interval = 60000;
alarme.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), interval, pendingIntent);
}
else
{
Intent alarmIntent =
new
Intent(MainActivity.
this
, BroadcastManager.
class
);
alarmIntent.setAction(Intent.ACTION_MAIN);
alarmIntent.addCategory(Intent.CATEGORY_LAUNCHER);
PendingIntent pendingIntent = PendingIntent.getBroadcast(MainActivity.
this
, 0, alarmIntent, 0);
AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
int
interval = 60000;
manager.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), interval, pendingIntent);
}
br =
new
BroadcastManager();
IntentFilter filter =
new
IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
this
.registerReceiver(br, filter);
Reply
Answers (
1
)
Send Data To The Remote Database In Android Applications
how we can change the navigation drawer from user to user