Why won't this broadcast receiver work in Lollipop?

只谈情不闲聊 提交于 2019-11-29 15:48:38

Ok, I solved the issue by adding two things: a permission, and a category tag inside the receiver's intent Filter. Everything in the manifest:

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
        <receiver android:name="classes.VoiceLaunchReceiver" >        
             <intent-filter>
                <action android:name="android.intent.action.USER_PRESENT" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </receiver>

Sometime when I was trying to make my own project, I did not see that the original Android demo had the permission.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!