Hi!
i'm not sure if this is te correct board but here is a BIG problem with an application that i'm developing for android.
I want to take the data from a DatePicker and TimePicker to set an AlarmManager entry to senda system notification.
Code:
Calendar cal=Calendar.getInstance();
cal.set(Calendar.DAY_OF_MONTH, datePicker.getDayOfMonth());
cal.set(Calendar.MONTH, datePicker.getMonth());
cal.set(Calendar.YEAR, datePicker.getYear());
cal.set(Calendar.HOUR, timePicker.getCurrentHour());
cal.set(Calendar.MINUTE, timePicker.getCurrentMinute());
long millis=cal.getTimeInMillis();
Intent intent=new Intent(CalendarView.this,AvisoReceiver.class);
PendingIntent mAlarmSender=PendingIntent.getBroadcast(CalendarView.this,23454546, intent,0);
AlarmManager alm=(AlarmManager)getSystemService(ALARM_SERVICE);
alm.set(AlarmManager.RTC_WAKEUP, millis,mAlarmSender);
The problem is that i'm not getting notifications, so , my receiver isn't being invocated, but when i set the alarm 3 seconds after i get my notification .
rafuru said:
Hi!
i'm not sure if this is te correct board but here is a BIG problem with an application that i'm developing for android.
I want to take the data from a DatePicker and TimePicker to set an AlarmManager entry to senda system notification.
Code:
Calendar cal=Calendar.getInstance();
cal.set(Calendar.DAY_OF_MONTH, datePicker.getDayOfMonth());
cal.set(Calendar.MONTH, datePicker.getMonth());
cal.set(Calendar.YEAR, datePicker.getYear());
cal.set(Calendar.HOUR, timePicker.getCurrentHour());
cal.set(Calendar.MINUTE, timePicker.getCurrentMinute());
long millis=cal.getTimeInMillis();
Intent intent=new Intent(CalendarView.this,AvisoReceiver.class);
PendingIntent mAlarmSender=PendingIntent.getBroadcast(CalendarView.this,23454546, intent,0);
AlarmManager alm=(AlarmManager)getSystemService(ALARM_SERVICE);
alm.set(AlarmManager.RTC_WAKEUP, millis,mAlarmSender);
The problem is that i'm not getting notifications, so , my receiver isn't being invocated, but when i set the alarm 3 seconds after i get my notification .
Click to expand...
Click to collapse
Have you recorded any logs at the alarm time too see if the callback is giving any errors.
Pvy
Related
Just recently noticed that my calendar music notifications aren't triggering, the alert shows but the tone i selected doesn't play
anyone?
I've logged a call with HTC as I''m still running stock ROM but thought someone here would have a few ideas..
mtrax said:
anyone?
I've logged a call with HTC as I''m still running stock ROM but thought someone here would have a few ideas..
Click to expand...
Click to collapse
I created a test event can copied the system log
Can any one compare with a working phone.
D/AlertReceiver( 323): beginStartingService
D/AlertService( 323): allDay:false instanceBegin=1282114948000 minutes=5 alarmTime=1282114648000
D/BT HS/HF( 146): gsmAsuToSignal=19
D/dalvikvm( 323): GC freed 7567 objects / 442728 bytes in 107ms
D/AlertService( 323): >>>>>>> makeNewAlertNotification <<<<<<<
D/AlertService( 323): >>>>>>> eventId:296 <<<<<<<
D/AlertService( 323): >>>>>>> title:Hello <<<<<<<
I/AlertService( 323): get calendarId:5
I/AlertService( 323): Type:0 Vibrate:true Ringtone:content://media/internal/audio/media/23 <<< New Setting
D/NotificationFlashLightUtility getIncomingCall( 323): load success~~~~~~~~~~
V/AlertService( 323): changeNotificationSound: false
V/AlertService( 323): notification.sound != null: null
V/AlertService( 323): reminderType: 0
I/ActivityManager( 80): Starting activity: Intent { flg=0x10000000 cmp=com.htc.calendar/.AlertActivity }
Click to expand...
Click to collapse
Hi there pal!
I've got the same problem, my notifications don't show up in a notification bar ... any reminding whatsoever ...
I'm running stock rom as well ... if you figure out more I'd be glad for more info.
The think is, I'm just new to the android platform, so I can't really think of anything
latorante said:
Hi there pal!
I've got the same problem, my notifications don't show up in a notification bar ... any reminding whatsoever ...
I'm running stock rom as well ... if you figure out more I'd be glad for more info.
The think is, I'm just new to the android platform, so I can't really think of anything
Click to expand...
Click to collapse
yours might be a different problem as I see the notifications but it doesn't play the ringtone.
I extracted the syslog using the following App ( http://www.appbrain.com/app/org.jtb.alogcat) you might try using this immediately after you expect your calendar alarm.. to see what message show..
Tell you what, I've done some research on my Legend and it seems, that all calendrs work except the facebook one - the birthday notifications. And thats the one I was interested in...
I'll try the program you posted ...
cheers
Can someone run a quick test for me please?
Set a ringtone on a Calender alert
1. Open the Calendar application.
2. Press Menu then More then Settings.
3. Tap on Reminder settings.
4. Make sure that there is a tick mark on “All calendars.”
5. Tap on Set alerts & notifications and select Alert.
6. Tap on Select ringtone and tap the ring tone that you prefer.
Then set a calender event and when it triggers the ringtone should play.
If could send me the snippet of the system log so I can compare with mine,
thanks
I got a working one:
/AudioHardwareMSM72XX( 57): AUDIO_START: start kernel pcm_out driver.
D/AlertReceiver(12956): beginStartingService
D/AlertService(12956): allDay:false instanceBegin=1282455968000 minutes=5 alarmTime=1282455668000
D/AlertService(12956): >>>>>>> makeNewAlertNotification <<<<<<<
D/AlertService(12956): >>>>>>> eventId:721 <<<<<<<
D/AlertService(12956): >>>>>>> title:Test <<<<<<<
I/AlertService(12956): get calendarId:1
I/AlertService(12956): Type:0 Vibrate:true Ringtone:content://media/internal/audio/media/49 <<< New Setting
D/NotificationFlashLightUtility getIncomingCall(12956): load fail~~~~~~~~~~
V/AlertService(12956): changeNotificationSound: false
V/AlertService(12956): notification.sound != null: content://media/internal/audio/media/49
V/AlertService(12956): reminderType: 0
I/ActivityManager( 79): Starting activity: Intent { flg=0x10000000 cmp=com.htc.calendar/.AlertActivity }
D/MediaPlayer( 79): setDataSource(291, 0, 576460752303423487) pid = 79
D/PVPlayer( 57): setDataSource(31, 0, 11183)
I/AlertActivity(12956): mCursor.count: 1
I/PlayerDriver( 57): OpenCore enable firewall payload
I/ ( 57): OpenCore codec name PVMFOMXAudioDecNode , OMX.PV.mp3dec
W/MediaPlayer( 79): info/warning (1, 44)
I/AudioPolicyService( 57): startOutput(): before lock
W/NotificationService( 79): Notification sound delayed by 1211msecs
I/ActivityManager( 79): Displayed activity com.htc.calendar/.AlertActivity: 1401 ms (total 1401 ms)
I/AudioPolicyService( 57): stopOutput(): before lock
D/BT HS/HF_S( 153): gsmAsuToSignal=5
Click to expand...
Click to collapse
my log seems to vary slightly yours has:
V/AlertService(12956): notification.sound != null: content://media/internal/audio/media/49
where as mine has:
V/AlertService( 323): notification.sound != null: null
I'm developing a simple android application using the TabActivity.
This Activity adds 3 tabs, each one with its own activity.
The problem is: when I tap each tab, the system calls onDestroy of the current activity. So, when I tap the first activity again, all the state of private fields are gone, its like it has created a new instance every time I change tabs.
I was searching around about this, and looking on the samples, but I guess that the default behavior is to keep the activity instances paused when the tab is not current.
Anyone have an idea of what I'm missing?
Thanks.
That is by design. You need to override onSaveInstanceState() and onRestoreInstanceState() in your activity class. You can store/retrieve state data there, or retrieve it int the Bundle passed into OnCreate(). See:
http://developer.android.com/reference/android/app/Activity.html#onCreate(android.os.Bundle)
I saw a lot of ppl having this problem and it's something SO common to do, and the solutions I saw were ugly to the point that I bet that Google's solution for it isn't any of those.
Simple scenario, I have a few dialogues in my application being setup inside:
Code:
protected Dialog onCreateDialog(int id) {
switch(id){
case DIALOG_LOAD: return new ProgressDialog... etc.. etc..
}
}
and called with
Code:
showDialog(DIALOG_LOAD);
and dismissed with
Code:
dismissDialog(DIALOG_LOAD);
all inside the activity class.
This approach to dialogues I believe is the 'cleanest' way of doing it and just let the Activity manages the dialogues.
it works fines IF I don't rotate the device, I though because the activity was managing it, it would be all inclusive, but no, life is never that simple. If I rotate the phone when the dialogue is up, the rotation occurs, the dialogue is still visible but the moment the code try to dismiss it it gives a nice:
05-26 20:07:02.951: ERROR/AndroidRuntime(10041): java.lang.IllegalArgumentException: no dialog with id 1 was ever shown via Activity#showDialog
so...
do I have to care about dismissing and re-creating the dialogue onPause and onResume or is there anything I can do to make the activity take care of it by itself?
I have multiple widgets provided by one app, and thus multiple classes that extend AppWidgetProvider. The idea is that every widget contains a Button, which starts a Service when pressed. This Service runs a bit of code and then stops. Now for the problem: for example, I have a Widget1a and a Widget1u. These widgets look like each other, but each widget does a slightly different thing. If I place a Widget1a on the homescreen and press it, a Service is started and the code that this Service should run is run, as it should be. Now I place a Widget1u on the homescreen, and suddenly Widget1a stops working and doesn't do anything when I press it. If I place a second Widget1a on the homescreen both Widget1as work again, but now Widget1u is disabled and doesn't respond when I press it. In short: it seems that at any particular time only one type's code works when it is pressed (and if there are multiple instances of the same type on the homescreen all of these instances will work, but no instances of any other widget of my app will do anything when pressed).
The code in the AppWidgetProvider of each widget is pretty basic. It merely contains an overrided onUpdate-method. It creates an Intent to start a Service that I previously created, this is then used to create a PendingIntent which is used by setOnClickPendingIntent to make sure it can be activated by a Button in the widget. Each widget makes, when its Button is pressed, a slightly different Intent so that a certain Service is executed slightly differently. So this only works for the instances of 1 widgettype at a time, namely those of which an instance was added to the homescreen most recently.
Why do all my app's other widgets stop working when I add a widget of a different type to my homescreen? Does anyone know more about widgets or how I can make sure that each widget keeps doing its job when I add a new one from the same app to the homescreen?
Here is the onUpdate method of one of my AppWidgetProviders for one of my widgets. All widgets operate similarly and I know I used a lot of copypasting which is a bad programming habit but it didn't seem to really want to work otherwise.
Code:
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
// Create an intent to launch the service
Intent serviceIntent = new Intent(context, SendService.class);
//I just put some extra data here to be used by the Service which wil eventually get this Intent and thus the data inside
serviceIntent.setData(Uri.parse("uri::somethingrandomandunique"));
serviceIntent.putExtra("Lamp", "1a");
// PendingIntent is required for the onClickPendingIntent that actually
// starts the service from a button click
PendingIntent pendingServiceIntent =
PendingIntent.getService(context, 0, serviceIntent, Intent.FLAG_ACTIVITY_NEW_TASK);
// Get the layout for the App Widget and attach a click listener to the
// button
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget1a);
views.setOnClickPendingIntent(R.id.button1a, pendingServiceIntent);
// super.onUpdate(context, appWidgetManager, appWidgetIds);
ComponentName componentName = new ComponentName(context.getPackageName(), Widget1a.class.getName());
appWidgetManager.updateAppWidget(componentName, views);
}
So what am I doing wrong?
At it's core... a simple clock app. I'm firing off updates scheduled on each second. On each second, I read the time, then display the time. This is not complicated. And it works, just fine, on my phone. Tick, tick, tick and it looks like a clock. Why wouldn't it, right?
Ok, so the same code on the nook doesn't update regularly. Here's an early video:
http://www.youtube.com/watch?v=URRrYhumt1Y
You can see there's a "double beat". It's like every other update gets displayed for maybe 1.5 seconds. So the overall rate doesn't change, it's still two updates in two seconds, and no updates are missed.
These are being done with a regular myView.setText(), no fancy graphics or anything.
Now, here's more interesting data. If I run the updates twice as often, or five times as often, it changes nothing. I assume the screen/OS is internally detecting no pixels have changed, and so it does nothing. However, if I add, to a totally different view on the screen, an area where I'm toggling from some text to no text (from " " to "+", in actuality, so, a blinking plus sign) AND I run everything at five times a second then the seconds area updates with a steady one hertz beat, just like you would expect from a clock.
Additionally, if I run the code so it only updates every other second, it will click along very predictably at every other second. So it's not a "some code problem with every other update".
I wonder if there's some internal timer in the OS watching for screen updates, and managing them? Perhaps "pushing" the display with a toggling update every 200ms keeps it active and within some timeout limit?
Or are there some nook-specific calls on this?
Cheers,
Anders
I believe that some of the super-duper fast-mode or-whatever-you-call-it throws away some screen updates.
Are you using such a thing or a kernel with such a thing?
No, I'm not attempting any speedy-screen stuff in this code. In the video you can see the grey in the bar, so I'm not in any kind of a 1-bit mode. Because really, one update a second should be no problem.
But if it was throwing away an update... why would the update show up half a second later? I would expect it to skip displaying that second entirely, and so jump to the next.
NoRefresh is installed on this device, but not set to start at boot (and honestly, I don't think I've actually gotten NoRefresh working yet, busy with other things). But I'll uninstall it to be sure and retest.
Is it possible some kind of low-power mode / sleep mode is kicking in? It wakes up half a second later, realizes it has an update, stays away for the next half second, makes the NEXT update (on time) then goes back to sleep after a 0.9ish seconds?
Anders
Yep, even after uninstalling NoRefresh, and rebooting, the behavior is the same. So that's definitely not related.
And running the normal updates to the screen at both 2Hz and 5Hz have the same result, so it's not related to the number of times the updates are called.
Anders
Here's an interesting video... watching the ADB output click along at a clean 1Hz, and the screen updates clearly not synced with the actual writes to the screen.
http://www.youtube.com/watch?v=sL299EUH3T0
Again, all on "stock" system, no special video modes / refresh / magic enabled.
Anders
Actually, I have run into this.
There's no documentation on modes or theory of operating a frame buffer for eInk.
I ran into this on the time display on my audio recorder app.
I ended up using a DL region in my app.
I'll have to look closer into how bad it looks without that.
Are those numbers a TextView or an ImageView?
If it isn't a TextView try one to see if it works better.
There may be slowness in caching/using images.
More questions:
Are you using Timer & TimerTask?
Are you using runOnUiThread?
I wrote a demo app that counts.
It works fine by itself on stock 1.2.1
Renate NST said:
Actually, I have run into this.
There's no documentation on modes or theory of operating a frame buffer for eInk.
I ran into this on the time display on my audio recorder app.
I ended up using a DL region in my app.
I'll have to look closer into how bad it looks without that.
Click to expand...
Click to collapse
DL region? Not familiar with the acronym.
Are those numbers a TextView or an ImageView?
Click to expand...
Click to collapse
It's a text view. Just a big blocky TTF font. (Although the same issue is present using stock fonts).
Are you using Timer & TimerTask?
Are you using runOnUiThread?
Click to expand...
Click to collapse
Using scheduled handlers. They are triggering normally, since A] the ADB output is firing at nice one second intervals, and B] the SystemClock.uptimeMillis shows a 1000 count between each wake up. It's off by one or two millis which is understandable given that it's not a hard-realtime system.
But I'm not familiar with Timer and runOnUiThread, so I'll google those and do some reading.
(In the below code, the "nookPing" area is a tiny spot where I just toggle some pixels. If I do this and run the whole thing at faster than 1Hz, the seconds digit updates on schedule. Turn off this toggling, (which is in a totally unrelated textarea) and back to wonky updates, even at the same update rate. )
Code:
// //////////////////////////////////////////////////////////////////////////////////////////////////
// The Tick task itself /////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////////////////////////
private Handler mHandler = new Handler();
private Runnable mUpdateTimeTask = new Runnable() {
public void run() {
Log.d(TAG, "---------------------Tick Called: " +String.valueOf(SystemClock.uptimeMillis()) );
Log.d(TAG, "---------------------");
updateTimeOnScreen();
scheduleNextScreenUpdate();
}
};
// //////////////////////////////////////////////////////////////////////////////////////////////////
// Schedule next update /////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////////////////////////
private void scheduleNextScreenUpdate()
{
mHandler.removeCallbacks(mUpdateTimeTask);
mHandler.postAtTime(mUpdateTimeTask,UtilitiesTime.calculateNextScreenUpdateTime());
}
// //////////////////////////////////////////////////////////////////////////////////////////////////
// Show the time ////////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////////////////////////
static int nookPing=0;
private void updateTimeOnScreen() {
String hhmm;
int militaryhours,hour;
int minutes;
int seconds;
int tenths;
int milliseconds;
Calendar rightNow = Calendar.getInstance();
militaryhours=rightNow.get(Calendar.HOUR_OF_DAY);
hour=rightNow.get(Calendar.HOUR);
minutes=rightNow.get(Calendar.MINUTE);
seconds=rightNow.get(Calendar.SECOND);
milliseconds=rightNow.get(Calendar.MILLISECOND);
tenths=milliseconds/100;
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
if(true==settings.getBoolean("appSettingNookPingActive", false))
{
if(0==nookPing)
{
nookPing=1;
nookPingView.setText(".");
//nookPingView.setText(" ");
}
else{
nookPing=0;
nookPingView.setText(" ");
}
}
else{
nookPingView.setText(" ");
}
if(Configuration.ORIENTATION_PORTRAIT==getScreenOrientation())
{
if(1==MainActivity.appSettingMilitaryTimeFlag)
{
hhmm=String.format(Locale.US,"%02d:%02d",militaryhours, minutes);
}
else{
if(0==hour)
hour=12;
hhmm=String.format("%2d:%02d",hour, minutes);
}
}
else
{
if(1==MainActivity.appSettingMilitaryTimeFlag)
{
hhmm=String.format("%02d\n--\n%02d",militaryhours, minutes);
}
else{
if(0==hour)
hour=12;
hhmm=String.format("%2d\n--\n%02d",hour, minutes);
}
}
int secondsTens=seconds/10;
int secondsOnes=seconds%10;
secondsLeftView.setText(String.format("%d",secondsTens));
secondsRightView.setText(String.format("%d",secondsOnes));
hhmmView.setText(hhmm);
}