An error occurred while debugging the alarm source code: badparcelableexception.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.