bpy.types.AddonPreferences

I want to save add-on settings and load it in next blender session. I mean I want Blender remember the last checkbox state. this is my code, but when I run it, checkbox will disappear:

bl_info = {
    "name": "Persistent Checkbox Addon",
    "blender": (2, 80, 0),
    "category": "3D View",
}

import bpy

class AddonPreferences(bpy.types.AddonPreferences):
    bl_idname = __name__

    my_checkbox: bpy.props.BoolProperty(
        name="My Checkbox",
        description="Stores the state of the checkbox",
        default=False
    )

    def draw(self, context):
        layout = self.layout
        layout.prop(self, "my_checkbox")


class SimpleCheckboxPanel(bpy.types.Panel):
    bl_label = "Persistent Checkbox"
    bl_idname = "VIEW3D_PT_persistent_checkbox"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    bl_category = "New Tab"

    def draw(self, context):
        layout = self.layout
        prefs = context.preferences.addons[__name__].preferences
        layout.prop(prefs, "my_checkbox", text="Enable Option")


def register():
    bpy.utils.register_class(AddonPreferences)
    bpy.utils.register_class(SimpleCheckboxPanel)


def unregister():
    bpy.utils.unregister_class(AddonPreferences)
    bpy.utils.unregister_class(SimpleCheckboxPanel)


if __name__ == "__main__":
    register()

On mobile so cannot test the code but on a glimpse I cannot see anything that seems wrong

Can you define what you mean by running it. Do you run this through the script editor or have you added this as an addon via the “install from disk”?
If you are running it via the editor then that is the issue since the boolean is set when you run it.
If you add it as an addon it should save it.

I found the solution, bpy.types.AddonPreferences works only we set
bpy.context.preferences.use_preferences_save = True