22import traceback
33import os ,re
44import threading
5+
6+
57from .an_types import Importance
68from .an_utils import can_accept_arguments
79from .styles import NotificationStyles
3234 IconCompat = autoclass ('androidx.core.graphics.drawable.IconCompat' )
3335 ON_ANDROID = True
3436except Exception as e :
35- if e .name != 'android' :
37+ if hasattr ( e , 'name' ) and e .name != 'android' :
3638 print ('Exception: ' ,e )
3739 print (traceback .format_exc ())
3840
@@ -537,7 +539,7 @@ def __dispatch_notification(self):
537539 print ('Permission not granted to send notifications' )
538540 # Not asking for permission too frequently, This makes dialog popup to stop showing
539541 # NotificationHandler.asks_permission()
540-
542+
541543 def __start_notification_build (self , persistent , close_on_click ):
542544 self .__create_basic_notification (persistent , close_on_click )
543545 if self .style not in ['simple' ,'' ]:
@@ -562,7 +564,8 @@ def __create_basic_notification(self, persistent, close_on_click):
562564 self .__built_parameter_filled = True
563565
564566 def __insert_app_icon (self ,path = '' ):
565- if path or self .app_icon not in ['' ,'Defaults to package app icon' ]:
567+ if BuildVersion .SDK_INT >= 23 and (path or self .app_icon not in ['' ,'Defaults to package app icon' ]):
568+ # Bitmap Insert as Icon Not available below Android 6
566569 if self .logs :
567570 print ('getting custom icon...' )
568571 self .__set_icon_from_bitmap (path or self .app_icon )
0 commit comments