I am trying to check my app as a protected app in Infinix phones programatically .. but it seems to be impossible so instead of that I am trying to start Protected apps activity which exist in XManager >> Settings >> Protected apps
I succeeded to just open XManager by this code
try {
startActivity(new Intent().setClassName("com.transsion.mobilebutler",
"com.transsion.mobilebutler.MainActivity"));
} catch (Exception e) {
Log.d("tag", "e " + e.toString());
}
I can't do anything else programatically
when I tried to start Settings activity by this code
try {
startActivity(new Intent().setComponent(new ComponentName("com.transsion.mobilebutler",
"com.transsion.mobilebutler.SettingsActivity")));
} catch (Exception ex) {
Log.d("tag", "ex " + ex.toString());
}
I got this Exception
java.lang.SecurityException: Permission Denial: starting Intent
also I tried to start protected apps directly but again I got the same Excepion
try {
Intent intent = new Intent();
intent.setClassName("com.transsion.mobilebutler",
"com.transsion.mobilebutler.applicationmanager.view.activities.MemoryAccelerateWhitelistActivity");
startActivity(intent);
} catch (Exception e) {
Log.d("tag", "e " + e.toString());
Updated
Some answers of this Exception suggest to add android:exported="true"
to manifest
when I add activity I got Unresolved class error
<activity android:name="com.transsion.mobilebutler.SettingsActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
Is there any way to solve this problem ?