Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push Notification: fix compatibility with latest Android #1479

Merged
merged 1 commit into from
Jul 29, 2023

Conversation

ichan-mb
Copy link
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