simple demo multiple alarms

by guruk » Sun, 26 Apr 2009 18:12:28 GMT


Sponsored Links
 Hi, i like to create multiple alarms, but i does not work. how to set
and how to request in my receiver what alarm intent came activated

in my alarm.java i call this function like: setalarm(5); setalarm(10)
(it works but only remember the last)


 public void setalarm(int delay)
    {
         Intent intent = new Intent(alarm.this, alarmreceiver.class);
         PendingIntent sender = PendingIntent.getBroadcast(alarm.this,
0, intent, 0);
         intent.setData((Uri.parse("custom://"+delay)));  << i heared
about this would make individual alarms.. but does not work

         Calendar calendar = Calendar.getInstance();
         calendar.setTimeInMillis(System.currentTimeMillis());
         calendar.add(Calendar.SECOND, delay);

         intent.putExtra("avr", ""+delay);   //i tried to set my data
here to read later, but also does not work


         AlarmManager am = (AlarmManager)getSystemService
(ALARM_SERVICE);
         am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
sender);

         //Toast.makeText(this, "Alarm set", Toast.LENGTH_LONG).show
();

    }

---- my alarmreceiver.java

public class alarmreceiver extends BroadcastReceiver
{
        NotificationManager mNM;
        @Override
 public void onReceive(Context context, Intent intent)
 {
                Uri ursistr = intent.getData();
                String intentstr = intent.getStringExtra("avr");  //does not 
get the
saved intentextra?!

        Toast.makeText(context, "GOT IT :"+intentstr+" "+ursistr,
Toast.LENGTH_SHORT).show();

 }

greets
chris


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



simple demo multiple alarms

by Ashok Jeevan » Mon, 27 Apr 2009 16:34:59 GMT


 Hi,Try using

am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis()+(delay * 1000)
, sender);

This will set the alarms according to the delay that you specify.







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


Sponsored Links


simple demo multiple alarms

by guruk » Thu, 30 Apr 2009 02:36:00 GMT


 thanks...
finaly the calendar add.. do the same.

but that does not answer my question, how to initiate MULTIPLE
Alarms.. and especialy
how o read them in me broadcast receiver and how to know what alarm
comes initiated.

thanks
chris





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



simple demo multiple alarms

by Jeff Sharkey » Thu, 30 Apr 2009 11:22:45 GMT


 ight, this is because PendingIntents only keep track of one set of
extras for a given action+data+category+component combination. That
is to say, it ignores extras when comparing PendingIntents.

Because your second PendingIntent matches the first one, the system
recycles the first one.

Depending on the desired behavior, you could use FLAG_CANCEL_CURRENT
to wipe the old PendingIntent and replace it with a new one containing
the updated extras. Or, if you need multiple events, you could use
the data Uri to hold the extra information. (So something like
"custom://avr/myvalue" might work.)

j

On Wed, Apr 29, 2009 at 11:35 AM, guruk <ilovesi...@gmail.com> wrote:



--
Jeff Sharkey
jshar...@google.com

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



Other Threads

1. Zip inflate failed error while scaning system/app

Hi everyone,

While booting,  Android is segfaulting when it scans /system/app for
 most of .apk present in that dir. Each time it segfaults in a similar
fashion; e.g.:

W/zipro   ( 1555): Zip inflate failed, zerr=-3 (nIn=0x4101910e
aIn=1101 nOut=0x1
ac708 aOut=3936)

The error is coming out of frameworks/base/libs/utils/ZipFileRO.cpp:
615.

See below for more info from logcat.

Plese share your Ideas, suggestions on how to fix this?

