File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
android/src/main/java/com/ninty/system/setting Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -298,13 +298,19 @@ public void setVolume(float val, ReadableMap config) {
298298 } catch (SecurityException e ) {
299299 if (val == 0 ) {
300300 Log .w (TAG , "setVolume(0) failed. See https://github.com/c19354837/react-native-system-setting/issues/48" );
301- NotificationManager notificationManager =
302- (NotificationManager ) mContext .getSystemService (Context .NOTIFICATION_SERVICE );
303- if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .M
304- && !notificationManager .isNotificationPolicyAccessGranted ()) {
305- Intent intent = new Intent (android .provider .Settings .ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS );
306- mContext .startActivity (intent );
301+ try {
302+ am .setStreamVolume (volType , (int ) (0.1 * am .getStreamMaxVolume (volType )), flags );
303+ Log .w (TAG , "setVolume(0.1)" );
304+ } catch (Exception ex ) {
305+ Log .e (TAG , "err setting volume to 0.1" , ex );
307306 }
307+ // NotificationManager notificationManager =
308+ // (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
309+ // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
310+ // && !notificationManager.isNotificationPolicyAccessGranted()) {
311+ // Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
312+ // mContext.startActivity(intent);
313+ // }
308314 }
309315 Log .e (TAG , "err" , e );
310316 }
You can’t perform that action at this time.
0 commit comments