WP7 send toast from one device to another - windows-phone-7

Just wondered if it was possible to send a toast from one WP7 phone to another.
Example of use:
User A presses a button on their phone to alert other users driving nearby with status "empty" that they are needed at the GPS location of User A
If anyone can provide some insight on if this is possible, and how it can be done, it would be great.
Thanks,

Can you?
No.
If I understand your question correctly, no it is not possible.
I understand your question to be "can I do this without having to implement something on a server somewhere?" And the answer to that is unfortunately "no".
What you will need to do as #softarn and #MrMDavidson alude to, you will need to implement something on the server.
But why not?
The reason for this is pretty simple. IF it was possible to do this, then it would open the door for abuse. Imagine if, without having to go through a Microsoft server, I could write a bit of code that would send push notifications constantly to all my users (who had downloaded my app of course). What happens if my users are on data plans that charge per bit? Well I've just screwed over a whole bunch of my users, and not only are they upset with me, they're upset with their stupid phone. Alternatively, what if Microsoft wants to give all windows phone users the option to get push notifications only every 15 minutes instead of immediately? Well, without operating as a go-between, Microsoft would be entirely unable to provide such functionality.
Here's how to fake it
So, in order to interact with toast notifications, it's a requirement that Microsoft gets to play middle man, so if needed, they can pull the plug on / monitor / regulate toast notifications on behalf of the user.
If you wanted to implement a bit of server code that emulated this behavior, that is certainly possible. As #MrMDavidson says, you'd basically need to take the following steps in the architecture of your app:
User's GPS location changes
WP7 app contacts a server that you own, notifying it that the user has moved
Your server code makes note of this, storing the data in a SQL database
After storing your new location, the server scans the SQL database for all other users of your app who are "nearby" and have their status set as "empty"
For each of the users in the database that match the criteria of being (a) nearby, and (b) having an empty status, the server code calls the user's "channel uri", sending the desired message
To your users, it's all the same
This would effectively accomplish your goal, and from the perspective of users, the experience would be seemless, and for all intents and purposes it will appear as if they got a notification directly from another user's phone.
Hope that clarifies things, I did assume you're familiar with the general workflow of sending Toast Notifications.
Happy coding!

Provided that User A's phone knows the push notification URI for User B's phone then, yes, you can send notifications from one phone to the other. However the question becomes; How do you distribute User B's notification URI to User A's phone? You'll either need an "offline" mechanism (email, for instance) or a server to act as a central repository. You're probably better off having a service layer over the top of the push notifications though to manage user-to-user relationships. Then User A's phone can say "Tell my friends that they're needed!". This can be an async-fire-and-forget call to your server. Your server can then implement retries and parallel execution to notify all User A's friends that they're needed at the location.

Yes of course it is possible. Read on to how push notifications work, though I don't think it will be as easy as you think. You'll need (I think) a server that the phones communicate through.

Related

Store conversations in order to notify users after a bot restart

I've manage to send notification to Teams users through the Chatbot.
In order to send notification, you need to persist the conversation in order to have a channel to push the message or anything else. The persistence of the conversation are done in memory, so, after i restart the chatbot, i'm not able anymore to notify any user until they come back to chat with the bot and store the conversation again.
It's possible to save the conversation on a storage like CosmosDB or BlobStorage using this library https://github.com/microsoft/botbuilder-js/tree/main/libraries/botbuilder-azure?
What i understand about this library, it has been developed to persist some state of the conversation, not the conversation itself.
Maybe there is another way to retrieve conversations (or create from scratch with some stored data)?
The samples you see online store the data in memory because they are -just- samples, and it's much easier to keep the sample self-contained if it doesn't have a dependency on you setting up a database just to get the sample running.
In the real world the data -must- be kept somewhere else, for all practical purposes, such as Cosmos, Blob or other. In addition, you actually don't need the -entire- conversation reference - see here a more detailed answer I wrote a few months ago with some further references: Sending proactive messages from an outside process to organizational users via Teams chat bot
Also worth noting, the samples and docs show to get the data you need in the conversationUpdate from the user (i.e. when they install your bot), which is definitely easiest, but if you've lost it now (because your bot has reset), you get the same data from the user every time they send a message to your bot - you can save it at that time if you haven't saved it already.

