How can I launch the Alarms App through a Universal Windows App - win-universal-app

I am trying to launch the default Alarms App somewhere in my app through an action the user performs. I know you can now add your own alarms and notifications but I want the user to be able to use the default Alarms App.
How would I go about doing this?

You can use Launcher class to launch the Alarms App by uri as follows:
await Windows.System.Launcher.LaunchUriAsync(new Uri(#"ms-clock:"));
The uri of Alarms&CLock is ms-clock in system. You can find the protocol in Settings->System->Default Apps->Choose default app by protocol in a PC device. Pay attention the Alarm&Clock app should be existed in the device. More details you can reference:Launch the default app for a URI

With the Universal Application Model it is not possible to launch other apps at random. You can only launch an app if it enables deep-linking.
Here is a great article about deep-linking and app to app communication in general.
For your particular question, #Sunteen provided a great answer as to how to open the alarms app but more importantly, how you can find which apps you can open and what their protocol extension is.

Related

How to create web push notification from server to all notification granted users?

I am using Angular CLI latest version and NodeJS, want to archive web push notification, we got few documentations but gives error, May I know any Documentation for web push notification which supports angular and nodejs.
The requirements are send push notification to all users who notification granted while browser closed as well.
Sample docs :
https://ciphertrick.com/2017/03/14/browser-push-notifications-in-angular-applications/ (getting error pushNotificationModule not exported)
https://www.npmjs.com/package/angular2-notifications (Not clear for CLI)
The Angular2+ directive angular2-notifications is doing only the last part showing the message in UI/UX. And that is the least of your challenges.
You say:
The requirements are send push notification to all users who
notification granted while browser closed as well
The part 'while browser closed as well' is the tricky part.
This means you need a Service Worker. A Service Worker is a script that your browser runs in the background, to which the message is being pushed when the browser is closed. For a nice introduction to Service Workers, read this. Angular has a Service Workers implemented in production version since 5.0.0. Klik here to read more about it.
I don't think setting up a WebSocket connection (like socket.io) from Node to a Service Worker is possible. It's complicated, some people say it's possible, others say no. See this for more info. I would at least say that it is not stable enough, so you need a 'real' push notification.
You can use a push notification provider to do the job. Click here for a list of them. You pay for these services.
If you want to do it yourself (free of costs) you can use Google's cross-platform messaging solution Firebase Cloud Messaging (FCM) (the successor of Google Cloud Messaging (GCM)).
To connect your NodeJS server with the FCM you can use different libraries e.g. node-pushserver and many others.

How safe is protocol activation? How can i ensure security when launching a Windows Store 8.1 app from a desktop app using protocol activation?

I must launch the Windows Store 8.1 app from a desktop application. I came across the concept of protocol activation where the user can launch the store app using the protocol name and pass parameters to the store app from desktop application. Is it safe to launch this way? if i can implement some security mechanism(security token) to secure the communication, how do i go about it?
Protocol activation is not safe per se.
The thing is the calling app can never be sure which application registered for a certain protocol on the system. Therefore the "evil twin" problem exists: An app could pretend to be the expected application for a certain protocol but in fact isn't. E.g. I could write an app and register as "spotify" or "facebook" or "bing" and could try to steal the passed parameters.
It depends on what kind of hazard you are trying to avoid. The best option is to not pass sensitive data with the protocol launcher . Instead pass only data that only the true target application can "translate" into sensitive data. (e.g. an encrypted ID)
On target application side it's the same thing: The called application can not be sure who's the caller. It can not be validated or restricted.
Both changes with AppLaunchers for Windows 10: You can specify the package family name of the target application and you can whitelist the calling application with Windows 10.

What module / service should I use to push message from Node.js server to Mobile App written in Unity?

Here is my set up:
Node.js server with RedisCloud, and client mobile app written in Unity C#.
I'm trying to push message from Node.js server to UnityC#.
At first, I try to get Unity access RedisDB directly but that is too dangerous having Client connecting to DB, and open the port.
So, what module works well between Node.js & Unity for message pub/sub? or 3rd party services that takes data from Redis, and push to Client?
I think socket.io will work but it seems just too much work for Client to write code handling that.
Is there something like Firebase or Photon, but instead using Firebase DB, point to my own RedisDB?
Thanks.
If your mobile client is for iOS then you should use "Apple Push Notifications", if Android, you should use "Google Cloud Messaging".
You can easily find modules for these tasks on npm, for example: https://www.npmjs.com/package/gcm
Use a Cloud service like Pusher or Realtime (the company I work for). Simply subscribe a channel on your mobile app using the Realtime Unity SDK and publish the messages from your server using the Node.js SDK. You don't need to worry about the dirty backend details (security, scalability,...)
More at http://framework.realtime.co/messaging

How to check if a ChromeCast Session is already in progress

The use case is that a user starts playback from their iPhone, lets say, and then picks up their iPad (both running my app) and wants to contect to and control the running video from this other iOS device.
On iOS, I do not see any way to determine if there is a instance of my receiver app already running on the Google ChromeCast device. Once I create my session it seems the only thing I can do is to attach a new protocol message stream, which interrupts whatever might be playing already.
It this suppose to be handled in the iOS client side Framework, perhaps there is some coding I need to do in the HTML receiver app?
Thanks.
There is a way outside the API to determine if an app is running. Do a HTTP GET on the apps URL for the ChromeCast IP address: http://192.168.0.x:8008/apps/
If the HTTP response is 200, nothing is running. If the HTTP response is 204, then an app is running and the HTTP response would be redirected to a URL like: http://192.168.0.x:8008/apps/GoogleMusic
Which tells you which app is running.
Interestingly, Google Play Music cannot be controlled by 2 devices simultaneously, but YouTube can. I suspect Play Music is using RAMP which is what the Cast SDK does for media streams. YouTube could be using a proprietary message stream to control the media playback. So you might have to do the same if you want to have the an app on a device controlled by multiple sender apps.
One method is to check the playStatus after you start your session and before you initiate a loadMedia(). If your app is already running - it should return a non-nil (ie. IDLE, PLAYING, ...) result.

NSUserDefaultsDidChangeNotification and multitasking issue

I am using Settings app to store application settings. I also userdefaults to store internal application settings (which are not exposed in Settings app). For eg, I use user defaults to store the last tab bar index which is not exposed in Settings app.
I am subscribing to NSUserDefaultsDidChangeNotification to listen to any changes in settings while my app is in background and that works fine.
The issue is that when I update user defaults (for my internal application setting parameters) from within my app, this also triggers NSUserDefaultsDidChangeNotification and which I do not want.
Is it possible to just listen to change in settings from Settings app and not from within the application?
Is it possible to listen to the notification only when the app is in background? I tried to subscribe to notification only in applicationWillResignActive (just before moving into background) (and that works fine for registration), but I could not find a way to deregister once the application is made Active again (applicationDidMakeActive does not seem to be the correct callback since notifications are delivered after this callback).
Or is there some other simple way to achieve this?
applicationDidMakeActive? You must mean applicationDidBecomeActive.
You might consider implementing applicationDidEnterBackground and applicationWillEnterForeground instead of applicationWillResignActive and applicationDidBecomeActive.
The "Active" methods are also called when the app starts and ends, which mean you will stop listening to the notification once it starts (you weren't actually listening to this notification) and if you implement applicationDidBecomeActive you will start listening to the notification once your application ends (for nothing).

Resources