Event to notify while getting call - windows-phone-8

Is there any events in Windowsphone 8 to notify my application while the phone getting a call?
So that the application can make actions at that time.

No. When the user takes a phone call, you will get Application Deactivated (but this event is raised in other cases to). These event is designed to quickly save the app state for resume, nothing else, there are limitations (e.g. 10 seconds running time).

Related

App Termination Event WP8.1

I am developing a WP8.1 app in which I need to get the time when app terminated so that when it's launched again I can take decisions according to my requirements. But for this I'm unable to find the any kind of termination event for app where I can store the time of app termination. I have searched and have found Windows Phone 8.1 App Life Cycle which shows there is no event for termination. So my question is how can I record the time of app termination?
You can handle the suspension of the application, when it is brought to the background, and record that time. It is the time when the user last used your app, so when it is started again, you can check how much time has elapsed since last use.
For the actual termination you do not receive an event, nor it is a way to handle such event, because all processing in the application is stopped when suspended and no code can execute.

How can I schedule a Background Task to trigger at a specific time

This is a Windows Phone 8.1 app. I want to be able to trigger a task to execute at a specific time. My main concerns are accuracy, resource and user experience.
I have tried a TimeTrigger with an IBackgroundTask but found that, aside from the minimum 15 minutes constraint, the execution time is far from accurate - sometime the task triggers 8 minutes later, some times 20 so no use for a scheduled trigger.
I have looked at toast but I need the task to run without user input and, as far as I can see, the toast notifications have no capability to trigger code execution without the user interacting.
I have looked at the alarm clock approach but, firstly it uses toast notifications and, secondly, I understand you can only have one alarm app that the user must declare so that's a bit intrusive.
I have looked at using a Task.Delay approach using async and await to avoid blocking the UI thread but this is hardly a background-centric approach.
Has anyone managed to find a way to create resource-friendly, scheduled background tasks (i.e. an alarm and sleep function) for Windows Phone 8.1?

Create A background service in Windows phone 8 to update location

I have to create a Background Task which should run after every 1 minute and should call a Rest service to update the Mobile longitude and Latitude Location. The rest service for this purpose have been written all I have to do is to write a Task in my existing application which should perform this update. Can you guys please tell which is the most easiest way to implement this functionality.
Thanks,
There isn't a concept of a service like exists in Windows Desktop. Applications are running, or not on the phone. One application on the phone, tracking location, can be running in the background while other applications run.
If your application is in the foreground, you will just directly call the web services with updated location.
You can use a scheduled background agent to periodically update location, but it is likely that it won't update frequently enough for your needs.
MSDN has details about how to create an application that actively tracks location in the background, subject to some important limitations, and reasons the application may be deactivated:
The app stops actively tracking location. An app stops tracking location by removing event handlers for the PositionChanged and StatusChanged events of the Geolocator class or by calling the Stop() method of the GeoCoordinateWatcher class.
The app has run in the background for 4 hours without user interaction.
Battery Saver is active.
Device memory is low.
The user disables Location Services on the phone.
Another app begins running in the background.
In addition, there is a complete tutorial available for this scenario.

Windows Phone 8 - Keeping background location tracking active beyond four hours

I'm in the process of developing a WP8 app that makes use of the background location tracking abilities provided by the OS. The idea is to monitor the users position and to notify them when they are near certain types of places.
So far it all seems to work fine and when running the location tracking works as I would expect.
The problem is, it seems that the phone times out background apps after around four hours, stopping the location tracking.
I can understand why Microsoft did it, to preserve battery life etc. But there's not much point having a background location tracking app that has to be manually restarted every four hours! If a user chooses to run this app and is made aware of the potential battery hit, surely it should be able to run indefinitely - to a point of course, if the system runs out of resources or similar then that's fair enough.
Does anyone have any experience with this? There must be hundreds of others apps in the store that have run into this issue I would have thought? And presumably there must be some way of keeping the location tracking running?
I've tried periodically updating the live tile (using a DispatcherTimer) while the tracking is running but this doesn't seem to be enough to keep the app alive either :(
Anyone have any ideas?
Thanks.
There is no way to achieve your desired behavior. The app will be deactivated under anye of following conditions:
The app stops actively tracking location. An app stops tracking location by removing event handlers for the PositionChanged and StatusChanged events of the Geolocator class or by calling the Stop() method of the GeoCoordinateWatcher class.
The app has run in the background for 4 hours without user interaction.
Battery Saver is active.
Device memory is low.
The user disables Location Services on the phone.
Another app begins running in the background.
Source: Running location-tracking apps in the background for Windows Phone 8
What you could do is to show a toast notification before app is deactivated advising the user, and make him navigate back to the app, extending the period for other 4 hours that way.
There is no way to keep it running without any user interaction.

Stop Google Analytics Realtime tracking on Adobe AIR app after closing?

I'm using Adobe's Google Analytics SWC library for flex. What I'm trying to achieve is to simply be able to utilize the realtime features of Google Analytics to know when users have my AIR desktop application open.
Making it detect an open application was easy enough. I can visually see the count on Google Analytics getting updated in a matter of seconds whenever I open up my application. However, the problem occurs when I close my app. Google Analytics doesn't seem to detect a closed app and still detects it as open on the realtime view. How would I go with making Google Analytics know that the application has stopped?
So far, it seems the realtime counter only reverts back to 0 after some 30 or so minutes that I have already closed the app. This leads me to believe that it was considered to be idle by Google and so decided to update the statistics. That might be good and all but I really want to utilize the realtime capability so I need it to reflect when an app closes with only a few seconds of offset.
Any thoughts?
Not sure if this one will work (don't know that Android will kill the process and restart it each time) but if it does it's an answer:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/NativeApplication.html#event:exiting
Also check out the Deactivate event as it seems to be relevant, more on mobile app life cycle here:
http://help.adobe.com/en_US/air/build/WSfffb011ac560372f82c4ee412b1275403b-8000.html
From the Google Analytics documentation.
setSessionTimeout () method public function
setSessionTimeout(newTimeout:int):void
Sets the new session timeout in seconds. By default, session timeout
is set to 30 minutes (1800 seconds).
Session timeout is used to compute visits, since a visit ends after 30
minutes of browser inactivity or upon browser exit.
If you want to change the definition of a "session" for your
particular needs, you can pass in the number of seconds to define a
new value.
This will impact the Visits reports in every section where the number
of visits are calculated, and where visits are used in computing other
values.
For example, the number of visits will increase if you shorten the
session timeout, and will decrease if you increase the session
timeout.