apptentive / apptentive-android

Apptentive Android SDK
http://www.apptentive.com
BSD 3-Clause "New" or "Revised" License
65 stars 64 forks source link

Only Enable NetworkStateReceiver When Needed #84

Closed solcott closed 9 years ago

solcott commented 10 years ago

Requiring apps that use your SDK to have a BroadcastReceiver that listens to connectivity changes is a bad idea. See http://developer.android.com/training/monitoring-device-state/connectivity-monitoring.html. Connectivity changes happen extremely frequently. If you really need this then only have it enabled when it is needed and then disable it when you don't need it anymore. See http://developer.android.com/training/monitoring-device-state/manifest-receivers.html on how to do this.

For example you could enabled it when someone adds a NetworkStateListener in NetworkStateReceiver.addListener and then disable it when NetworkStateReceiver. clearListeners is called. Users of the SDK can then add android:enabled="false" to the receiver declaration in AndroidManifest.xml

This is causing our app to be started very frequently. Right now we are having an issue with crashlytics crashing on app startup and since this is causing our app to startup very frequently people are complaining that our app is crashing all the time. Please fix this.

skykelsey commented 10 years ago

Thanks Scott. I will track this as a potential enhancement.