I have a problem that I can not understand why it happens, I've been looking for more sites before asking but I have not found anything, here's the problem:
I create an Intent to send a broadcast in the following way:
Intent intent = new Intent(contexto,BroadcastReciver.class);
intent.putExtra("key","texto"));
contexto.sendBroadcast(intent);
This causes the BroadcastReciver class to start and enter the onRecive()
method and I do the following:
@Override
public void onReceive(Context context, Intent intent) {
String aux=intent.getStringExtra("key");
}
Well, when it comes there, that Intent that I recive has the Extras to null and I do not know why, I have verified that when creating the intent the data will not be empty and this is all correct until you reach the BroadcastReciver class.
EDITED: In manifest.xml I have it declared as follows:
<receiver android:name=".utils.BroadcastReciver" />
utils is a package I have created myself.