Create an automatic launch-able Broadcast Receiver in Android

前端 未结 2 1322
遇见更好的自我
遇见更好的自我 2021-01-28 19:24

Problem:

I am willing to create an application that simply starts as a background process and whenever a new message comes into the device it should log

2条回答
  •  梦谈多话
    2021-01-28 20:19

    Your Code look like this in manifest file

        
            
                
            
        
    

    Add the following to your in the manifest:

    android:enabled="true" android:exported="true">

    Furthermore, according to this thread, it seems that you have to manually start one of your activities before the broadcast receiver will start working, i.e. the application has to have been launched at least once before any broadcast receiver will work.

提交回复
热议问题