Activity not getting launched from broadcast receiver in Android 4.3 Jellybean

156 Views Asked by At

I have a BroadcastReceiver which is supposed to start an activity on receive of sms. But though the BroadcastReceiver is calling startActivity() with proper data, activity is not getting launched if I minimize the app and I am in homescreen.

I have used FLAG_ACTIVITY_REORDER_TO_FRONTand FLAG_ACTIVITY_NEW_TASK separately.

Below is my code

public void onReceive(Context context, Intent intent) {

                    Intent msgIntent = new Intent(context, MyActivity.class);
                    msgIntent.putExtra("dataString", "my data");
                    msgIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
                    context.startActivity(msgIntent);

}

This problem is only occurring in Jelly bean. In higher version the issue is not observed. If I am at homescreen MyActivity.java is not launching.

0

There are 0 best solutions below