android


Alarm Manager - triggers after every 2 hours


I have following piece of code which gets called once. However notification gets triggered after every 2 hours where as I want it to get triggered after 2 days. I tried all options, but still its not working
public int setAlarm(){
Calendar Calendar_Object = Calendar.getInstance();
/*
Calendar_Object.set(Calendar.MONTH,6);
Calendar_Object.set(Calendar.YEAR, 2013);
Calendar_Object.set(Calendar.DAY_OF_MONTH, 18);*/
// MyView is my current Activity, and AlarmReceiver is the
// BoradCastReceiver
Intent myIntent = new Intent(Splash.this, TimeAlarm.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this,
0, myIntent, PendingIntent.FLAG_CANCEL_CURRENT);
long wkupTime = Calendar_Object.getTimeInMillis() + 36000;
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
// Log.w("alarm set for " , Calendar_Object.getTime().toString ());
/*
* The following sets the Alarm in the specific time by getting the long
* value of the alarm date time which is in calendar object by calling
* the getTimeInMillis(). Since Alarm supports only long value , we're
* using this method.
*/
// alarmManager.setRepeating(AlarmManager.RTC, Calendar_Object.getTimeInMillis(),1000 *24*3600,
// pendingIntent);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, wkupTime , 172800000, pendingIntent);
return 0;
public int setAlarm() {
Calendar Calendar_Object = Calendar.getInstance();
Intent myIntent = new Intent(Splash.this, TimeAlarm.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this,
0, myIntent, PendingIntent.FLAG_CANCEL_CURRENT);
long wkupTime = Calendar_Object.getTimeInMillis() + 72000;
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, wkupTime ,7200000, pendingIntent);
return 0;
}

Related Links

Glide with GlidePalette not accepting center crop
android sqlite - table data cannot be updated
“NFC tag type not supported” message
How to make cardview show only bottom shadow
How to load an image to an imageView if a radio button is selected [closed]
How to set temporary directory when building cyanogenmod
Specified Android native API level 'android-8' is not supported by your NDK/toolchain
Android Date picker dialog to select next 10 year date only
Android, setText and setTypeface don´t work
How to deliver assets for Material Design motion design
Android notification icon colour sometimes white, sometimes colourful
Can I use gradle:2.2.0-alpha2 with build-tools 24.0.0 rc4 ?
NPE error in Android Studio
How to set/get the ID of the file just uploaded to Google Drive from my Android app?
Getting Android TextView to Scroll with ExpandableTextView
Android Error:(65) No resource identifier found for attribute 'marginBottom' and 'marginTop' in package 'android'

Categories

HOME
phantom-dsl
oracle12c
fuelux
merge
apache-jena
google-spreadsheet
formal-languages
rsa
requirements
pclxl
vscode-extensions
static-site
yandex
cakephp-3.4
parameters
hugo
code-coverage
endeca
heap
resultset
speech-synthesis
gkturnbasedmatch
heat
azure-powershell
alpacajs
mapstruct
undertow
jquery-ias
ios10.2
roundup
draft-js-plugins
dapper-extensions
itunes
google-cloud-print
beautifier
pylons
winpe
simplecv
android-sugarorm
joomla2.5
installscript
video-capture
password-protection
chef-solo
news
setup.py
mcustomscrollbar
azure-arm
android-ibeacon
berkeley-db-je
vaadin-charts
netbeans6.8
vugen
tf
openblas
lightning
scalding
boxing
filehandle
microstation
centrifuge
segment-io
uicolor
android-dateutils
android-wake-lock
lua-telegram-bot
themoviedb-api
viola-jones
google-refine
git-ftp
mraid
mmwormhole
openbabel
execve
primitive-types
cocos3d
teaspoon
ignite-ui
lambda-architecture
jjaql
authlogic
file-not-found
git-repo
android-usb
bin
visual-studio-express
ie8-compatibility-mode
model-driven-development
inappsettingskit
pagedown
wp7test
booksleeve
curb
zope.interface
correlated-subquery
jquery-tools
diagrams
squishit
google-wave
change-management
pbcopy

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App