I have a library that includes an action with a name BaseActivityand a receiver with a name BaseRegister.
BaseRegisterextends BroadcastReceiverand its actions android.net.conn.CONNECTIVITY_CHANGEand android.net.wifi.WIFI_STATE_CHANGED, and it looks like this:
public class BaseRegister extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if {
Log.d("onReceive", "Got it");
context.sendBroadcast(new Intent("some"));
else {
Log.d("onReceive", "Nope");
context.sendBroadcast(new Intent("stuff"));
}
}
}
AndroidManifestalso beautiful, according to Log. Here's what it looks like BaseActivity:
public class BaseActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
registerReceiver(applicationControl, new IntentFilter("some"));
registerReceiver(applicationControl, new IntentFilter("stuff"));
}
private BroadcastReceiver applicationControl = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.equals(new Intent("some"))) {
some();
} else if (intent.equals(new Intent("stuff"))) {
stuff();
}
}
};
public void some() { }
public void stuff() { }
}
In the project, I already added this project as a library, no problem. And created an action that expands BaseActivity. When CONNECTIVITY_CHANGEas an action, BaseRegisterAndroid starts up, but there is no call for Activity. This is what my project looks like:
public class AnyActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void some() {
super.some();
Log.d("abc", "abc");
}
@Override
public void stuff() {
super.stuff();
Log.d("abc", "abc");
}
}
What's wrong? Is my approach wrong or is there some kind of error? Any help would be great.