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. MediaPlayer callbacks not firing after calling prepareAsync() from a Service

Hi everyone,

I'm working on writing a small app that will stream mp3 files. I'm using the 
NPR code, but having a strange problem with mediaPlayer.prepareAsync().

I'm using a trimmed down version of the 
PlaybackService<https://code.google.com/p/npr-android-app/source/browse/trunk/Npr/src/org/npr/android/news/PlaybackService.java>from
 the NPR 
app <https://code.google.com/p/npr-android-app/>, which is getting started 
correctly. I am getting a reference to the service inside an OnClick handler 
inside an Activity, and calling listen() with the URL to the MP3 stream. The 
following code is from my PlaybackService:

public void listen(String url) throws IllegalArgumentException, 
IllegalStateException, IOException { 
    if (mediaPlayer == null) { 
        mediaPlayer = new MediaPlayer(); 
    } 
    mediaPlayer.setOnBufferingUpdateListener(this); 
    mediaPlayer.setOnCompletionListener(this); 
    mediaPlayer.setOnErrorListener(this); 
    mediaPlayer.setOnInfoListener(this); 
    mediaPlayer.setOnPreparedListener(this); 
    synchronized (this) {
        mediaPlayer.setDataSource(url);
        mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
        mediaPlayer.prepareAsync();
    }
}

// ... lots of other code

@Override
public void onPrepared(MediaPlayer mp) { 
    Log.d(LOG_TAG, "Prepared"); 
    play();
}


I have the other callbacks defined as well. I can see from LogCat that the 
MediaPlayer is loading the stream and buffering, as I see the following 
messages:

AwesomePlayer  I  calling prefetcher->prepare()

AwesomePlayer  I  prefetcher is done preparing

But my onPrepared method never gets called. If I add a timer and try to call 
play() on the MediaPlayer at some point after I see the above log messages, 
the media players plays, so it is indeed entering into the Prepared state.

If I replace the call to prepareAsync() with prepare(), the player just 
works. This is all on 2.2, which I have been reading seems to have some 
issues, but the problem I'm having don't seem related, as the stream works 
fine when prepare() is used.

I did notice that the Content-Length on the the stream is quite large 
(450MB), but since I can call play on the Media Player without getting an 
exception, it appears to be handlings this OK.

The only other change is that in the NPR app, the service is being bound to 
and the playback started from inside a View object (while in my app, this 
happens inside an Activity).

Any thoughts on what I could be doing wrong?

Thanks!

Jim    

-- 

2. OOT: Salam kenal

Apa perlu gw Al yang ngeracunin bokap lu...jelek2 gini kan udah pernah puas 
dapetin barang gw? Hahaha....

Gw kirim aja ya my hero...payment urusan belakangan...gw ganti lagi yang 
baru...qkqkqk...


Sent from bebe

-----Original Message-----
From: "kemal.arsjad" <kemal.ars...@pearlova.com>
Date: Mon, 21 Sep 2009 16:09:57 
To: <id-android@googlegroups.com>
Subject: [id-android] Re: Salam kenal

Hakhakhakhakhakhakhakhak.....

Maen aja ke kantor gw...

Bawa tu android, kasih liat ke bokap =))


regards,
~kemal.arsjad~
follow me: www.twitter.com/kemal_arsjad

-----Original Message-----
From: "altama sidarta" <a...@sidarta.net>
Date: Mon, 21 Sep 2009 16:05:16 
To: MILIS id-Android<id-android@googlegroups.com>
Subject: [id-android] Re: Salam kenal

Hi Mal...

Untung lo dah megang Hero nya yah..

Banyak racun disini gw gatahan buat megang device nya

-sentilin bokap gw dong, ga di tembus2 wishlist gw Xp


--------
from XL network

-----Original Message-----
From: "kemal.arsjad" <kemal.ars...@pearlova.com>
Date: Mon, 21 Sep 2009 13:27:48 
To: <id-android@googlegroups.com>
Subject: [id-android] Salam kenal


Mods.. Thanks atas approvalnya...

Nyubie numpang gabung, pengen belajar pake android...
Sekarang saya pake android Hero...

Mohon petunjuknya dr rekan2 sekalian..

Thanks


regards,
~kemal.arsjad~









--~--~---------~--~----~------------~-------~--~----~
Google Groups "
-~----------~----~----~----~------~----~------~--~---

3. Device Management & Encryption

4. Freeze with RGBA8 OpenGL ES 2.0

5. Intent to launch the Application Settings screen for an application

6. changing the name i guess?

7. media codec manipulation -?