Where to put BroadcastReceiver in Android MVP?
<p>I have a BroadcastReceiver implementation that receives network connection events. its declared in the AndroidManifest.xml and is called by Android automatically when network events occur.</p>

<p>BroadcastReceiver:</p>

<pre><code>public class ConnectivityChangeReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.v(TAG, "action: " + intent.getAction());
        Log.v(TAG, "component: " + intent.getComponent());
    }
}
</code></pre>

<p>AndroidManifest.xml:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.test"&gt;

    &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;

    &lt;application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"&gt;
        ...
        &lt;receiver
            android:name=".ConnectivityChangeReceiver"
            android:enabled="true"&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.net.conn.CONNECTIVITY_CHANGE" /&gt;
            &lt;/intent-filter&gt;
        &lt;/receiver&gt;
    &lt;/application&gt;

&lt;/manifest&gt;
</code></pre>

<p>I'd like to use Google's MVP sample architecture described here for my app:</p>

<p><a href="https://github.com/googlesamples/android-architecture/tree/todo-mvp/" rel="noreferrer">https://github.com/googlesamples/android-architecture/tree/todo-mvp/</a></p>

<p>Using the above architecture, just wondering:</p>

<ol>
<li><p>Where should my BroadcastReceiver be placed?</p></li>
<li><p>If my BroadcastReceiver needs to write to the database, whats the best way of doing this?</p></li>
<li><p>If my BroadcastReceiver needs to update the UI, whats the best way of doing this?</p></li>
</ol>