WinRT live tile on system startup - windows-8

I have a live tile working which updates how many users are online and how many lobbies are open within the app. This begins updating when my app loses its visibility (no point it updating the live tile whilst the app is running), but I want it to update when I first turn the computer on.
I have had a look around and mentions of making the app a lock screen app have popped up but that is all, no explanation how to do it.
Does anyone know how to do this and provide a nice little explanation or link of how to do so?
Many thanks,
Kevin

You should use push notifications for this kind of behaviour. This msdn link has more info:-
Using tile notifications
Choosing the right notification method to update your tile
There are several mechanisms which can be used to update a live tile:
Local API calls
One-time scheduled notifications, using local content
Push notifications, sent from a cloud server
Periodic notifications, which pull information from a cloud server at a fixed time interval
The choice of which mechanism to use largely depends on the content you want to show and how frequently that content should be updated. The majority of apps will probably use a local API call to update the tile when the app is launched or the state changes within the app. This makes sure that the tile is up-to-date when it launches and exits. The choice of using local, push, scheduled, or polling notifications, alone or in some combination, completely depends upon the app. For example, a game can use local API calls to update the tile when a new high score is reached by the player. At the same time, that same game app could use push notifications to send that same user new high scores achieved by their friends.

You're right with the assumption that you require a lock screen capability to be able to run background tasks without your app being started once. The main process would be to extract the part of your application that gets the data into a background task that is probably triggered by a timer and write some code to be on the lock screen.
When I first encountered that restriction I was kind of surprised, but in terms of battery performance this design decision makes sense: Only consume battery power if the data is absolutely worth it. If it's worth, it is also of interest having it on the lock screen.
On MSDN is a good overview about lock screen along with further reading links. It's much better than what I could type in here. Come back with problems related the implementation (which actually even better fits the purpose of SO). This blog might be useful, too.

Related

How to create background location service in Appcelerator Titanium working after restarting device

I want to make an application which will send information to a server about user's location every 30min. It is needed to provide location specific push notifications.
I need such functionality for Android/iOS, which would work in background (also if device is restarted). I found some articles covering background services and I created background service doing that, but after phone is restarted it won't work.
Is it possible with Android and iOS? How can I achieve that?
With iOS, no. With Android, yes.
Apple has gone to great lengths to limit what apps can do. You can do some things in the background for an extended period of time (GPS, play audio, Voip, etc), but after a reboot your app will not be restarted until the user opens it again. There are exceptions to this. Voip apps are allowed to restart after a reboot, but apple will not approve your app for the App Store unless you actually have a place for a user in your app to use the Voip feature. Geofences are a possibility, but I haven't had experience with that feature yet. In my experience, Apple does whatever they can to make sure your app doesn't run forever.
With android, there is more flexibility and what you propose is totally possible. I've listed some important links below, since most of those solutions are far better documented than what I can do here.
Essentially you need to register as a boot receiver and then send an intent to start a titanium android service when the boot event is received. I don't have experience with starting a titanium service, but I'm sure its a simple intent you need to fire. Either way you'll need a module for this native code. I attached a link to a bencoding titanium module that may help you, although there may be some others out there. You may even need to code one yourself.
Samsung is notorious for stopping your app with their SPCM feature. You may want to familiarize yourself with it. I've added a stackoverflow discussion link below.
I don't know all of your system requirements but honestly, for any app I would try my best to not run forever. It will hurt the battery life for your users and will add a lot of complexity. Maybe you could simply have the app check the GPS coordinates when it receives a push notification and decide right there and then whether to present a notification to the user? Just something to consider.
Either way good luck!
How to start an Application on startup?
http://docs.appcelerator.com/platform/latest/#!/guide/Android_Services
https://github.com/benbahrenburg/benCoding.Android.Tools
Dealing with Samsung SPCM killer

How to add dynamic text to live tile in windows 8 with javascript

Well, the topic says it all. I'm dabbling with windows 8 app development using html/css/javascript and I'm having a hard time finding information on how to dynamically manipulate the live tiles.
There is a lot of information out there on how to create multiple tile xml files and launch them after each other but if anyone had a good resource, or even better, a first-hand explanation, on how to create these tiles programatically to, say, make a countdown tile, it would be greatly appreciated.
There's no way to programmatically update the text/image on a live tile directly in real time.
The only APIs available are those in the Windows.UI.Notifications namespace, such as are shown in the Sending a tile update Quickstart.
You can use the notification queue, as shown here, to provide multiple updates that will automatically cycle, or you can use an external service, such as Windows Azure Mobile Services to send tile updates. Using push notifications from an external service will probably get you closest to the behavior you're looking for, since it will not rely on the app being active in order to update the tile. Be aware, however, that the app will need to run at least once in order to create the channel URI that's needed for the external service to update the tile.
For more info on Windows Store app development, register for Generation App.

