Skip to content

How to allow users to toggle notifications on or off? #76

@jamminjames

Description

@jamminjames

I am trying to create a toggle button to allow users of our app to control notifications. I have this, but it's not working:

$(document).on("pagecreate", "#about", function () {

$('#flipnotify').on('change', function() {
       $(this).val() == "off" ? play_int() : play_on();
});

function play_int() {
    $('#flipnotify').val();
        window.plugins.PushbotsPlugin.toggleNotifications(false);
}

function play_on() {
    $('#flipnotify').val();
        window.plugins.PushbotsPlugin.toggleNotifications(true);
}

});

The html is a jquery mobile flipswitch:

		<label for="flipnotify">Toggle Notifications On/Off:</label>
			<select name="flipnotify" id="flipnotify" data-role="flipswitch">
				<option value="on">On</option>
				<option value="off">Off</option>
			</select>
		</div>

Any help getting this to work would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions