Add buttons in windows notification - django

I am creating 'talking reminder'. Currently its run in web browser.
Now, I want to send notification with buttons when alarm ring. Hopefully, send notification work successfully using below code:
notification.notify(title=msg, message=" ", timeout=10)
But I am getting trouble to add button 'snooze' in this notification.
I already tried win10toast but it given an error during download win10toast.
Is there any solution for this?

Related

How can I know whether user clicked on notification or not?

my tried wayI am trying to know when i am sending push notification to users they will open the notification or not. i am able to get the number of sent notification or number of successful and failed notification but i am unable to get the user response record.I am using aws sns push notification with fcm
it's easy!
Just put a little code in notification code, when user clicked the notification it gets the value from the database which is 0 when you start sending the notification, and add +1 in it and again store that value in the database.
This is the simple way you can check how many people open your notification.
Regards,
Sameer Rehman

How to send a "you haven't used your app in a while " push notification in React Native using AWS?

Just wanted to know from a high level how I would accomplish this.
I thought that when a user opens the application, I will keep track of the last opened time in a Dynamo DB table.
Then I could have a background worker constantly check and see if anybody hasn't used their app in 3 or 4 days and then send a push notification, ie, "you haven't used your app in a while, why don't you open it up and do XYZ."
From a very high level, there are two possible ways:
1.) Local notifications (you don't need AWS for this):
You can schedule a local notification, every time the user opens up the app (or better - every time the user brings the app to foreground). It works like: User opens app -> cancel old scheduled notification if existing -> schedule new notification for "in 3 or 4 days" -> ready :-)
You can use something like this: https://github.com/zo0r/react-native-push-notification (see section Sheduled Notifications).
2.) You could do it with remote notifications (https://aws.amazon.com/sns/):
You can go the way you proposed. Then you have to store an entry in your db with the push notification token of the device and the last time the app was opened. Your worker then has to check and send the push message to the device using a service like SNS.
I would recommend 1.) over 2.) because you are independent from the users internet connection when getting the app opening info. In 2.) you can miss the opening info, when the user opens the app without internet connection. Also 2.) is more expensive then 1.) when you scale your app.
An advantage of 2.) would be, that you are more flexible when and what you send in your notification, since you can edit it on server side. 1.) would mean that it is coded in your app (at least until you build a synchronization mechanism for the variables) :-)

Amazon SNS console to push raw notification to WNS

I am testing out using AWS SNS to send push notifications to my windows app via SNS. I have done the work configuring the application and my endpoint. However, I am unable to figure out how to send a raw notification to my app. The JSON to create a badge update seems to work:
{
"WNS" : "<badge version\"1\" value\"23\"/>"
}
However, whenever I use the Raw message format, it seems to wrap the message I created and instead sends a toast message with the contents I entered. Is there any way in the console to send a pure Raw notification?
I.E. in the Raw message area I enter: 'test123', it sends a Toast notification with the following xml.
<toast><visual version="1"><binding template="ToastText01"><text id="1">test123</text></binding></visual></toast>

SignalR and one browser window for a session at a time

I have a situation where a user can modify an Excel like grid schedule online. I would like to be able to show a message stating that the schedule is being modified in another window. However, how can I do this with a window open, and if the previous window was closed with SignalR. For other sessions I just want to state another user is modifying the schedule.
It might be easiest to use localStorage to communicate between multiple tabs/windows a single user has open: http://www.codediesel.com/javascript/sharing-messages-and-data-across-windows-using-localstorage/
You can listen for the storage event which is triggered on every window a user has open on your site when you call localStorage.setItem or localStorage.removeItem.
Of course, it would still make sense to use SignalR to notify other users.
If you cannot use the localStorage API for some reason, you can still use SignalR to send a message to every window the user has open by using Clients.User(userName).... inside your Hub. By default, userName should match your user's IPrincipal.Identity.Name, but you can register your own IUserIdProvider to customize this: http://www.asp.net/signalr/overview/signalr-20/hubs-api/mapping-users-to-connections#IUserIdProvider

Google Glass Timeline notifications for In built actions and custom actions are not working after updation(of XE-16 glass update)

We have developed a google glass ware(timeline based) app. In that first we will send some timeline cards to the glass with some inbuilt menu items and custom menu items.
and we have configured the proxy url for getting notifications for time line.
It worked fine for so many days.
But After Google Glass XE-16 update we are not getting the timeline notifications
Can you please guide us inresolving the issue.
Hi Prisoner,
for inserting timeline we have used the following code:
global $base_url="http:\/\/mysite.com\/mirror";
$client = get_google_api_client();
$client->setAccessToken(get_credentials($_SESSION['userid'])); // A glass service for interacting with the Mirror API
$mirror_service = new Google_MirrorService($client);
$new_timeline_item = new Google_TimelineItem();
$new_timeline_item->setText('Hey I am testing new');
$notification = new Google_NotificationConfig();
$notification->setLevel("DEFAULT");
$new_timeline_item->setNotification($notification);
$menu_items = array();
$custom_menu_item = new Google_MenuItem();
$custom_menu_value = new Google_MenuValue();
$custom_menu_value->setDisplayName("Add Item");
$custom_menu_value->setIconUrl( $base_url . "/static/images/tulip.jpg");
$custom_menu_item->setValues(array($custom_menu_value));
$custom_menu_item->setAction("CUSTOM");
$custom_menu_item->setId("add_to_cart_item"); // This is how you identify it on the notification ping
array_push($menu_items, $custom_menu_item);
$new_timeline_item->setMenuItems($menu_items);
insert_timeline_item($mirror_service, $new_timeline_item, "image/jpeg", file_get_contents($base_url . "/static/images/tulip.jpg"));
for this we are trying to add new custom menus and built in menus like (pin,delete,share,send)
To subscribe to notifications we have used the Google glass Php mirror api function.
subscribe_to_notifications($mirror_service, "timeline", $_SESSION['userid'], $base_url . "/notify.php");
All these are working fine before XE-16 version update. After updation we are not able to get notification for time line card notifications
This is a known issue with sending image attachments. See details here:
https://code.google.com/p/google-glass-api/issues/detail?id=491
So the part of your code that has to change is:
insert_timeline_item($mirror_service, $new_timeline_item, "image/jpeg", file_get_contents($base_url . "/static/images/tulip.jpg"));
Needs to change to:
insert_timeline_item($mirror_service, $new_timeline_item, null, null);
And use setHTML instead of setText and include an img element with a src tag that points to a web URL. E.g.:
<img src="http://example.com/static/images/tulip.jpg" />
Note that you also have to factory reset your Glass. You can tell if you have the problem by trying to run a menu command and the spinning double arrow in the bottom right corner gets stuck and an a crash stack trace is visible on ADB logcat output on the Glass. So to fix the problem, first you have to not use image attachments, and second you have to reset the Glass to fix the broken timeline sync on the Glass.