[英]Intent for “Settings > Connected Devices > Connection Preferences” page
I'd like to know the Intent
for the AdvancedConnectedDeviceDashboardFragment
.我想知道AdvancedConnectedDeviceDashboardFragment
的Intent
。 On API 28 this page can be reached through: Settings
> Connected Devices
> Connection Preferences
.在 API 28 上,可以通过以下方式访问此页面: Settings
> Connected Devices
> Connection Preferences
。
This fragment contains all the advanced connection preferences(ie, Bluetooth, NFC, USB..)此片段包含所有高级连接首选项(即蓝牙、NFC、USB..)
The logcat of the manual interaction:手动交互的logcat:
D/SettingsActivity: Switching to fragment com.android.settings.connecteddevice.AdvancedConnectedDeviceDashboardFragment
D/SubSettings: Launching fragment com.android.settings.connecteddevice.AdvancedConnectedDeviceDashboardFragment
Launching it through SubSettings
doesn't work:通过SubSettings
启动它不起作用:
try {
Intent intent = new Intent();
intent.setClassName("com.android.settings", "com.android.settings.SubSettings");
getActivity().startActivity(intent);
} catch (ActivityNotFoundException e) {
Log.e(LOG_TAG, e.getMessage());
}
Because it is not set exported="true"
it gives me:因为它没有设置为exported="true"
它给了我:
.SecurityException: Permission Denial: starting Intent { cmp=com.android.settings/.SubSettings (has extras) } from ProcessRecord{75bbdbc 11970:com.acme.application.debug/u0a460} (pid=11970, uid=10460) not exported from uid 1000 (.SecurityException:权限被拒绝:从 ProcessRecord{75bbdbc 11970:com.acme.1060/u0a460} 开始 Intent { cmp=com.android.settings/.SubSettings(有附加功能)}从 uid 1000 导出
Is there a chance to start it through the parent SettingsActivity
with Intent
extras?是否有机会通过带有Intent
附加功能的父SettingsActivity
启动它?
While browsing com.android.settings.Settings
I've found the name of the SettingsActivity
:在浏览com.android.settings.Settings
,我找到了SettingsActivity
的名称:
ConnectedDeviceDashboardActivity extends SettingsActivity
AdvancedConnectedDeviceActivity extends SettingsActivity
And so I've wrote a simple wrapper method, which still throws
:所以我写了一个简单的包装方法,它仍然throws
:
public void showSettings(@NonNull String activityName) throws ActivityNotFoundException {
Intent intent = new Intent();
intent.setClassName("com.android.settings", "com.android.settings.Settings$" + activityName);
getActivity().startActivity(intent);
}
It can be used alike this:它可以像这样使用:
try {
showSettings("AdvancedConnectedDeviceActivity");
} catch (ActivityNotFoundException e) {
Log.e(LOG_TAG, e.getMessage());
}
See Settings.java
for further SettingsActivity
names to use.有关要使用的更多SettingsActivity
名称,请参阅Settings.java
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.