Open webmeemba opened 6 years ago
ios:
private applicationDidFinishLaunchingWithOptions(app, launchOptions): boolean {
try {
TnsOneSignal.initWithLaunchOptionsAppIdHandleNotificationAction(
launchOptions,
'APP_ID',
function actionCallback(result) {
Helpers.handleOpenNotification(JSON.parse(result.stringify()).notification.payload.additionalData)
}
);
TnsOneSignal.inFocusDisplayType = OSNotificationDisplayType.Notification
} catch (error) {
console.error('error', error)
}
return true
}
android:
TnsOneSignal.startInit(app.android.context).setNotificationOpenedHandler(new com.onesignal.OneSignal.NotificationOpenedHandler(<com.onesignal.OneSignal.NotificationOpenedHandler>{
notificationOpened: function (result: com.onesignal.OSNotificationOpenResult) {
console.log("------------------------notificationOpened------------------------")
// console.dir(JSON.parse(result.notification.payload.additionalData));
},
})).init();
@webmeemba did this work for you?
@OPADA-Eng can you perhaps please post the JS version of your solution(s)? I struggle with TS. :)
Android:
app.on(app.launchEvent, function (args) {
imageCache.initialize();
try {
// TnsOneSignal.startInit(app.android.context).setNotificationOpenedHandler(new TnsOneSignal.NotificationOpenedHandler(<TnsOneSignal.NotificationOpenedHandler>{
TnsOneSignal.startInit(app.android.context).setNotificationOpenedHandler(new TnsOneSignal.NotificationOpenedHandler({
// notificationOpened: function (result: com.onesignal.OSNotificationOpenResult) {
notificationOpened: function (result) {
console.log("------------------------notificationOpened------------------------");
// console.dir(JSON.parse(result.notification.payload.additionalData));
},
})).init();
TnsOneSignal.setInFocusDisplaying(TnsOneSignal.OSInFocusDisplayOption.Notification);
}
catch (error) {
console.error('error', error);
}
});
IOS:
CustomAppDelegate.prototype.applicationDidFinishLaunchingWithOptions = function (application, launchOptions) {
try {
TnsOneSignal.initWithLaunchOptionsAppIdHandleNotificationAction(launchOptions, 'APP_ID', function actionCallback(result) {
conaole.log(JSON.parse(result.stringify()).notification.payload.additionalData);
});
TnsOneSignal.inFocusDisplayType = OSNotificationDisplayType.Notification;
}
catch (error) {
console.error('error', error);
}
return true;
};
@OPADA-Eng Thanks so much - going to give it a try as soon as my current app's iOS build completes and I finish submitting to the AppStore :)
@OPADA-Eng Could you perhaps talk me through the JS code that you wrote? Busy trying to implement it but want to understand what I'm seeing.
Ok no problem, How do you want to talk?
On Tue, Dec 4, 2018, 1:32 PM delanick <notifications@github.com wrote:
@OPADA-Eng https://github.com/OPADA-Eng Could you perhaps talk me through the JS code that you wrote? Busy trying to implement it but want to understand what I'm seeing.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/roblav96/nativescript-onesignal/issues/34#issuecomment-444068830, or mute the thread https://github.com/notifications/unsubscribe-auth/ACGJaFudEbOH6gnkGYnJOsofqpWrPor1ks5u1l02gaJpZM4T_0e3 .
@OPADA-Eng I'm easy, whatever works for you. We could do a quick Skype call if that suits you. What time zone are you in? I can do anywhere after 8pm South African time.
Ok, we are at the same time zone.it's ok at 9:00 pm today. this is my skype name: opada-eng1
@OPADA-Eng Apologies bud, I was away yesterday. Can we do today at 9pm? My skype name is delannick. Apoloigies again for missing your message yesterday.
@OPADA-Eng Oops, sorry, delanick with one N :)
also having a hard time implement push notification using this plugin :(
Me code is:
TnsOneSignal.startInit(androidApp.context).init();
I need :
TnsOneSignal.handleNotificationOpened((jsonData) => { console.log('didOpenRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
})
not found