jonna wrote:
> Calendar calendar = Calendar.getInstance();
> calendar.setTimeInMillis(System.currentTimeMillis());
> calendar.add(Calendar.SECOND, 30);
> SimpleDateFormat sdf = new SimpleDateFormat();
> sdf.applyPattern("k:m:s");
> Log.d("AlarmBootReceiver", " second " + sdf.format
> (calendar.getTimeInMillis()));
> mgr.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
> pi);
Your use of Calendar here differs from anything I have done. Why not
just add 30000 (30 seconds in milliseconds)?
A working boot/alarm example can be downloaded here:
http://commonsware.com/AdvAndroid/
(scroll to Source Code, download the ZIP, look for the
SystemService/Alarm project)
> Manifest file:
>
> <uses-permission
> android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
> <application android:label="@string/app_name">
> <receiver android:name=".OnBootReceiver">
> <intent-filter>
> <action
> android:name="android.intent.action.BOOT_COMPLETED" />
> <category
> android:name="android.intent.category.LAUNCHER" />
> </intent-filter>
> </receiver>
> <receiver android:name=".OnAlarmReceiver"
> android:exported="true">
> </receiver>
Also, try dropping the android:exported="true".
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
Android 1.5 Programming Books: http://commonsware.com/books.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---