Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 8    Views: 96

Djdios
Lost but trying
Profile
Posts: 175
Reg: Mar 20, 2013
Valby, Denmark
3,550
08/03/15 04:47 AM (8 years ago)

Plugin request

Hi BT's I'm searching for two plugins with two different capabilities. 1st. A timer reminder: a timer to set with a notification every half hour of x minutes. When 30mins has ended a pop up notification will appear and then again until you stop it. Needs to run in background as well. 2nd. A interval timer used for training like tabata. You can set x number of intervals and x number of rounds and save them. Could be nice to load some presets in the app. Is this possible with some of the existing apps? If not where can I get some help for this. Thanks Kim
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
08/03/15 01:18 PM (8 years ago)
Hi Kim, The first one is going to be a little tricky. Apple doesn't allow background processes to run while your app is closed. Well, they do, but in a strange way. Using the backgroundtask code, you can technically run the app in the background, but the services tend to stop running anywhere between 5-10 minutes after the app is closed, and it's never the same amount of time. My stopwatch plugin utilizes this background code. If the device has your app open and in the foreground, and is on the stopwatch screen, it will run indefinitely, even when the device goes to the lock screen. However, if you leave the screen, close the app, or send the app to the background, you've got 10-15 minutes before it stops the background tasks. Without using the backgroundtask code, you get about 3 minutes, even if the screen is active. Haven't found a workaround yet, but keep me posted if you come up with something to extend the background services time.
 
Djdios
Lost but trying
Profile
Posts: 175
Reg: Mar 20, 2013
Valby, Denmark
3,550
like
08/03/15 01:47 PM (8 years ago)
Hi Angry Ninja So how does apple do this with their own timer app, setting a timer to e.g. 1 hour and put that in the background, you'll still get alerted after that hour? Kim
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
08/03/15 02:00 PM (8 years ago)
Exactly, but that's Apple. Same way they are able to allow watch faces on the apple watch, but not allow app developers to do it. Their playground, their ball. ;) Take a look at the apple docs for "Implementing long running tasks" section, about a quarter way down the page. You'll see time keeping is not one of the allowed functions: https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html I'm sure there's a way, just not using the standard tools they give us. There's one important thing to remember when coding, that a lot of people aren't aware of. When you submit an app to the App Store, Apple can NOT see your code! So many people don't know that. So if you can find a work around, or an unconventional method of doing something as a work around, Apple won't deny your app for it, because they can't see the code that's making it function.b only if the person reviewing the app visually catches your app doing something that it shouldn't, would there be an issue. As an example, I have an app that contains a "virtual marijuana garden", where plants grow in real time, you earn upgrades, sell your crop, etc... Basically the same type of game they have in the Google Play store. Apple rejected it, stating that marijuana apps are fine, just not marijuana games. Ok... So I reskin it to a rose garden, bundle it with both sets of graphics and wording, and program in a switch that's connected to my BT control panel. Submit a rose garden app, get approved, flip the switch and boom... It's no longer a rose garden game. No issues encountered at all. Now, if it got a ton of attention and Apple was made aware of it, of course they will take it down... But the point is, they cannot see your code, so I'm sure just a little background task workaround code (if you could figure it out) would slip through completely unnoticed.
 
Djdios
Lost but trying
Profile
Posts: 175
Reg: Mar 20, 2013
Valby, Denmark
3,550
like
08/03/15 02:07 PM (8 years ago)
I do der some apps in AppStore which allows you to have a notification on the front screen. So a work around would be setting an alarm every half hour that notifies you in Notification Center?
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
08/03/15 02:14 PM (8 years ago)
Yep, notification alerts are perfectly fine, and are actually meant to be used while the app is closed.
 
Djdios
Lost but trying
Profile
Posts: 175
Reg: Mar 20, 2013
Valby, Denmark
3,550
like
08/03/15 02:16 PM (8 years ago)
So that seems like a possibility. Next step for me is how to do this :)
 
Angry Ninja
Aspiring developer
Profile
Posts: 1045
Reg: Aug 25, 2013
Maine
17,150
like
08/03/15 02:45 PM (8 years ago)
Looks like it's pretty easy... I don't think a plugin will even be needed. See here: http://stackoverflow.com/questions/9162737/having-issue-with-repeatinterval-every-30-minutes (Look at the answer right below the question) Untested, but in theory the code given in the answer would probably just need to be added to your choice of viewdidload (probably in the appdelegate.m would be the best place to put it)
 
Djdios
Lost but trying
Profile
Posts: 175
Reg: Mar 20, 2013
Valby, Denmark
3,550
like
08/03/15 10:35 PM (8 years ago)
Thanks that's great. But if this it put in the apdelegate wouldn't it be called every time the app opens? I need to have it on a separate screen and let the user choose the interval and start/stop. So that's why I thought a plugin would be an idea?
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.