D/PackageManager( 1555): Scanning app dir /system/app
W/zipro   ( 1555): Zip inflate failed, zerr=-3 (nIn=0x4101910e
aIn=1101 nOut=0x1
ac708 aOut=3936)
I/DEBUG   ( 1536): *** *** *** *** *** *** *** *** *** *** *** *** ***
*** *** *
**
I/DEBUG   ( 1536): Build fingerprint: 'generic/generic/generic/:1.0/
TC3/eng.kish
orl.20090123.180414:eng/test-keys'
I/DEBUG   ( 1536): pid: 1555, tid: 1570  >>> system_server <<<
I/DEBUG   ( 1536): signal 11 (SIGSEGV), fault addr 00000000
I/DEBUG   ( 1536):  r0 001ac708  r1 00000000  r2 00000f60  r3 00000018
I/DEBUG   ( 1536):  r4 00000001  r5 001b0740  r6 00000000  r7 00000f60
I/DEBUG   ( 1536):  r8 45bffda0  r9 41016d64  10 41016d50  fp 00000001
I/DEBUG   ( 1536):  ip 80000000  sp 45bffd30  lr a9d21f15  pc
afe0ce00  cpsr a00
00010
I/DEBUG   ( 1536):          #00  pc afe0ce00  /system/lib/libc.so
I/DEBUG   ( 1536):          #01  pc a9d21f12  /system/lib/libutils.so
I/DEBUG   ( 1536):          #02  pc ad333028  /system/lib/
libandroid_runtime.so
I/DEBUG   ( 1536):          #03  pc ad00d9f4  /system/lib/libdvm.so
I/DEBUG   ( 1536):          #04  pc ad04123e  /system/lib/libdvm.so
I/DEBUG   ( 1536):          #05  pc ad012748  /system/lib/libdvm.so
I/DEBUG   ( 1536):          #06  pc ad02a92c  /system/lib/libdvm.so
I/DEBUG   ( 1536):          #07  pc ad0169d0  /system/lib/libdvm.so
I/DEBUG   ( 1536):          #08  pc ad051f40  /system/lib/libdvm.so
I/DEBUG   ( 1536):          #09  pc ad051f60  /system/lib/libdvm.so
I/DEBUG   ( 1536):          #10  pc ad047668  /system/lib/libdvm.so
I/DEBUG   ( 1536):          #11  pc afe0ed98  /system/lib/libc.so
I/DEBUG   ( 1536):          #12  pc afe0e90c  /system/lib/libc.so
I/DEBUG   ( 1536): stack:
I/DEBUG   ( 1536):     45bffcf0  00000f60
I/DEBUG   ( 1536):     45bffcf4  af90a97c  /system/lib/libz.so
I/DEBUG   ( 1536):     45bffcf8  00000000
I/DEBUG   ( 1536):     45bffcfc  a9d2898f  /system/lib/libutils.so
I/DEBUG   ( 1536):     45bffd00  4101910e
I/DEBUG   ( 1536):     45bffd04  0000044d
I/DEBUG   ( 1536):     45bffd08  001ac708  [heap]
I/DEBUG   ( 1536):     45bffd0c  afe0ddd8  /system/lib/libc.so
I/DEBUG   ( 1536):     45bffd10  00000f60
I/DEBUG   ( 1536):     45bffd14  afe0ddd8  /system/lib/libc.so
I/DEBUG   ( 1536):     45bffd18  001ac708  [heap]
I/DEBUG   ( 1536):     45bffd1c  afe0e16c  /system/lib/libc.so
I/DEBUG   ( 1536):     45bffd20  001ac708  [heap]
I/DEBUG   ( 1536):     45bffd24  000001b4
I/DEBUG   ( 1536):     45bffd28  df002777
I/DEBUG   ( 1536):     45bffd2c  e3a070ad
I/DEBUG   ( 1536): #00 45bffd30  001b0740  [heap]
I/DEBUG   ( 1536):     45bffd34  00000000
I/DEBUG   ( 1536):     45bffd38  00000f60
I/DEBUG   ( 1536):     45bffd3c  45bffda0
I/DEBUG   ( 1536):     45bffd40  41016d64
I/DEBUG   ( 1536):     45bffd44  41016d50
I/DEBUG   ( 1536):     45bffd48  00000001
I/DEBUG   ( 1536):     45bffd4c  001ac708  [heap]
I/DEBUG   ( 1536):     45bffd50  00000001
I/DEBUG   ( 1536):     45bffd54  a9d21f15  /system/lib/libutils.so
I/DEBUG   ( 1536): #01 45bffd58  001b0740  [heap]
I/DEBUG   ( 1536):     45bffd5c  afd01939  /system/lib/libstdc++.so
I/DEBUG   ( 1536):     45bffd60  a9d45618
I/DEBUG   ( 1536):     45bffd64  a9d1c391  /system/lib/libutils.so
I/DEBUG   ( 1536):     45bffd68  001b0618  [heap]
I/DEBUG   ( 1536):     45bffd6c  00000000
I/DEBUG   ( 1536):     45bffd70  001b0618  [heap]
I/DEBUG   ( 1536):     45bffd74  00088ae8  [heap]
I/DEBUG   ( 1536):     45bffd78  001b0740  [heap]
I/DEBUG   ( 1536):     45bffd7c  ad33302b  /system/lib/
libandroid_runtime.so
I/DEBUG   ( 1536): de{*filter*}d committing suicide to free the zombie!
I/DEBUG   ( 1584): de{*filter*}d: Jan 23 2009 19:14:01
E/installd( 1543): eof
E/installd( 1543): failed to read size
I/installd( 1543): closing connection

Regards,
Krish

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

2. Failed to upload myapp.apk on 'HT841GZ03224': Too many open files

I don't know the reason for this particular error message, but I
strongly advise you to always uninstall your app before reinstalling,
otherwise you'll run out of device memory and would have to do the
"double shutdown" or "battery pull" trick to get it back.

Cheers

On Wed, Jan 28, 2009 at 9:22 PM, Mark Nuetzmann



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

3. How to make layout "fill" available space in middle

4. Music player, mute app sound

5. fitness or workout program

6. looking for an answer about the g1 for developers

7. Starting an activity with FLAG_ACTIVITY_MULTIPLE_TASK to see multiple instances