My app has a service and an activity. From the service, on some triggers, activity is called with following code:
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
On my test phones (mostly Samsung, Lenovo and Huawei) , activity starts and is displayed on the phone screen with its layout. However, on Xiaomi Redmi Note 4 with Android 7, activity layout is not displayed. I only see the following line on logcat:
I/Timeline: Timeline: Activity_launch_request time:281438674 intent:Intent { flg=0x30000000 cmp=com.test.app/.MainActivity }
The activity class extends AppCompatActivity , but I also tried with a normal activity class (same layout) and the result did not change.
activity is defined like below in the manifest:
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
There is no exception or other error/warning on log. So I am not able to troubleshoot further. What can I do ?