alarmmanager

Android Running SQL statement in background

北城以北 提交于 2019-12-11 22:13:48
问题 I am having some trouble with Alarm manager in Android. What I've encountered is when I set the alarm to repeat for every single minute, it works: mgr.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 60000, pi); However, when I try to set it to run the notification once per day, it does not work: mgr.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pi); This is the part where I execute the Alarm manager. This method

File Cleaning Service

北城余情 提交于 2019-12-11 19:57:51
问题 As a requirement in Android OS phone, I am developing an app which will clean up a particular folder in a specified interval of time, say every 30 minutes. I can run a service and clean up the folder every 30 mins. I have few questions over this, 1.Service has onStartCommand, which will be executed when the service starts, can I call a function here which has a Handler which runs every 30 minutes? Example public int onStartCommand(Intent intent, int flags, int startId){ cleanUpData(); return

How to set an AlarmManager for preselected days?

谁说胖子不能爱 提交于 2019-12-11 19:46:27
问题 I'm creating an alarm widget, and it works, however, I'm currently using it for a single day, I'd like to know how to define it for predefined days, let's say for example I want to setup the alarman for monday, wednesday and friday, how can I accomplish that? Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, dPicker.getYear()); cal.set(Calendar.MONTH, dPicker.getMonth()); cal.set(Calendar.HOUR_OF_DAY, tPicker.getCurrentHour()); cal.set(Calendar.MINUTE, tPicker.getCurrentMinute());

Android alarm not cancelling

笑着哭i 提交于 2019-12-11 19:33:39
问题 I am in the main activity. There is a Login button bLogin . When it is pressed, a Logout button is displayed bLogout . The onClick methods for the two buttons are as follows: bLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { llLogin.setVisibility(View.GONE); llLogout.setVisibility(View.VISIBLE); PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 327, new Intent(getApplicationContext(), AlarmReceiver.class),

onReceive() method not opening application while device is in sleep mode..?

房东的猫 提交于 2019-12-11 18:56:10
问题 Hi friends i have a problem... Actually i use this code to open my application in certain time..the app is working fine but when the device is in sleep mode not working..?? public class MyBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context ctx, Intent intent) { Intent intent = new Intent(ctx, ActivityMain.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); ctx.startActivity(intent); } } ActivityMain.java

My AlarmManager not getting called

為{幸葍}努か 提交于 2019-12-11 18:28:50
问题 I try every code which I got from Stackoverflow or from anywhere, but not getting success in AlarmManager , my BroadcastReceiver not even getting called. Here is my code: //My AlarmManager is in MyDB.Class extends SQLiteOpenHelper{ System.out.println("Inside AlarmManager"); // Create alarm manager AlarmManager alarmMgr0 = (AlarmManager) mContext .getSystemService(Context.ALARM_SERVICE); System.out.println("Inside alarmMgr0 " + alarmMgr0); // Create pending intent & register it to your alarm

Time scheduling by using alarm manager

≡放荡痞女 提交于 2019-12-11 18:15:03
问题 I have a AutoUpdate service class, oncreate()- I create the log file in externalsdcard onStartCOmmand()- UpdateTask= new UpdateTask(this,AutoUpdate.logwriter) I have a UpdateTask class which extends thread class- in this class in run method I write all the data in the log file by creating a local HTTP context and at the end I put Thread.sleep(3000). Right now I get data in the log file for every 3 seconds but I want to change the time limit to 15 min I have the BootReceiver class extends

Schedule an alarm on device reboot automatically in android

戏子无情 提交于 2019-12-11 16:43:20
问题 I am trying to build an application which checks for notification files on a server, every hour. I used the alarm manager class to implement this. But I am unable to implement the automatic start on reboot part. I want that the alarm should run periodically after reboot. Can some one please tell me how to go about doing it. This is my MyAlarmReceiver Class. package com.example.quickstart; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent;

android alarm app using timepicker to select time and intents

房东的猫 提交于 2019-12-11 14:57:55
问题 can anyone help me with a normal alarm clock app that uses TimePicker to set the time ..and also uses intents,etc instead of normal comparisons.This is the code that i've done till now.But this is not working. The 'TimePicker' sets the time and on pressing the 'ToggleButton' a 'TextVew' shows that alarm is on .But when the alarmtime is reached,Alarm Ringing message is not shown.Please someone help me out. this is the code of main activity public class FullscreenActivity extends Activity

Android AlarmManager send notification every time app starts instead of only once

不打扰是莪最后的温柔 提交于 2019-12-11 14:03:23
问题 My app use an AlarmManager that start a BroadcastReceiver . The BroadcastReceiver generate a reminder notification to the user. This is the MainActivity that start the Alarm public class MainActivity extends ActionBarActivity { private PendingIntent pendingIntent; private AlarmManager alarmManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Set the alarm to start at approximately 2:00 p.m.