We are having trouble with local broadcasts. For some reason in 2 androids(my own phone + boss's phone) it works fine. On another phone(galaxy s3 mini like my boss) and on boss's tablet it however crash. Program crash if the tmp.sendBroadcast command is but not right away(it still does bit after that). However it never gets to receiver.
public class UpdaterIntent extends IntentService {
...
Intent intent = new Intent("my-event");
intent.putExtra("action", "update_workplaces");
intent.putExtra("parameters", time);
LocalBroadcastManager'tmp=LocalBroadcastManager.getInstance(myInst);
if(tmp!=null) {
tmp.sendBroadcast(intent);
}
I have registered receiver like this:
LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver,
new IntentFilter("my-event"));
Receiver is this:
private BroadcastReceiver mMessageReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(myContext, "received message", Toast.LENGTH_SHORT).show();
}
}
};
I have tried to search for some reason why it might be so. Thought it might have been too long parameters as putExtra but even after trimming it to two strings(one seen in code, one is just a date that comes from server like "2014-03-28 12:20:02" etc so now there shouldn't be danger of exceeding some hard coded limit.
Any suggestions? Don't like any workarounds to this that I have come up with being clumsy as hell.