I'm newbe to watch os 2, so don't really know where to start with this.
Is it possible to write a WatchOs 2 app, that will run in background and will wake up once an hour?
There is not that much info available on the web, but what I've seen so far suggests that it's not possible to write background apps. Still, I'm wondering, how do you write an app that acts like an alarm clock and wakes up at specific times during the day?
The simple WatchKit Apps can't run in background without user permission. In order to have you app running in the background, you must implement a Workout-style app, but instead of getting health and activity data, you can implement an alarm clock app, or something similar.
You can learn more on developer.apple.com documentations by clicking on the link above.
Related
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
I'm making an iBeacon based app for a shopping mall with notifications based specifically on which store is nearby.
My question is, with background tasks in iOS 7.1 and above, can I run database calls(to reference location on the basis of the closest beacon). What about network calls(like a PFQuery?).
Yes, you can do anything you want on iBeacon detection in the background including database access and web service calls. I have developed apps doing both of these things. The only trick is that iOS only gives your app 5-10 seconds of running time after the detection takes place, so you must make these operations relatively fast.
I need to be able to do these few things:
Run my app on phone startup
Keep it running in the background all the time
No UI is needed - this is a statistics app so it will gather all the data it needs and the user should not be bothered with anything.
Are these things possible?
Not really. Setting aside jailbreaking and the universe of things that aren't Apple-approved, running in the background full-time is explicitly banned on iOS. Similarly, you can't sell an app on the App Store that doesn't have a user interface, and you can't set apps to run on start up.
How can an application perform stuff when its actually closed like google+?
I notice that I got a notification from huddle chat from the google+ app for iOS. But google+ was actually not active, it was closed. Same situation with Whatsapp, I always get push messages both if the app is closed or active.
This kind of behaviour seems for me to be impossible to implement. From other questions I know that we cannot register some kind of background process. How do this apps handle that?
Can I still listen form something when my app is minimized?
When my app is just minimized but not closed I know that a certain method is called. Can I perform a repeating update task, e.g. read geo data?
The apps you mentioned use something called Push Notifications which work regardless of your App being open/in the background/closed. They are notifications sent to the device when an action happens and most of the processing is done on the Server (The notifications are not generated by the App itself. A server pushes the Notification on).
Apple has a fantastic section on Executing Code in the Background when your App is minimised which should provide most of the answers you need. It even has a dedicated section on explaining the Geo Data capture which should help you in this case.
I've been searching an googleing over one hour now and I'm not really sure of it's legal and possible to add some tasks in an background service that triggers an action ( and bring the app to the foreground ).
With tasks i mean that the background service is doing something on an indicated time. I know its possible to bring up the IOS alert with the notifications ect... But an simple notifiction is not good enough.
Actually I wanna play an video, and if this is not possible maybe the audio ? Since bringing the app to the foreground is not possible, or is it?
What are the options?
It's not acceptable to take away the user from what they are doing, this applies to iOS since it's a one-thing at a time OS. How would you feel if an application switched to itself while you're playing, chatting or half-way reading an article?
Apple doesn't allow it, you should stick to the Notifications, and if the user truly wants to see/hear the video/audio, then he will go to your app.