OneSignal-Android-SDK icon indicating copy to clipboard operation
OneSignal-Android-SDK copied to clipboard

[Looking for Feedback] OneSignal SDK v5.0.0-beta2 Released!

Open brismithers opened this issue 2 years ago • 9 comments

In this major version alpha release for the OneSignal SDK, we are making a significant shift from a device-centered model to a user-centered model. A user-centered model allows for more powerful omni-channel integrations within the OneSignal platform.

For information please see the migration guide.

🚧 Alpha release. It is not recommended to use in production. 🚧

Please post any feedback related to the alpha under this issue.

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

brismithers avatar Jan 09 '23 22:01 brismithers

The v5.0.0-beta1 has been released. For information please see the migration guide.

🚧 Beta release. It is not recommended to use in production. 🚧

brismithers avatar Feb 06 '23 15:02 brismithers

Linking #1735 as a question thread for reference.

jkasten2 avatar Feb 17 '23 06:02 jkasten2

The v5.0.0-beta2 has been released. For more information please see the migration guide.

emawby avatar Feb 21 '23 18:02 emawby

Is Notification Service Extension still possible in 5.0.0? Unable to find OSRemoteNotificationReceivedHandler interface from 4.8.6. Nothing about it in migration guide as well.

Popda avatar Aug 14 '23 13:08 Popda

what is the alternative for OSNotificationOpenedHandler from 4.8.6 in 5.0.0?

Popda avatar Aug 14 '23 14:08 Popda

@Popda

Thanks for the feedback!

Is Notification Service Extension still possible in 5.0.0? Unable to find OSRemoteNotificationReceivedHandler interface from 4.8.6. Nothing about it in migration guide as well.

Yes, the Notification Service Extension is still available in 5.0.0. Things have been renamed and OSRemoteNotificationReceivedHandler has been changed.

In 5.0.0, the code should look something like this:

import com.onesignal.notifications.IDisplayableMutableNotification;
import com.onesignal.notifications.INotificationReceivedEvent;
import com.onesignal.notifications.INotificationServiceExtension;

public class NotificationServiceExtension implements INotificationServiceExtension {

  @Override
  public void onNotificationReceived(INotificationReceivedEvent event) {
   // Here is some code for example :
   Log.v(Tag.LOG_TAG, "IRemoteNotificationReceivedHandler fired" + " with INotificationReceivedEvent: " + event.toString());

   IDisplayableMutableNotification notification = event.getNotification();

   notification.setExtender(builder -> builder.setColor(event.getContext().getResources().getColor(R.color.colorPrimary)));
  }
}

Here is an example Notification Service Extension we use in our Android example project: https://github.com/OneSignal/OneSignal-Android-SDK/blob/user-model/main/Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/notification/NotificationServiceExtension.java

We haven’t updated the Notification Service Extension Android documentation yet, thanks for letting us know!

what is the alternative for OSNotificationOpenedHandler from 4.8.6 in 5.0.0?

It has been changed to ClickListener, you can read more about it in our docs here and in the migration guide here

Let us know if you have any questions!

shepherd-l avatar Aug 17 '23 19:08 shepherd-l

There should be a table with old and replaced methods/interfaces. That's not really a migration guide. Else it is hard for big projects to search for all new methods/interfaces

michael-winkler avatar Aug 21 '23 12:08 michael-winkler

Hi, how to get additional data from push message ? I have a code, but what method should I use to get additional payload from "event" ?

OneSignal.getNotifications().addClickListener(event ->
{
	event. ?? // how to get additional data(key-value pairs) from this event
});

p.s. oh... is this an answer event.getNotification().getAdditionalData() ?

kat0d avatar Aug 22 '23 10:08 kat0d

Where did

OneSignal.unsubscribeWhenNotificationsAreDisabled(false)

go? (see #1538)

Isn't i possible to have silent notification without permission anymore with 5.x? (currently trying with 5.0.2) That's a major flow... (see #1853)

danielesegato avatar Sep 26 '23 20:09 danielesegato

There should be a table with old and replaced methods/interfaces.

That's a good idea, since so much has changed. We will look into adding this, since people will still be upgrading for a while yet.

Hi, how to get additional data from push message ? I have a code, but what method should I use to get additional payload from "event" ?

OneSignal.getNotifications().addClickListener(event ->
{
	event. ?? // how to get additional data(key-value pairs) from this event
});

p.s. oh... is this an answer event.getNotification().getAdditionalData() ?

Correct!

Isn't i possible to have silent notification without permission anymore with 5.x? (currently trying with 5.0.2) That's a major flow... (see https://github.com/OneSignal/OneSignal-Android-SDK/issues/1853)

I reopened issue #1853 so the request can be tracked there.

Closing and locking this issue as the v5.x.x SDK is no longer in beta. Please create a new issue if you have any other topics.

jkasten2 avatar Mar 01 '24 23:03 jkasten2