Question: Can I schedule a local notification using the Pushwoosh SDK/plugin?
Answer: Yes. Use the following methods.
Android (native) — scheduleLocalNotification:
LocalNotification notification = new LocalNotification.Builder()
.setMessage("Local notification content")
.setDelay(seconds)
.build();
LocalNotificationRequest request = Pushwoosh.getInstance().scheduleLocalNotification(notification);
where seconds is the delay in seconds. Remember to add the RECEIVE_BOOT_COMPLETED permission to your AndroidManifest.xml so that scheduled notifications survive a reboot. On Android 13 and later your app must also hold the runtime POST_NOTIFICATIONS permission, otherwise nothing is displayed. See the Android SDK documentation.
iOS — local notifications are created with native methods, see Scheduling a notification locally from your app.
Unity:
Pushwoosh.Instance.ScheduleLocalNotification("Hello, Android!", 5, parameters);
Pushwoosh.Instance.SetNotificationChannelDelegate(new MyNotificationChannelDelegate());
Xamarin — Microsoft ended Xamarin support on May 1, 2024, and Pushwoosh no longer maintains the Xamarin plugin or covers it in current SDK documentation. Existing Xamarin apps can keep calling the native APIs above (Apple's local notification API on iOS, scheduleLocalNotification at the native level on Android), but new and actively maintained apps should migrate to .NET MAUI, the supported successor.
React Native — there is no dedicated method at the React Native level; create local notifications natively using the methods above.
Cordova:
pushwoosh.createLocalNotification({
msg: "Your pumpkins are ready!",
seconds: 30,
userData: {}
});
See the Cordova plugin documentation. (Adobe PhoneGap Build, formerly an alternative way to build Cordova apps, was shut down in 2020; use the Cordova CLI instead.)
Appcelerator Titanium — the Pushwoosh SDK for Titanium is no longer supported and has been officially deprecated. To keep using Pushwoosh in a Titanium project, wrap the native iOS/Android SDKs in your own Titanium native module; see iOS SDK docs and Android SDK docs.
Note: the Adobe AIR ANE and Trigger.io modules are no longer maintained; for those frameworks schedule notifications with native platform APIs.
Comments
0 comments
Please sign in to leave a comment.