BroadcastReceiver is not called after createChooser(context,intent,IntentSender) is executed
<p>I want to detect what app the user selects after I present him with a <strong>createChooser()</strong> dialog. So I have created my <code>BroadcastReceiver</code> subclass like this:</p>

<pre><code>import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class ShareBroadcastReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.d("INFORMATION", "Received intent after selection: "+intent.getExtras().toString());
    }
}
</code></pre>

<p>Also I have added my receiver to my android <strong>manifest</strong> file:</p>

<pre><code>&lt;application&gt;
...
...
...
    &lt;receiver android:name=".helpers.ShareBroadcastReceiver" android:exported="true"/&gt;
&lt;/application&gt;
</code></pre>

<p>And here is the code that is calling the <strong>createChooser</strong> dialog:</p>

<pre><code>Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND);
sendIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
sendIntent.setType("image/png");

if (android.os.Build.VERSION.SDK_INT &gt;= android.os.Build.VERSION_CODES.LOLLIPOP_MR1) {
    Log.d("INFORMATION", "The current android version allow us to know what app is chosen by the user.");

    Intent receiverIntent = new Intent(this,ShareBroadcastReceiver.class);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, receiverIntent, PendingIntent.FLAG_CANCEL_CURRENT);
    sendIntent = Intent.createChooser(sendIntent,"Share via...", pendingIntent.getIntentSender());
}
startActivity(sendIntent);
</code></pre>

<p>Even though this is an explicit <code>PendingIntent</code> because I am using the <code>ShareBroadcastReceiver</code> class name directly without any<code>intent-filter</code>, my broadcast receiver is not being callback right after the user clicks on the chooser dialog, what am I doing wrong?</p>