I found my own answer, so I give the response for those who can be interested in.
I have two BroadcastReceiver class, one used when application is wake up, with :
ActivityBroadcastReceiver myReceiver = new ActivityBroadcastReceiver();
@Override
protected void onResume() {
LocalBroadcastManager.getInstance(this).registerReceiver(myReceiver, new IntentFilter("com.mybroadcast"));
super.onResume();
}
and
@Override
protected void onPause() {
LocalBroadcastManager.getInstance(this).unregisterReceiver(myReceiver);
super.onPause();
}
and in my manifest file :
<receiver
android:name="com.broadcastreceiver.NotificationBroadcastReceiver"
android:enabled="true" >
<intent-filter>
<action android:name="com.mybroadcast" />
</intent-filter>
</receiver>
To send my broadcast :
if(!LocalBroadcastManager.getInstance(context).sendBroadcast(broadcast))
context.sendBroadcast(broadcast);
I agree that with this, context.sendBroadcast() , everyone can received my broadcast, but in my code, sendBroadcast send only non-sensible data. That is the best solution I got for now.