I have two activities MainActivity.java
, MainActivity2.java
and an accessibility service MyService.java
. From MainActivity.java
, I start the Accessibility Settings Activity using the following code:
Intent intentStartSettingActivity = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
startActivity(intentStartSettingActivity);
From the settings activity, the user can turn on the accessibility service for the application. Now, when the user enables the accessibility permission, I want to start a new activity MainActivity2.java
but the problem is when I am enabling the accessibility permission, the activity MainActivity2.java
is not displayed. For starting second activity I am using the following code in MyService.java
:
@Override
protected void onServiceConnected() {
super.onServiceConnected();
Intent intentStartMainActivity2 = new Intent(this,MainActivity2.class);
intentStartMainActivity2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intentStartMainActivity2);
}
When I am viewing the Logcat its showing as:
2019-12-26 21:53:41.249 23580-23580/com.example.tatkal I/Timeline: Timeline: Activity_launch_request time:68381132 intent:Intent { flg=0x10000000 cmp=com.example.tatkal/.MainActivity2 }
This means that the service is connecting properly but I don't know why the activity is not being displayed.
User contributions licensed under CC BY-SA 3.0