Status Bar Notifications

by Brad Stintson » Thu, 10 Mar 2011 01:53:15 GMT


Sponsored Links
 How to create status bar notification which notifies me every day at 10 am?

-- 



Re: Status Bar Notifications

by Kostya Vasilyev » Thu, 10 Mar 2011 02:01:47 GMT


 09.03.2011 20:53, Brad Stintson :
How to create status bar notification which notifies me every day at 10 am?
1 - Use AlarmManager to schedule reliable, persistent (until reboot) alarms that trigger a BroadcastReceiver in your application. http://developer.android.com/reference/android/app/AlarmManager.html 2 - Use NotificationManager to display the notification. http://developer.android.com/guide/topics/ui/notifiers/index.html -- Kostya Vasilyev -- http://kmansoft.wordpress.com --


Sponsored Links


Re: Status Bar Notifications

by Brad Stintson » Thu, 10 Mar 2011 02:14:29 GMT


 Can u please provide sample code?
I am new to this.





-- 



Re: Status Bar Notifications

by TreKing » Thu, 10 Mar 2011 02:18:45 GMT


 




Can u please read the links Kostya provided and attempt to do something on
your own?
Or use Google, there are plenty of examples to be found in the documentation
and internets.

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 



Re: Status Bar Notifications

by Kostya Vasilyev » Thu, 10 Mar 2011 02:23:47 GMT


 Here is one example that does pretty much what you asked for:

 http://www.androidcompetencycenter.com/tag/alarmmanager/ 

-- Kostya

09.03.2011 21:14, Brad Stintson :
Can u please provide sample code? I am new to this. On Wed, Mar 9, 2011 at 11:31 PM, Kostya Vasilyev <kmans...@gmail.com 09.03.2011 20:53, Brad Stintson : How to create status bar notification which notifies me every day at 10 am? 1 - Use AlarmManager to schedule reliable, persistent (until reboot) alarms that trigger a BroadcastReceiver in your application. http://developer.android.com/reference/android/app/AlarmManager.html 2 - Use NotificationManager to display the notification. http://developer.android.com/guide/topics/ui/notifiers/index.html -- Kostya Vasilyev -- http://kmansoft.wordpress.com -- --
-- Kostya Vasilyev -- http://kmansoft.wordpress.com --



Re: Status Bar Notifications

by Kostya Vasilyev » Thu, 10 Mar 2011 02:29:15 GMT


 09.03.2011 21:18, TreKing :
Can u please read the links Kostya provided and attempt to do something on your own?
Thank you, Major, sir :) -- Kostya Vasilyev -- http://kmansoft.wordpress.com --



Re: Status Bar Notifications

by roberto » Thu, 10 Mar 2011 02:59:19 GMT


 Hi Brad,
you might want to consider using the BuzzBox SDK to do schedule a Task
very quickly.
You can use a cron string to schedule your task, in your case it would
be:

SchedulerManager.getInstance()
        .saveTask(this, "0 10 * * 1,2,3,4,5,6,7", YourTask.class);

The BuzzBox SDK takes care of registering your task in the Alarm
Manager.
More info:
 http://hub.buzzbox.com/android-sdk/ 

Let me know what you think.

Roberto




-- 



Re: Re: Status Bar Notifications

by Marcin Orlowski » Thu, 10 Mar 2011 03:42:00 GMT


 



Looks interesting but I personally am not happy with it being closed
source (which I could stand) but integration with their analics. Who
knows what it analites when your app got internet permission. But can
be I am simply exaggerating :)

-- 
Regards,
Marcin Orlowski

-- 



Re: Status Bar Notifications

by roberto » Thu, 10 Mar 2011 07:15:25 GMT


 




the buzzbox sdk actually does not require internet permission if you
don't want to use the analytics.
you can use the scheduler without analytics.

Roberto


-- 



Re: Re: Status Bar Notifications

by Brad Stintson » Thu, 10 Mar 2011 21:46:35 GMT


 How to get time from database n trigger notification on that time?








-- 



Re: Re: Status Bar Notifications

by Kostya Vasilyev » Thu, 10 Mar 2011 21:51:49 GMT


 >From a database? Same as anything else, by using a query. Probably easiest
to keep date/time values as a long integer (standard Unix representation).

Once you have the time value, use AlarmManager and NotificationManager
classes in Android.
10.03.2011 16:47  "Brad Stintson" <geek.bin...@gmail.com>
:





-- 



Re: Re: Status Bar Notifications

by Brad Stintson » Fri, 11 Mar 2011 14:06:56 GMT


 My application is not triggering notification at specified alarm time.
Please see below classes and tell me how to do that.*
*
*
*
*
*This is my notification class.*
public class Notificaition extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {

NotificationManager nm = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
CharSequence from = "App Name";
CharSequence message = "Event Title";
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
intent, 0);
Notification notif = new Notification(R.drawable.icon,
"EVENT", System.currentTimeMillis());
long[] vibrate = {100,100,200,300};
notif.vibrate = vibrate;
notif.defaults =Notification.DEFAULT_ALL;
notif.setLatestEventInfo(context, from, message, contentIntent);
nm.notify(1, notif);
}

*And this is my alarm class*
public class AlarmTrig extends Activity {
AlarmManager alarms;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);


setOneTimeAlarm();

}

public void setOneTimeAlarm() {
Calendar cal = Calendar.getInstance();

cal.setTimeInMillis(System.currentTimeMillis());
cal.clear();
cal.set(Calendar.YEAR, mYear);
cal.set(Calendar.MONTH,mMonth);
cal.set(Calendar.DAY_OF_MONTH,mDay);
cal.set(Calendar.HOUR,mHour);
cal.set(Calendar.MINUTE,mMinutes);
cal.set(Calendar.SECOND, mSeconds);

// where mYear, mMonths, mDay, mHour and mMinutes are int values from the
Date and Time picker dialogs respectively

Intent activate = new Intent(this, TimeAlarm.class);
PendingIntent alarmIntent = PendingIntent.getBroadcast(this, 0,
activate, 0);
alarms = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
alarms.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
alarmIntent);
}




