Closed Gerald1985 closed 8 years ago
Am also facing the same issue.
I had to edit the GeofencePlugin Class deviceReady method with: private void deviceReady() { Intent intent = cordova.getActivity().getIntent(); String data = intent.getStringExtra("geofence.notification.data"); String js = "app.onNotificationClicked("
the setTimeout function was not working with my implementation so I created a new function called app.onNotificationClicked, also I add resultIntent.setAction(Long.toString(System.currentTimeMillis())) on GeoNotificationNotifier.java because all intent was calling the last extra.. By Using the setAction function the issue was fixed and now all extras are set correctly.
var app = { onNotificationClicked: function(notificationData) { if (notificationData != undefined ) { app.notificationClicked = true; navigator.notification.alert(notificationData.descripcion, null, notificationData.title, "Aceptar"); /cookies.manageTokens();/ console.log('App opened from Geo Notification!' + notificationData); } } }
Now is working properly
@Gerald1985 you have to set window.geofence.onNotificationClicked
on application start. This question is more appropriate for StackOverflow, though.
@Gerald1985 i tried your solution, but it seems i missed something. could you please mention the exact file path and changes.
@baskaranr would you please contact me at gerald_morales@hotmail.com, This issue is closed and as @tsubik said we don't have to have this conversation here. I will send you my files for your implementation.
Regards
Application is opened by click on notification but onNotificationClicked not executed. I'm trying to check some values when app start from notification object.notification = { id: id, title: promotion, text: description, openAppOnClick: true, smallIcon: 'res://icon', icon: 'file://img/geofence_icon.png', data: { name: 'foo', lastName: 'bar' } };
clickedGeofence: function(){ window.geofence.onNotificationClicked = function (notificationData) { Alert('Geofencing is Working'); console.log('App opened from Geo Notification!', notificationData); }; },