I recently read the 4.0 kernel clock source code. After reading the code for a few days, I want to use its source code to write a timed enable flight mode.Program, After two days of finally running the program, we found that when the updatenotification () method was executed, the Program reported android. OS. badparcelableexception: classnotfoundexception when unmarshalling: com ..... After reading many posts, I cannot solve my problem. Alarm. Java in the source code implements the parcelable interface,CodeIt will never be wrong, and I also go to the API documentation to confirm that there is no error.
Finally, I found that the error message in logcat does not contain the package name I defined, and double-click the error message to jump to the program's alarmreceiver. in Java, this indicates that the system considers it as my alarmreceiver. java encountered an error in the unmarshall alarm object.
In androidmanifest. XML, the intentfilter definition of alarmreceiver is as follows:
<Intent-filter>
<Action Android: Name = "com. Android. Alibaba clock. alarm_alert"/>
<Action Android: Name = "alarm_killed"/>
</Intent-filter>
<Action Android: Name = "alarm_killed"/> This action also triggers the clock program in the system, because the alarmreceiver of the system's clock program can also accept this action. Therefore, we only need to change this intent-filter, for example,:
<Intent-filter>
<Action Android: Name = "com. Lefter. Alarm. alarm_alert"/>
<Action Android: Name = "com. Lefter. Alarm. alarm_killed"/>
</Intent-filter>
When sending intent, the action is defined as "com. Lefter. Alarm. alarm_killed". In this way, only our own alarmreceiver can process this action. This avoids conflicts between the system's clock and our program.