On Thu, Mar 10, 2011 at 7:21 PM, Kostya Vasilyev <kmans...@gmail.com> wrote:


--



Re: Status Bar Notifications

by Jonathan Foley » Fri, 11 Mar 2011 15:13:03 GMT


 s the device going to sleep? If so you'll need to acquire a WakeLock
otherwise it will wake up for the alarm and may fall back asleep
before the notification ever gets fired.


Jonathan

On Mar 10, 10:06pm, Brad Stintson <geek.bin...@gmail.com> wrote:

--



Re: Re: Status Bar Notifications

by Brad Stintson » Sat, 12 Mar 2011 00:23:04 GMT


 ow should I implement WakeLock in my above mentioned code?


2011/3/11 Jonathan Foley <jonefo...@gmail.com>


--



Re: Re: Status Bar Notifications

by Kostya Vasilyev » Sat, 12 Mar 2011 00:38:50 GMT


 tt>Before you look into using a WakeLock (which might not be necessary, 
since Android keeps a wake lock for the duration of your onReceive)...


There are a few things in your code that look rather strange to me:

1 - Your broadcast receiver is called Notification (bad name, btw, as it
clashes with an Android class), and yet when setting the alarm, you use
TimeAlarm:


Intent activate = new Intent(this, *TimeAlarm*.class);

2 - Inside onReceive, you call PendingIntent.getActivity() with the
intent received by the broadcast receiver. Does that intent really point
to an Activity?


3 - Not shown in your original email, but - did you declare your
broadcast receiver in the manifest?


After dealing with the above, as next step, I'd add debug logging,
shorten the alarm interval just for debugging (say, five minutes) and
check what happens.


-- Kostya

11.03.2011 19:22, Brad Stintson :

How should I implement WakeLock in my above mentioned code?


2011/3/11 Jonathan Foley <jonefo...@gmail.com
<mailto:jonefo...@gmail.com>>



Is the device going to sleep? If so you'll need to acquire a WakeLock
otherwise it will wake up for the alarm and may fall back asleep
before the notification ever gets fired.


Jonathan

On Mar 10, 10:06 pm, Brad Stintson <geek.bin...@gmail.com
<mailto:geek.bin...@gmail.com>> wrote:
> *My application is not triggering notification at specified
alarm time.
> Please see below classes and tell me how to do that.*
> *
> *
> *
> *
> *This is my notification class.*
> public class Notificaition extends BroadcastReceiver {
>
> @Override
> public void onReceive(Context context, Intent intent) {
>
> NotificationManager nm = (NotificationManager) context
> .getSystemService(Context.NOTIFICATION_SERVICE);
> CharSequence from = "App Name";
> CharSequence message = "Event Title";
> PendingIntent contentIntent =
PendingIntent.getActivity(context, 0,
> intent, 0);
> Notification notif = new Notification(R.drawable.icon,
> "EVENT", System.currentTimeMillis());
> long[] vibrate = {100,100,200,300};
> notif.vibrate = vibrate;
> notif.defaults =Notification.DEFAULT_ALL;
> notif.setLatestEventInfo(context, from, message, contentIntent);
> nm.notify(1, notif);
> }
>
> *And this is my alarm class*
> public class AlarmTrig extends Activity {
> AlarmManager alarms;
>
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.main);
> am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
>
> setOneTimeAlarm();
>
> }
>
> public void setOneTimeAlarm() {
> Calendar cal = Calendar.getInstance();
>
> cal.setTimeInMi



Other Threads

1. J2ME or ANDROID eclipse usage

hi can i join your group im from mongolia

--~--~---------~--~----~------------~-------~--~----~

2. issue with autocompletetextview and ime

hello,

  i have a dialog with a single autocompletetextview on an activity
that's in
  landscape mode.

  here's how i specify this autocompletetextview:
           <AutoCompleteTextView android:id="@+id/name_text"
                     android:completionThreshold="2"
                     android:layout_width="fill_parent"
                     android:layout_height="wrap_content"
                     android:layout_marginLeft="5px"
                     android:inputType="textPersonName|textCapWords"
                     android:imeOptions="actionDone"
                     />

  with sdk1.5, when i put my finger on the textview to give it focus,
  the virtual/soft keyboard shows up.  i see the autocomplete mode
still works
  in the context of the keyboard:  as i type, i see suggestions show
  up below the text entry field.  very nice.

  anyhow, when i touch "Done", i get my dialog view back, but the
  autocompleteview dropdown list is still showing!  what's worse,
  when i try to dismiss the dropdown by selecting the same item that's
  already entered in the textfield, some sort of empty menubar shows
  up at the bottom of the screen (which i discovered i can dismiss
  by pressing the back button)!

  1. i would expect that when i finish entering the text using the
   virtual keyboard, by pressing "Done", that the autocomplete drop
   down should no longer show (autodismiss).
   is there any way to tell the view programmatically to not show
   if there's only one match and it's already entered??

   2. i can't figure out why the single line text field morphs into
    what looks like a multiline text area when in 'virtual keyboard'
    mode.

  any help/hints most  appreciated.

thanks,
/ eitan

--~--~---------~--~----~------------~-------~--~----~

3. Css overflow issue

4. How to increase Emulator's Internal memory capacity?

5. Simple GridView that displays text in the grids

6. ExpandableListView not expanding/collapsing when using a group View with a checkbox

7. Bluetooth, wireless keyboards, J2ME enabled / JSR28 compliance required - can it work?