How to get user device type accessing skype for business bot built in MS Bot Framework

Does anyone know how to get the information about user device that access the bot deployed in S4B channel and built using MS Bot Framework (C#).
I need to know about the options to detect the user device (Device type and OS) accessing the Skype For Business Bot. If there's a way to know whether user device is desktop or mobile. In bot framework the User-Agent header formatted similar to the string below:
SFBUserAgent (Microsoft-BotFramework/3.1+https://botframework.com/ua)
(The user agent from Connector returns the following:
fxversion/4.7.2563.0 osname/windowsserver2016datacenter osversion/6.3.14393 microsoft.bot.connector.connectorclient/3.14.1.1)
I want to know if UCWA can be used to detect the device type accessing Skype For Business bot.
UCWA is not able to do so, actually no client or client-facing api can provide such information. It's because User-Agent information is not part of the presence so the client doesn't publish it to other clients. The main purpose of this User-Agent information is for monitoring reporting purpose.
However there is still some space from server side to allow us to do something. If you have access to the Skype for Business server, you have several workarounds.
Get-CsConnections.ps1 is a well-known script to pull current logged in user from Lync server side. It was written in 2011 while we only had Lync 2010, but good news is it works fine with new version of Lync like Lync Server 2013, Skype for Business server 2015. This script needs to be run in Lync/Skype management shell or a Powershell session with Lync/Skype modules imported. It needs to run by using an Lync/Skype admin account.
To retrieve user agent for a particular user by using sip uri.
$UserHomePool = (Get-CsUser -Identity [sip address]).RegistrarPool
Get-CsConnections.ps1 -SipAddress [sip address] -Pool $UserHomePool
Connections.ps1 is the prototype script of the above Get-CsConnections.ps1, it's simpler but doesn't provide advanced features. You can look at it and decide which one you need.
Do it yourself. If you don't want to use 3rd party script or just want to do it in a simplest and pure way, it's possible to do it by querying it from server database. Lync/Skype server stores this user agent information in the dynamic database in Front End server. It's in the table dbo.RegistrarEndpoint of the database rtcdyn of the instance rtclocal.
Please notice that there is no public document about the database schema so you need to do a little guess and hacking yourself. Good news is all data in the database is strored in readable format so it shouldn't be a big issue.
In a very rare chance that you are not wanting this information in real-time, the monitoring report and database can be the best approach. It's not real-time data, the data is generated within 10 mins after a conversation is ended.
If you want to get it from monitoring database, you should look at SessionDetails view for P2P conversation and ConferenceSessionDetails for conference conversation. There are straighforward fields in the views called something like UserClientType to point out the user agent information for the certain session.
At last one thing I would like to remind is Skype allows user to logged in multiple clients simultaneously, so no matter how you make it work you still need to face the question which logged in client really matters to you if the user has multiple clients logged in.

User Sessions across devices on Google Analytics Universal

I have a quick question...may sound a little straightforward but still want to throw it out there.
I am aware that typically a session is limited to a single browser and client instance.
With that said though say a user signs up on your mobile device and starts to do some shopping...maybe adds something to their cart and then decides that they want to complete the purchase on their desktop.
I have some people that want to call this a single session while technically its a new session.
Does this make any sense?
In theory this should work with Universal Analytics, at least for logged in users ( I assume that your users are logged in if they want to buy).
You can pass a client id as a parameter when you create the tracker. The client id is supposed to be formatted as UUID, so you'd have to store that along with your real client id in you backend system and pass it in to the tracker as a part of the confuguration json object (optional third parameter in ga create). Apparently this get retroactively applied to the running session (no written source for that but I recently attented a conference where a google employee said as much, so I assume this is legit).
So as far as it concerns data collection UA is ready for multidevice. I frankly do not know to what extent this already works in the Analytics Interface.
I recently had a glimpse at a Analytics Premium Account which already had some new multdevice reports. I don't know if the fact that those reports are, at least for the moment, absent from the free version means that multidevice tracking does not work yet on the free version (those reports are along the line of Venn diagramms for "How many users used more than one device" and the like).

Windows Phone 7 - how to send files from/to the app?

I'm trying to write the most basic application for windows phone 7 and want to be able to send files (specifically XML in case that changes anything) to my app. Currently I have a WCF service setup so I can send push notifications through it. The problem is that there is a limit on the amount of raw data I can send via a push notification.
My solution to this is to send the initial push notification (either tile or raw) to alert my application that I want to send a file to it and then make the app somehow communicate with a server (everything is on my personal computer btw - I'm just trying to figure out how things work) - from which the app will recieve/download the files.
What is the easiest way to accomplish this? Note that I'm not concerned with security or anything like that.
Clarification - the question is essentialy: how do I transfer files from/to a server to/from the phone? Assume everything else was handled - the app is up and running and the user has given or will give permissions to every possible thing he may give his permission to.
Unfortunately, the total size of a push notification (including HTTP headers) is 1kb. This means that it can't be used to send large amounts of data.
Instead of sending the whole file, send a notification (raw or toast—as appropriate) which should be treated by the application as a trigger to go and retrieve the new file/data/whatever from the server. It may also be worth checking for new messages when your app starts. However, if when you start the app it will notify the server that it is ready to receive raw notifications and such messages will be sent indicating new content is available, it may be unnecessary to add this extra check.
To transfer files to/from the phone you will need to use either HttpWebRequest or WebClient as this is the only way to use HTTP on the device and HTTP is the only protocol currently available to transfer data.
While WebClient may appear to be easier to use than HttpWebRequest it is less flexible and will automatically perform it's callback on the UI thread and if you're downloading files in the background you almost certainly don't want this.
There is no way to transfer files to/from a conencted PC and have them exclusively available to your app.
First of all: you won't be able to do this approach automatically - the user will have to open your app to do that because WP7 SDK doesn't allow your app to run on background/start automatically once a push notification is received.
The only way to communicate with your server, at this point in time, is web services. If I were you, I would check for new information available once the app is started, if there is new info, I would call one or more web services which would return me all the information that I need.
If you want, you can use a timer to check for information periodically.
As I said, it will only work while your app is running (check the app lifecycle if you don't know it yet), WP7 doesn't allow apps to run in background, that is a serious limitation IMHO.
Good Luck,
Oscar
Maybe a little bit off topic but when I was thinking about file sharing in my WP7 app, I found two approaches:
Integrate an app with Dropbox
Use advanced explorer for WP7
You can use the WebClient class and the DownloadStringAsync method in order to download data from a web service .
A good example of this is Scott Guthrie's Twitter app from MIX10 .
George

Using Jabber to send network messages

(Also asked over on ServerFault, where I was advised to post it here too)
We have a requirement to send desktop alerts to various users (compliance, production) across a network when other users have submitted content online for a report.
At present we are using NET SEND but this has no guarantee of delivery and has proved unreliable from both client and server perspective (and I gather will be unsupported in later versions of Windows; we are currently running XP).
We are considering a Jabber-based solution but has anyone used a Jabber client to pop up alert messages on the screen like NET SEND does, as opposed to just bringing a chat window to the front or displaying a temporary 'toast' message near the system tray.
We need the alert message to be persistent and only dismissed by the user, indicating they have seen it. Toast-style pop-ups would be fine as long as it was not only for a limited time and again had to be dismissed by the user.
Any solutions?
Openfire is a java based Jabber server that seems to be targeted to a corporate/business environment and provides the "toast" message feature with their Spark client. They also offer several other useful business-focused features.
Offline message delivery is not guaranteed by XMPP specification. It depends on concrete server implementation. Moreover, it has cost in supporting user accounts.
As an out-of-box solution it is fine, but since we are in development community, I would
consider building alert system using MessageQueue for guaranteed delivery.
The message-delivery semantics of XMPP are liable to be a good fit for your application, since you're not talking about financial transactions that require fiduciary-level delivery guarantees. It will certainly be better than NET SEND by a lot.
Write a simple client that listens for messages and does the pop-ups in whatever format you want, and have the program run in the background, perhaps with a tray icon. Writing something like that with Jabber-Net would be the work of a few hours, for example.

Resources