Discussion Forums  >  Suggestions, Ideas, Wish List

Replies: 6    Views: 81

Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
05/15/13 11:19 AM (12 years ago)

notification noise at set iphone battery percentage levels

Is it possible to have an app that sounds a set noise when the battery reaches certain percentages? Thanks
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
05/15/13 12:48 PM (12 years ago)
Put this in view did appear check the logs to tell you what is what [[UIDevice currentDevice] setBatteryMonitoringEnabled:YES]; [[UIDevice currentDevice] batteryLevel]; [[UIDevice currentDevice] batteryState]; NSLog(@"battery level %f",[[UIDevice currentDevice] batteryLevel]); NSLog(@"battery status %d",[[UIDevice currentDevice] batteryState]); level of battery ranges from 0.0 empty to 1.0 full battery state has 4 options 1 battery fully charged 2 battery charging 3 battery discharging 4 unknown it should say status then one of the numbers
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
05/15/13 12:49 PM (12 years ago)
I would also add this line in a view did disappear method otherwise the app will be checking constantly for battery changes which will probably reduce the life of the battery. [[UIDevice currentDevice] setBatteryMonitoringEnabled:NO];
 
Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
like
05/15/13 01:02 PM (12 years ago)
thanks for your help, however i'm not sure how to implement this into an application, as i am only just starting out, and have only recently got the hang of buzz touch. where would i add the code into, say a blank xcode project? thanks Jeremy
 
Alex@TM
Apple Fan
Profile
Posts: 956
Reg: Dec 20, 2011
London, UK
10,560
like
05/15/13 01:29 PM (12 years ago)
Might be an idea searching 'battery' on the app store before you go into this, there are literally hundreds of similar apps :/
 
Jlentriken
Aspiring developer
Profile
Posts: 246
Reg: Dec 26, 2012
Palm Beach, Gol...
12,110
like
05/15/13 01:37 PM (12 years ago)
I have done many searches, and so far haven't found anything that does what i am intending for my app to do.
 
Alex@TM
Apple Fan
Profile
Posts: 956
Reg: Dec 20, 2011
London, UK
10,560
like
05/15/13 01:42 PM (12 years ago)
Cool!! Good luck :)
 

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.