Android接收器随机禁用

Android接收器随机禁用,android,broadcastreceiver,Android,Broadcastreceiver,我有一个应用程序,其接收器在AndroidManifest.xml中定义,它似乎随机被禁用,导致应用程序强制关闭,直到重新安装应用程序。在这种情况发生前的一天、一周或一个月内,该应用程序可能会正常工作 来自adb外壳转储系统的相关输出: Package [com.example.helloworld.debug] (34181cc): userId=10196 gids=[3003, 1028, 1015, 3002, 3001] pkg=Package{388362dc c

我有一个应用程序,其接收器在
AndroidManifest.xml
中定义,它似乎随机被禁用,导致应用程序强制关闭,直到重新安装应用程序。在这种情况发生前的一天、一周或一个月内,该应用程序可能会正常工作

来自adb外壳转储系统的相关输出:

  Package [com.example.helloworld.debug] (34181cc):
    userId=10196 gids=[3003, 1028, 1015, 3002, 3001]
    pkg=Package{388362dc com.example.helloworld.debug}
    codePath=/data/app/com.example.helloworld.debug-1
    resourcePath=/data/app/com.example.helloworld.debug-1
    legacyNativeLibraryDir=/data/app/com.example.helloworld.debug-1/lib
    primaryCpuAbi=null
    secondaryCpuAbi=null
    versionCode=1 targetSdk=22
    versionName=1.0d
    splits=[base]
    applicationInfo=ApplicationInfo{2a384fe5 com.example.helloworld.debug}
    flags=[ DEBUGGABLE HAS_CODE ALLOW_CLEAR_USER_DATA VM_SAFE_MODE ALLOW_BACKUP ]
    dataDir=/data/data/com.example.helloworld.debug
    supportsScreens=[small, medium, large, xlarge, resizeable, anyDensity]
    timeStamp=2015-06-02 13:42:27
    firstInstallTime=2015-06-02 13:42:27
    lastUpdateTime=2015-06-02 13:42:27
    signatures=PackageSignatures{126ffaba [1dee9d6b]}
    permissionsFixed=true haveGids=true installStatus=1
    pkgFlags=[ DEBUGGABLE HAS_CODE ALLOW_CLEAR_USER_DATA VM_SAFE_MODE ALLOW_BACKUP ]
    User 0:  installed=true hidden=false stopped=false notLaunched=false enabled=0
      disabledComponents:
      com.et.sdk.ETLocationReceiver
    grantedPermissions:
      com.example.helloworld.debug.permission.C2D_MESSAGE
      com.google.android.c2dm.permission.RECEIVE
      android.permission.ACCESS_FINE_LOCATION
      android.permission.RECEIVE_BOOT_COMPLETED
      android.permission.BLUETOOTH
      android.permission.INTERNET
      android.permission.BLUETOOTH_ADMIN
      android.permission.READ_EXTERNAL_STORAGE
      android.permission.ACCESS_COARSE_LOCATION
      android.permission.ACCESS_NETWORK_STATE
      android.permission.DISABLE_KEYGUARD
      android.permission.GET_ACCOUNTS
      android.permission.WRITE_EXTERNAL_STORAGE
      android.permission.VIBRATE
      android.permission.ACCESS_WIFI_STATE
      android.permission.WAKE_LOCK
AndroidManifest.xml
的相关部分:

<!-- ETLocationReceiver and Service -->
<receiver android:name="com.et.sdk.ETLocationReceiver">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <action android:name="android.intent.action.BATTERY_LOW" />
        <action android:name="android.intent.action.BATTERY_OKAY" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.location.PROVIDERS_CHANGED" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</receiver>


进一步检查后,发现电池电量不足导致定位接收器无法工作。谢谢你的提示@commonware让我继续挖掘

您确定没有强制停止此应用程序,或通过
PackageManager
禁用此接收器?我在过去2天内成功使用了此应用程序。在昨晚驾驶时,它开始强制关闭,现在直到我重新安装它才会启动。包含该ETLocationReceiver的SDK也有一个ETPushReceiver。在检查ETLocationReceiver之前,已成功验证ETPushReceiver,并且ETLocationReceiver检查失败(因为它已被禁用。)@commonware进一步检查:您是对的!当电池电量低的接收器启动时,我们禁用了位置接收器,但当电池电量正常的接收器启动时,我们检查了相应接收器的清单,该接收器被禁用,因此列表为空。唷。你吓了我一跳。很高兴它对你有用!IMHO,鉴于你的问题的构建方式,如果你将你的“进一步审查后”评论扩展为答案,那么SO社区将得到更好的服务。