Skip to content

Push Notification: fix compatibility with latest Android - #1479

Merged
mortend merged 1 commit into
fuse-open:masterfrom
ichan-mb:push_notification
Jul 29, 2023
Merged

Push Notification: fix compatibility with latest Android#1479
mortend merged 1 commit into
fuse-open:masterfrom
ichan-mb:push_notification

Conversation

@ichan-mb

Copy link
Copy Markdown
Member

We also needed this PR: fuse-open/uno#504 to make it works

Now, on Android 13 later, we can lazy request permission for push notifications same with iOS. First, define it on the unoproj

"Android": {
  "PushNotifications": {
      "RegisterOnLaunch": false
    }
}

and in your App, you can call the register method to ask for permission. Example:

<App>
	<JavaScript>

		var push = require("FuseJS/Push");
		var Observable = require("FuseJS/Observable")

		var log = new Observable()

		push.on("registrationSucceeded", function(regID) {
			console.log("Reg Succeeded: " + regID);
			log.value = "Reg Succeeded: " + regID
		});

		push.on("error", function(reason) {
			console.log("Reg Failed: " + reason);
			log.value = "Reg Failed: " + reason
		});

		push.on("receivedMessage", function(payload) {
			console.log("Recieved Push Notification: " + payload);
			log.value = "Recieved Push Notification: " + payload
		});

		module.exports.log = log
		module.exports.register = function() {
			push.register()
		}

	</JavaScript>
	<ClientPanel>
		<StackPanel>
			<Text Value="{log}" />
			<Button Text="Register Notification" Clicked="{register}" />
		</StackPanel>
	</ClientPanel>
</App>

This PR contains:

  • Changelog
  • Documentation
  • Tests

@mortend
mortend merged commit 7a2022f into fuse-open:master Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants