Windows Phone - functionality questions ( make a call from app, persistent connection etc ) - windows

The company I work for is considering to build an application for Windows Phone. Well, actually we plan to build an universal app ( for phone, tablet and PC ).
There are some requirements ( especially for Phone version ), so I would like to clarify few things before allocating resources & hiring people.
I would be very grateful, if some Windows expert goes through these requirements and confirm that this is possible.
So:
1) We need to launch a call within the application.
I've found this solution:
Make a phone call in Windows Phone 8.1
The question: is it possible to launch a call without a prompt? As far as I understand this solution prompts a question to user, if he wants to call or not. Our flow and design is made in a way, that this prompt will be redundant ( of course, we launch a call on user's behalf ).
2) We need to maintain internet persistent connection and be able to react if some message comes using this persistent connection. I've checked PubNub and it seems that everything is OK and PubNub provides SDK for Windows Phone.
Important: this is not VoIP application, so it might get complicated if Microsoft has some policies that persistent connection might be used only by VoIP application ( Apple has these policies ).
Important thing: Persistent connection should stay connected, if application goes background, so there should be no "cut off".
3) We should be able to present some notification ( with sound alarm ) to user and launch the app if he "accepts" the notification. Basically, we should be able to send some message to the device using PubNub or even Microsoft WNS service for pushes and present the notification on the device. Like "Local Notification" in iOS.
Any help would be highly appreciated.
Thank you in advance.
Best Regards,
Maksim

1)Unfortunately on Windows Phone you can't start a call without the system prompt.. It's for security..
2)I can't help you here..
3)Of course you can send notification to a device. This notifications are called toast notification.
A notification's custom sound can't be setted within the app, you have to load the sound on a server or let the user decide (he can change the sound in the system settings). If you don't need a custom sound.. no problem, it'll be used the default ones and you don't have to worry about anything.
I use Parse.com to send push notifications or you can even run a sheduled task every 30 mins on the user's phone(maybe is not appropriate for your application).
In the notification you can also set the property navigationUri to open the app on a defined page.
Unfortunately you can't still customize the notification aspect(you'll be able to do it in Windows 10) and you can see the default aspect here: http://www.codeproject.com/KB/windows-phone-7/ToastNotification/PushNotification.png

Related

Wear Actions execute very slow or not at all when phone is in doze mode

I am building an Android App to control power outlets with a smartphone. The app features an Android Wear app so people can control their lights right from their wrist.
When the user wants to control a light I send a String action via the MessageApi from the smartwatch to the smartphone, which receives this action in a WearableListenerService and sends the appropriate network signal to the power outlet/gateway in an AsyncTask.
This works fine as long as the phone has not been in idle for too long. However if the phone is still on the table for too long and doze kicks in Wear actions do execute very slow or sometimes not at all. I guess this is in part intended behavior however it is not practical in my case as the user cant wait that long for his lights to turn on if he wants to enter a dark room.
I am aware that doze completely cuts the networking for everything except FCM/GCM if you are not on the doze whitelist. But even when my app is on this whitelist and the networking part works actions can take a long time to execute on the phone.
So my specific question is:
Whats the recommended way to handle this scenario, where an action from a wearable device needs to be done via network on the connected smartphone which is in doze mode?
Is there a way to exit doze for a quick amount of time to execute calculations triggered by the wearable companion app faster?
I know the AlarmManager has a new method that works even in doze mode, but will this fix the processing delay too? Firing an alarm after receiving a MessageEvent from MessagApi seems like a workaround to me.
Or maybe is an AsyncTask just the wrong way to handle background networking and thats where the delay comes from?
Actually, there are a few options that you can do to handle Doze's effects as given in Adapting your app to Doze. You may want to consider the following options:
If your app requires a persistent connection to the network to receive messages, you should use Google Cloud Messaging (GCM) if possible.
GCM is optimized to work with Doze and App Standby idle modes by means of high-priority GCM messages. GCM high-priority messages let you reliably wake your app to access the network, even if the user’s device is in Doze or the app is in App Standby mode.
To help with scheduling alarms, Android 6.0 (API level 23) introduces two new AlarmManager methods: setAndAllowWhileIdle() and setExactAndAllowWhileIdle(). With these methods, you can set alarms that will fire even if the device is in Doze.
However, please note that with these methods, neither setAndAllowWhileIdle() nor setExactAndAllowWhileIdle() can fire alarms more than once per 9 minutes, per app.
Please try going through Optimizing for Doze and App Standby for a more detailed information or discussion.
In addition to these given documentations, the same options in handling Doze were also given and discussed in Diving into Doze Mode for Developers which might also help.

Windows Universal Platform: Background task to check email

I want to develop an app that has a background task that checks email servers (POP, IMAP, etc) for new email.
From what I can tell of background task, it is only allowed to run for a short time, and can be started only every 15 minutes if it is a timertrigger.
Since I want this app to run on all Windows devices, what is that proper approach to having a background task that can do this? It doesn't seem possible at this point.
But since Windows devices are able to check email in the background, there must be a way. Does anyone have any insights?
What you wish to achieve is a near real time notification of user about a mail he received . You are right that Windows doesn't allow a background task to run at intervals lesser than 15 minutes . What you are looking for is Windows Push Notification Service which can be used to send notifications from your own cloud service onto the device
It is not possible to use a background task working all time to get in real time the new emails in your case.
You must implement another approach may be using your own backend to implement push notifications to send a new notification when a new email is received.
If your provider has an API you can use it.

Accessing NFC Events on Windows service

I have been using Windows APIs for NFC communication. I am successful in getting and sending NFC messages from Windows PC, using a local console app. However, I want the communication to be done using a Windows service. Here is what I have:
A C# plugin (DLL), which makes the API calls.
C++/CLI Wrapper that allows unmanaged C++ code, to use the above plugin.
A C++ plugin, that the service will load (this is a requirement, it has to be a plugin)
If I load the C++ plugin into a local console app, and run, it can catch all NFC events (NFC device arrives in proximity, departs from proximity, can read and write to it). But, when I use the same plugin with a service, it is not able to catch those events. I can clearly hear the ping sound that comes when an NFC device comes close to Windows PC, however, none of the event handlers are called (For device arrival, device departure, read or write).
I also tried impersonation thinking that perhaps the context of who calls the method might result in blocking of the events. I could impersonate local user on the service, but the results were the same, no events could be identified.
Is there a reason why I cannot see any NFC events from a service, where as a local console app can get all of them? Again, I am able to hear the ping sound signifying that NFC device is close to Windows PC, but there is no handler getting called for it, suggesting there is blockage of something. Any ideas of what is going on?
Appreciate your time guys!

Launching other application programmatically on WP7 - ideas

I have a number of apps developed for WP7.
I'd like to launch one app from another.
I know the general answer is "no, you can't"
What if my app when launched for the first time registers at my server with a Device id and registers for push notifications?
Then when I want to launch app Foo from app Bar:
app Bar pings my server with given Device id and application Foo id
if server finds given Device has application Foo installed, it sends push-notification to the Foo app instance
application Foo launches
PROFIT!!!
What do you think about approach? Is it worth trying or better wait for Apollo which may bring us required changes? (or may not)
Your proposed approach isn't really going to work. If you're sending a raw notification from your server to the Foo application, and the application isn't running (it won't be), the MS servers will not deliver the notification to the phone, and your server will receive an error.
If you send a toast notification then, yes, the user will receive a toast to show something relating to the Foo application has occurred. They'll still have to tap the toast to launch the Foo application. That may be workable but seems a bit ... clunky.
Whilst there must be some mechanism for this (See YouTube and Acrobat applications) I'd say that, at present, it require special permissions / technical exemptions from the market place requirements. I think that you're very unlikely to receive these permissions / exemptions.

Windows Phone 7 - Events triggered on phone-call-connect and phone-call-disconnect

I'm writing an application for Windows Mobile 7 which required information about "When a voice call was placed" and "when a voice call was hanged up or disconnected". Are there any API's or events/triggers that can give me this information.
The current SDK doesn't offer this capability - generally, you cannot keep track of user activity (like calls) outside the application due to a sandboxed environment that by default doesn't offer any system process hooks.
While you can't get any information about a specific phone call, if your application is running you can be informed when a call is received (and ended) by using the Obscured and Unobsured events on the page.
Please note that this will be triggered when ANY piece of UI chrome covers the page. In addition to incoming call notifications, this will also include incoming SMS notifications, alarms, etc.
These event are an important part of the application lifecycle for some types of apps (typically games) but are often overlooked.

Resources