三星盖乐世s6开发时,需要打开三星手机自带的“智能管理器”来引导用户打开“自启动”权限,该怎么实现?

三星盖乐世s6开发时,需要打开三星手机自带的“智能管理器”来引导用户打开“自启动”权限,该怎么实现?我使用如下代码,但是报错了。

        super.onStart();
        Intent intent = new Intent();
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        if (Build.MANUFACTURER.equals("samsung")) {
            LogInfo.d("equals samsung");
        }
        ComponentName componentName =new  ComponentName("com.samsung.android.sm_cn","com.samsung.android.sm.ui.ram.AutoRunActivity");
        intent.setComponent(componentName);
        startActivity(intent);

报错:

2019-11-13 22:51:49.602 4590-4590/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.intelligentalarmclock, PID: 4590
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.intelligentalarmclock/com.example.intelligentalarmclock.MainActivity}: java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.samsung.android.sm_cn/com.samsung.android.sm.ui.ram.AutoRunActivity launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } } from ProcessRecord{2da72bd 4590:com.example.intelligentalarmclock/u0a178} (pid=4590, uid=10178) not exported from uid 1000
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988)
        at android.app.ActivityThread.-wrap14(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6682)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
     Caused by: java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.samsung.android.sm_cn/com.samsung.android.sm.ui.ram.AutoRunActivity launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } } from ProcessRecord{2da72bd 4590:com.example.intelligentalarmclock/u0a178} (pid=4590, uid=10178) not exported from uid 1000
        at android.os.Parcel.readException(Parcel.java:1693)
        at android.os.Parcel.readException(Parcel.java:1646)
        at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:3530)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1526)
        at android.app.Activity.startActivityForResult(Activity.java:4399)
        at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:767)
        at android.app.Activity.startActivityForResult(Activity.java:4358)
        at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:754)
        at android.app.Activity.startActivity(Activity.java:4682)
        at android.app.Activity.startActivity(Activity.java:4650)
        at com.example.intelligentalarmclock.MainActivity.onStart(MainActivity.java:251)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1256)
        at android.app.Activity.performStart(Activity.java:6959)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2890)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988) 
        at android.app.ActivityThread.-wrap14(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:154) 
        at android.app.ActivityThread.main(ActivityThread.java:6682) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410) 

这是怎么回事?需要什么权限吗?

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