Link to home
Start Free TrialLog in
Avatar of jsvb1977
jsvb1977

asked on

How to monitor file count in direcory and push notifications to windows phone

I am building a Windows Phone App for company use and the overview is this:

Monitor a directory every x seconds and push notifications to Windows Phone that represent the file count inside the directory.

Now, if this was a Windows Service, or a Windows Application, it would likely be easy to do this, but I think I will need to accomplish this in a Web Service...

I was thinking something along the lines of:
FileSystemWatcher

Open in new window


but i struggle with the use of this in a Web Service. How would I get the Web Service to poll this directory on it's own?

If I understand correctly, Web Services are 'static' and will only serve out data when requested?

Is using a Web Service the best way to accomplish my task or is there some other way. Some of the Online Resources for Windows Phone I have been using to learn more about this are:

http://msdn.microsoft.com/en-us/library/ff402537(v=VS.92).aspx
http://msdn.microsoft.com/en-us/library/ff402558%28VS.92%29.aspx

Note: the web service is in .net 2.0 and the Windows Phone App is .Net 4.0 Silverlight...
Avatar of dj_alik
dj_alik

i think you can simple make DispatcherTimer  and call the webservice to rerieve directory  info every x time

another solution  Push Notifications  - cloud solution that you already checked.






Avatar of jsvb1977

ASKER

Can you elaborate on DispatcherTimer?
SOLUTION
Avatar of dj_alik
dj_alik

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Good stuff, thanks. This will be useful inside the Windows Phone App [when it is running] -- I still need to figure out the best way to monitor a windows directory and send push notifications to the Windows Phone based on file count.

The reason I don't want the Dispatcher Running in the background is to prevent the Windows Phone Application from using up resources when it is not nececssary.

By sending Push notifications conditiionally I will be able to leave the Phone Resources [like battery] alone.

Make sense?

Anyway, unless you can come up with anything as it relates to sending push notifiations I will accept your answer above and keep digging...

WFC Service seems like the next likely candidate for me to investigate, but I havn't seen any examples of using a WFC Service to monitor a windows directory...

Jason
you cannot make push notification withour cloud service
duplex binding is not supporting in windows phone (in silverlight is available)

about WCF and windows phone you can see  Long Polling Chat example
http://xyzzer.wordpress.com/2011/03/10/real-time-client-server-communication-on-windows-phone-with-long-polling/
dj_alik,

What do you mean
"you cannot make push notification withour cloud service
duplex binding is not supporting in windows phone"

I am new to this so correct me if I am wrong, but as i understand it: as long as I know the URI of the WP App I should be able to send Push Notifications to it, right?

Now, if that means I have to write a windows service or something similar [WCF?], just so long as I am able to talk to the WP App's URI, I should be able to send Push notifications?

I have only sent Push Notifications to the phone emulator in dev [using an asp.net web form] but i imagine if i am able to use similar code in a windows service or maybe a WCF that should be ok...
[Code came from here: http://msdn.microsoft.com/en-us/library/hh202970(v=VS.92).aspx ]

Again, help me to understand...
Either way -- you have been extremely helpful.

Jason
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial