How can I send arbitrary data through a push notification? - windows-phone-8

I need to send some data to a Windows Phone 8 app. I want to implement this through push notifications.
I'm currently serializing my data as JSON and place it in the wp:Param field in the push notification. While my app is running in the foreground, I receive the notification just fine, can deserialize the field and use the data.
However, when my app isn't in the foreground, the toast won't be displayed at all. When I remove the wp:Param field from the notification, the toast will appear again, so I'm assuming WP8 doesn't like me putting JSON data in the wp:Param field.
How can I send my data and still have the toast appear if my app isn't in the foreground.

The value provided in wp:Param has to look like a URL for Windows Phone to process it and display the toast.
The valid formats are:
/page1.xaml – Defines the screen to navigate to in the app when the app starts. The string must begin with a "/".
/page1.xaml?value1=1234 &value2=9876 – Defines the screen to navigate to when the app starts, along with name/value pairs of info. The string must begin with a "/".
?value1=1234 &value2=9876 – Contains name/value pairs of info passed to the default start screen of the app. The string must begin with a "?".

Related

Azure FCM NotificationHubClient Configuration for Data Payload?

Using
NotificationHubClient hub = NotificationHubClient.CreateClientFromConnectionString(notificationHubConnection, notificationHubName, enableTestSend);
NotificationOutcome outcome = await hub.SendDirectNotificationAsync(fcmNotification, deviceUri);
I am able to send and receive notifications using FCM via the Azure hub to a Xamarin Android app, finally. However the payload is not present in the received RemoteMessage even though the sent fcmNotification json payload looks good and passes validation. I am basically looking at the RemoteMessage.Data property, but not finding the expected payload array. Looking at RemoteMessage structure, I haven't found any part of the payload array either.
I know that the Azure hub manipulates the notification by adding the necessary headers like content type, e.g. "application/json". Are there any other settings that are needed to be passed to enable the "data" only payload?
Additional settings are not necessary, but the format of the entire notification contents has to have this type of structure:
"{ \"data\":{ \"A\": \"aaa\",\"B\": \"bbb\",\"C\": \"ccc\",\"D\": \"ddd\",\"E\": \"eee\",\"F\": \"fff\"}}"
The number of data elements is up to you. The data element name can be anything as well as the associated content except for the need for backslash usage for special characters. Both the element name and content can be inserted using variables creating a traditional composite string.
What is especially important is the inserted spaces as shown. Also note that traditional Json formatting is not acceptable because of the need for those spaces.

Logic Apps - Data Operations Parse JSON not parsing Content from Event Hub

I am trying to create a logic app that connects to event hub and sends an email whenever an event is added to the event hub.
I was able to get it working when connecting EH to outlook connectors. I want to be able to parse the data and extract certain fields from the event content. I look up online to use Parse JSON from the Data Operations action but it seems not to be able to parse the content
I tried using Body as the input and it succeeds but the event fields are empty, indicating me that it not getting the event data.
Any ideas?
I have a test and reproduce your problem, suppose your content-type is application/octet-stream, if yes the content will be encoded with base64, then the Parse_JSON input content should be decodeBase64(triggerBody()?['ContentData']).
Also you could change the content type to application/json or text/plain, it will just work.

swift 3: connect to database using json format

I want to POST a JSON web request to the webserver through an ios application when I press on a button.
Now, there is a field in the database of the webserver, and the field is initialised with the value false. When the button is pressed in the app (meaning: when the POST request reaches the webserver), I have to change that fields value into true.
Can you please give me a code or a video that can help me to do this?

Send custom property with value as JSON array

We want to send some events to Application Insights with data showing which features a user owns, and are available for the session. These are variable, and the list of items will probably grow/change as we continue deploying updates. Currently we do this by building a list of properties dynamically at start-up, with values of Available/True.
Since AI fromats each event data as JSON, we thought it would be interesting to send through custom data as JSON so it can be processed in a similar fashion. Having tried to send data as JSON though, we bumped into an issue where AI seems to send through escape characters in the strings:
Eg. if we send a property through with JSON like:
{"Property":[{"Value1"},..]}
It gets saved in AI as:
{\"Property\":[{\"Value1\"},..]} ).
Has anyone successfully sent custom JSON to AI, or is the platform specifically trying to safeguard against such usage? In our case, where we parse the data out in Power BI, it would simplify and speed up a lot some queries by being able to send a JSON array.
AI treats custom properties as strings, you'd have to stringify any json you want to send (and keep it under the length limit for custom property sizes), and then re-parse it on the other side.

webRequest API not capturing all page requests from application

I am trying to download JSON data from a web application. The URL/API is static and I can use it to call the webpage that returns the data. There is a session variable parameter that needs to be added to the URL/API call to connect to the server and download the JSON data which is created when you launch the application, but times out if the application is not actively used. My current process is to open the developer tools, launch the web application and when the specific JSON request is made I copy the parameter value then add it to a script that mimics the page request and downloads the JSON data.
I am trying to avoid manually copying and pasting this session variable parameter. I want to be able to automatically capture the web request, parse out the value that I need, set a cookie on my machine and then pick up the cookie by a php script to initiate the JSON data download with the valid session value.
I have looked into creating an extension in chrome using the chrome.webRequest.onResponseStarted with the following code:
chrome.webRequest.onCompleted.addListener(function(details) {
console.log(details);
chrome.cookies.set(
{ url: "http://localhost/MySite/", name: "MyCookie", value: "Tested" }
);
}, {urls:["<all_urls>"]} );
This code works for the main web requests but it doesn’t pick up all the JSON data requests that are made by the application. The application is swf format which is most likely the problem, but I can see the requests in the Network Panel tab of the Developer Tools and they are captured using chrome://net-internals which that leads me to believe that I should be able to capture them somehow.
I have looked into chrome.devtools.network but I cannot seem to figure out how that is supposed to work. Any advice or direction would be greatly appreciated.