0

I am going through a problem with the Huawei Phone models., where my application is not running in the back ground.I have gone through the couple of vlogs and stack over flow question, but I haven't found right answer for the same.

Can some one let me know ho to launch the App launch directly through my Android application or run my Android application when application is in Background.

I have gone through this questions and I am getting the same crash: "Protected Apps" setting on Huawei phones, and how to handle it

I have tried some possible ways but it's doesn't worked and below are the phone models

Huawei P30 EMUI version 11.0.0 Android version 10

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
val intent = Intent()
        intent.setClassName(
            "com.huawei.systemmanager",
            "com.huawei.systemmanager.appcontrol.activity.StartupAppControlActivity"
        )
        startActivity(intent)
}

Manifest

<activity
            android:name="com.xxx.SplashActivity"
            android:exported="true"
            android:permission="com.huawei.permission.external_app_settings.USE_COMPONENT"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action  android:name="com.android.settings.action.EXTRA_SETTINGS" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

I am getting the below crash

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxxx.app.de.debug/com.xxx.app.startup.xxxx}: java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.huawei.systemmanager/.appcontrol.activity.StartupAppControlActivity } from ProcessRecord{264290b 5109:com.xxxx.app.de.debug/u0a278} (pid=5109, uid=10278) requires com.huawei.permission.external_app_settings.USE_COMPONENT
                                                                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3898)
                                                                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4081)
                                                                                                        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91)
                                                                                                        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
NikhilReddy
  • 6,904
  • 11
  • 38
  • 58

0 Answers0