Get tile notifications count Windows phone - c#

Is there a way to get the current count of Tile notifications on Windows Phone and update it locally. I need to update the tile count locally if I have read a notification via push notification / toast without hitting the push service from the server end.
Say for eg. I have the tile count 6. As soon as I receive a push notification and I click on it, I want the tile count to be reduced by 1. How do I achieve this?

Unfortunately you cannot read out information from a ShellTile. You can only update them.
What you could do is saving the information of the counter or anything else on your server that pushes. It can preperate the notification as you wish. I guess this is not the way you want to deal with it but it is the only way.

Related

How to replace phonenumber by name for incoming calls in xamarin?

I've saved contacts on a server in an uncommom format. These contacts are regularly evaluated and changed. Using a xamarin app on my android device I want to synchrously connect a phonenumber to a name.
Using a BroadcastReceiver that captures all incoming call I'm able to display a toast and a notification showing the name related to the number.
Because the toast disappear fast and the notification isn't easy available during ringing I search for another way to display the name connected to a number. The best way would be to replace the displayed number on the dialer.

Is there a way to programatically force Windows to search for new WiFi nextworks?

I have a (C#) process which looks for the presence of an SSID, and connects if it appears.
As a process it works, but it does take a long time for the SSID to appear in the list. IF I click on the WiFi icon in Windows to show available networks, it appears to then search and the SSID appears. If I leave it for say 30-60 seconds, then it'll eventually appear.
So, is there a way to programatically do whatever it is that happens when you manually click on the WiFi icon in the taskbar?
Windows must be interrogated about possible connections to refresh the list. You can do it this way (taken from Update Wifi networks programmatically):
var client = new WlanClient();
foreach (WlanInterface wlan in client.Interfaces)
wlan.Scan();

my roaming data dosen't sync between devices

I made a UWP application. I use the roamingdata.I save the setting by this:
public static void WriteCode(string pwd)
{
ApplicationDataContainer RoamingSettings = ApplicationData.Current.RoamingSettings;
RoamingSettings.Values["Code"] = EncryptHelper.PwdEncrypt(pwd);
}
I read the setting by this:
public static string GetCode()
{
ApplicationDataContainer RoamingSettings = ApplicationData.Current.RoamingSettings;
string str = (String)RoamingSettings.Values["Code"];
if (!String.IsNullOrEmpty(str))
return str;
else
return EncryptHelper.PwdEncrypt("123");
}
I complete the application and upload to windows store and passed check. Then I download this app on my phone.
I change the ApplicationData.Current.RoamingSettings on phone. I write something to the ApplicationData.Current.RoamingFolder on my phone.
Next I closed the app on my phone and download the app on my PC. But when I opened the app on my PC, I found that the ApplicationData.Current.RoamingSettings and the ApplicationData.Current.RoamingFolder didn't change anything.
I checked the C:\Users\XXX\AppData\Local\Packages\XXX\RoamingState on my PC,there was nothing. I checked C:\Users\XXX\AppData\Local\Packages\XX\Settings on my PC,there was roaming.lock and settings.dat. But I can't read the lastest settings and roaming data that I haved added on my phone anymore.
I have waited for 2 hours, there was no change on my PC.
there is something that I should state first:
1 All the deploy work was done by windows store.
2 I check my PC application setting after closed the app on phone. I even shut down my mobile phone to observe the change to my PC.
what's wrong with my code? or what's wrong with the roamingdata mechanism? I need an answer, thank you!
The code you've posted is right. However, there are some possible reasons for the failure of roaming data sync:
Any user can benefit from roaming app data if they use a Microsoft account to log on to their device. However, users and group policy administrators can switch off roaming app data on a device at any time. If a user chooses not to use a Microsoft account or disables roaming data capabilities, she will still be able to use your app, but app data be local to each device.
Keep in mind that roaming data is associated with a user's Microsoft account. Roaming data will only sync if a user logs into her devices using the same Microsoft account and installs the app on several devices.
Don't use roaming for data that relies on instant syncing. Windows doesn't guarantee an instant sync; roaming could be significantly delayed if a user is offline or on a high latency network.
Roaming of settings is not instant. The system weighs several factors when determining when to send the data. We can detect whether new roaming data has arrived on the local device by listening for the ApplicationData.DataChanged event. This event occurs when app data has just finished syncing from the cloud. Any time a device receives new roaming data, the DataChanged event will fire, passing in the updated ApplicationData object. This lets us make any adjustments to our app when data has changed.
For important, time critical settings, use the HighPriority setting associated with RoamingSettings like following:
// High Priority setting, for example, last page position in book reader app
roamingSettings.values["HighPriority"] = "65";
This is a special key in the roaming settings we can use for data we need to sync immediately. Adding HighPriority to any setting will have it synced as quickly as possible.
Don't roam large sets of app data. There's a limit to the amount of app data an app may roam; use RoamingStorageQuota property to get this maximum. If an app hits this limit, no data can roam until the size of the app data store no longer exceeds the limit.
The name of each setting can be 255 characters in length at most. Each setting can be up to 8K bytes in size and each composite setting can be up to 64K bytes in size. The sync engine may limit the total size of settings and files that can roam. It’s important to keep track of the amount of data you’re attempting to roam. If the total amount of data you’re attempting to sync exceeds the limit, then nothing will sync between the devices.
App data only roams between installed apps with the same version number. For example, devices on version 2 will transition data between each other and devices on version 3 will do the same, but no roaming will occur between a device running version 2 and a device running version 3. If you install a new app that utilized various version numbers on other devices, the newly installed app will sync the app data associated with the highest version number.
If you are using versioning in your roaming date, please make sure you are dealing with the right version.
These are some possible reasons that can cause roaming data doesn't sync between devices. For more info, please check Roaming data in Store and retrieve settings and other app data.

C# Application exit

I want to know how i can do something when exiting a windows application, i wan to run a query UPDATE users SET on = 0; so i know when people are on my program
Main reason for this is i want to do a list of online people for my chat system so they know who they are chatting to i will be doing this with a foreach of where on = 1 in my mysql database users table
i have tryed doing my own close button but what do i do when it is force closed it can be force closed by task manager or if their computer restarts
A program can be killed, an internet connection can go dead or a nuclear bomb could be dropped on a town. The point is, the client can't always do the update.
Update your schema to have a "LastTimeSeen" column and have the other clients use this to decide if a peer is missing and then age that peer out of the system.
Handle the Form.Closing event:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.closing.aspx

Hiding the Toast Notification when a push notification is received

I am using Windows azure push notifications. Every time a new notification is received a Toast is displayed with the information received, is there anyway I can disable this feature programmatically? The reason I want this is because I am trying to develop a FPS game and I am using the Push notifications to update locations, for obvious reasons I don't want the data received to get displayed.
You can hide the toast notification by setting the expiration time of the ToastNotification to DateTime.Now, that way it would expire as soon as it is displayed. You can do that by using the PushNotificationReceivedEventArgs args that is passed.
args.ToastNotification.ExpirationTime = DateTime.Now;
A better solution as provided by Gaurav is to use
args.Cancel=true;
What you could do is consume the PushNotificationReceived event and then handle it there. I did the same for one sample chat application I built. Look for the code for app.xaml.cs in my blog post here: http://gauravmantri.com/2012/08/30/how-i-built-an-awesome-chat-application-for-windows-8-with-windows-azure-mobile-service/.

Categories

Resources