Can I force the user to accept my app as lockscreen-only?

My Windows 8 app needs to run a background task triggered by the receipt of raw notifications sent from Windows Phone 8 apps. Responding to that event to invoke a background task is apparently only allowed for lockscreen apps:
http://dotnet.dzone.com/articles/windows-store-app-development-10?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+zones%2Fdotnet+%28.NET+Zone%29
Normally, the user has control of whether they will allow an app to be a lockscreen app or not. In my case, though, it must be such or be basically braindead. So, can I enforce that: IOW, inform that users "Install this as a lockscreen app, or don't install it at all"?
What I mean is: assuming the user retains ultimate control, will letting them know that the app won't work well without them allowing it to be a lockscreen app cause it to fail certification?
You bet, that's how it's done.
Want to force them to allow it? Disable the "Block" button. (just kidding, you can't)
Remember, it's your app.
Check out how the Store app "supports" snap view. That's a nice example to show certification requirements can be "met" at the bare least implementation.
When you read the cert reqs. read them literally.
Responding to that event to invoke a background task is apparently only allowed for lockscreen apps:
Not exactly true. But anyway, the short answer to your question is no. And in reality, I can't see why the user would want to use your app, if it were to constantly do things in the background and thus drain their battery-life, for no good reason.
You might want to detail what your app actually will do, for more accurate advice.
No, only the user decides what is, or is not, on their lock screen. Because a user decides what is on the lock screen app list, apps preferably should provide a decent degraded experience if they are not on the lock screen. Messaging can be provided in the application to make the user aware of the degraded experience, but again, it is ultimately up to the user.
To answer your question "will it fail certification" no. You can programmatically request that the user promote your app to the lock screen when you run, but you should consider degrading gracefully if they don't. (E.g. register for a timer event to give your app some time to periodically update itself, or send a notification through WNS and handle it then.)
While it's great to assume that your users will want to run your app under the lock screen, providing a consistent, delightful experience under different conditions is what will set you apart.

Perform a task every day even if running only in background

I need my application to perform a background task every day, but it does not comply with Apple's specification for running in background.
It's none of these: audio, location, VOIP, news stand, external-accessory—, Bluetooth-central.
I'm planning to use local notifications, but the point is, that if the user doesn't open the app (and just leaves it in the background), I cannot plan new local notifications.
What should I do in this situation?
Make something else.
Seriously, if your app doesn’t at least technically fit one of those categories, you’re not going to be able to get it to do background work in a way that’ll get you approved for the App Store.
I’ve seen apps that added specific functionality in one of those categories, orthogonal to their actual purpose, to be allowed to run in the background; for instance, there’s a couple of weather apps out there that play a continuous audio file—one of the available sounds being a silent one—in order to be able to update the lock screen’s “now playing” image with live data. If you don’t mind your users being unable to listen to any other music, and have your app continuously active (which might cause additional battery drain), that could work. But if you’re trying to have your app invisibly do things in the background, without interfering with anything else, in a way that’ll get you into the App Store, you’re probably out of luck.
Four options:
Go for jailbreak
Try to get in the app store as one of those types of apps, making up a feature that uses one of those types.
(my favorite) Really rethink your system, is it really necessary to schedule background tasks? Can't the user wait a bit when he opens the app? That loading can be performed in background. And can't you offload some of the work to a webserver? Are you collecting data? You shoudln't without the user consent.
Let your user know that it's important for him (he's the one using it right?) that he opens the app once a day.
I think I covered all yohr options except the one already covered by Noah.

What is the best way to start a movie the first time your app starts

I want to have a movie start the first time my app is launched to train users on its use, say a 50 second clip.
How would I go about doing this in an iPad app?
(I am building a very complex platform that has hooks into the web and need users to be aware of that. The video will explain that users can go to the website for different features. When the app starts for the FIRST TIME only I want the video to play.)
Don't force users to sit thru a 50 second movie when the app starts. Your user interface should be obvious enough that they can figure out the basics without watching a training video. If you want to offer it, provide a help button, where they can watch it when they choose to.
See the iPhone HIG section Minimal User Help, which says:
A hallmark of the design of iPhone
OS–based devices is ease of use, so
it’s crucial that you meet users’
expectations and make the use of your
application immediately obvious.
EDIT -- The simplest way to keep track would be to store a flag indicating whether or not you have shown the video by using NSUserDefaults. Check if it's set at startup, set it after showing the video the first time.