Skip to content

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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