分享

android 开机自启动的几种方法,监听不到RECEIVE...

 创始元灵6666 2022-10-11 发布于河北

第一种:  监控RECEIVE_BOOT_COMPLETED,即开机启动事件

第二种: 监控sd卡mount事件  开机总会扫描sd卡吧? 监控sd卡事件也有类似开机启动效果,特别app安装在sd卡的情况下有些os是抓取不到RECEIVE_BOOT_COMPLETED

第三种: android:installLocation="internalOnly", 限制app的安装位置,使其能抓取到RECEIVE_BOOT_COMPLETED

第四种: 监听电话或者短信事件,手机总得打电话收发短信吧? 万一实在不行,退而求其次,这种方式还是可行的。

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

  1. <receiver android:name="com.example.receiver.SystemEventReceiver"
  2. android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
  3. <intent-filter>
  4. <action android:name="android.intent.action.BOOT_COMPLETED" />
  5. </intent-filter>
  6. <intent-filter>
  7. <action android:name="RestartSerivcesForSystemEventReceiver" />
  8. </intent-filter>
  9. <intent-filter>
  10. <action android:name="android.intent.action.MEDIA_MOUNTED" />
  11. <action android:name="android.intent.action.MEDIA_UNMOUNTED" />
  12. <action android:name="android.intent.action.MEDIA_EJECT" />
  13. <data android:scheme="file" >
  14. </data>
  15. </intent-filter>
  16. </receiver>


    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多