{Novice Android Developer}
I am following this tutorial regarding adding OneSignal Push notifications to my application. One thing that I am having difficulty with is the adding of the MainActivity.java code found at the end of the tutorial. I receive multiple errors.
I would be much obliged if someone would be able to assist me with this last portion of OneSignal integration. The main issue I am having is the placement of this code in regards to what is already in the MainActivity and what the tutorial mentions.
When I insert the code where the tutorial says, I receive an error which says @Override not applicable to type
GitHub Repo of Project
// This fires when a notification is opened by tapping on it or one is received while the app is running.
private class ExampleNotificationOpenedHandler implements OneSignal.NotificationOpenedHandler {
@Override
public void notificationOpened(String message, JSONObject additionalData, boolean isActive) {
try {
if (additionalData != null) {
if (additionalData.has("actionSelected"))
Log.d("OneSignalExample", "OneSignal notification button with id " + additionalData.getString("actionSelected") + " pressed");
Log.d("OneSignalExample", "Full additionalData:\n" + additionalData.toString());
}
} catch (Throwable t) {
t.printStackTrace();
}
This is the code I am referring to.
*Note I omitted other parts of the tutorial in the code for the reason that I am aware of that portion of the tutorial