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. Running tests in main

Hi

Can someone advise the am command (for adb shell) to run junit tests in the main thread please? The following shows onStart etc running in the test runner thread... am instrument -w -e class co.uk.telesense.tests.MyTest co.uk.telesense.tests/android.test.InstrumentationTestRunner Thanks! Ewan -- Ewan Benfield http://www.telesense.co.uk tel: 0845 643 5691 (+44 845 643 5691) mob: +44 (0) 77859 26477 --

2. about setting WindowManager.LayoutParams.screenBrightness

We noticed some devices(not android's) support such feature:black out
screen and turn bright when someone touches it.
Our custom want us to simulate such function with android.
We trid to set WindowManager.LayoutParams.screenBrightness to make
screen dark enough but still knowing touch motion but failed.

 lp.screenBrightness = 0.039f;  //dark enough and looks dead

 lp.screenBrightness = 0.04f;  //not dark enough but knowing touch
motion

It turns out that there is no way to make our customer happy.

I think Android has nothing to do with our problem and it should be
the problem of LED screen maker. If they can make such LED, Android
will support it also. Am I right?

Best Regards.

James

-- 

3. Add Self-Define view into layout

4. Live report isat

5. how to set break points when developing Eclipse with an actual device

6. Online order now open for business

7. Is there a way to call Android Scripting Environment from Java Code