- Forum-Beiträge: 1.727
17.06.2010, 14:15:03 via Website
17.06.2010 14:15:03 via Website
irgendwie stehe ich auf dem Schauch, ich hab ein Custom Parcleable mit namen "Alert". Ich erzeuge nun Alarme:
2
3 final long now = System.currentTimeMillis();
4 //
5
6 for (int i = 0; i < alertsToEnqueue.size(); i++)
7 {
8 final Alert alert = alertsToEnqueue.get(i);
9 final Intent intent = new Intent(_context, AlarmBroadcastReciever.class);
10 intent.putExtra(IntentConstants.ALERT, alert);
11 final PendingIntent pendingIntent = PendingIntent.getBroadcast(_context, REQUEST_COUNTER.incrementAndGet(),
12 intent, PendingIntent.FLAG_ONE_SHOT);
13 alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, now + INITIAL_DELAY, (10L * 1000L), pendingIntent);
14
15 if (Logging.isLoggingEnabled())
16 {
17 Log.d(LOG_TAG, "Enqueued Alert " + alert.toString());
18 }
19 }
Diese werden momentan nach ca. 10 Sekunden ausgelöst, in meinem BroadcastReciever erhalte ich grundsätzlich eine ClassNotFoundException, kann mir jemand mal erklären wieso ? BroadcastReviever rennen wohl je nach Configuration in einem eigenem Prozess (anderer ClassLoader etc pp), aber wie stelle ich das ab ?
Meine Alert Klasse sie so aus:
2{
3 ....
4
5 /**
6 * @see Creator
7 */
8 public static final Parcelable.Creator<Alert> CREATOR = new Parcelable.Creator<Alert>()
9 {
10 public Alert createFromParcel(final Parcel in)
11 {
12 return new Alert(in);
13 }
14
15 public Alert[] newArray(final int size)
16 {
17 return new Alert[size];
18 }
19 };
20
21 /*
22 * (non-Javadoc)
23 *
24 * @see android.os.Parcelable#writeToParcel(android.os.Parcel, int)
25 */
26 @Override
27 public void writeToParcel(Parcel dest, int flags)
28 {
29 dest.writeInt(weekday);
30 dest.writeLong(time);
31 dest.writeInt(retryCounter);
32 dest.writeInt(repeatID);
33 dest.writeInt(selectedID);
34 }
35
36}
Windmate HD, See you @ IO 14 , Worked on Wundercar, Glass V3, LG G Watch, Moto 360, Android TV