【发布时间】:2021-02-02 18:41:40
【问题描述】:
try {
intent = new Intent();
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
intent.putExtra("android.provider.extra.APP_PACKAGE", getPackageName());
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
intent.putExtra("app_package", getPackageName());
intent.putExtra("app_uid", getApplicationInfo().uid);
}
startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(AppSettings.this, "Something went wrong.", Toast.LENGTH_LONG).show();
}
我已经尝试使用上面的代码打开我的应用程序的通知设置,但是当我从同一屏幕(通知设置)单击返回按钮时,我再次进入同一屏幕。有什么相同的建议吗????
【问题讨论】:
标签: java android notifications