Play sound file with local notification

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
doobox
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Tue May 24, 2011 11:47 pm

Play sound file with local notification

Post by doobox » Thu Jul 04, 2013 11:17 pm

Hi there,

As far as i can see it is not possible to play a sound file when a local notification is presented..?
Can someone confirm this please.

If this is the case, can an external be created..?

I read somewhere that its not possible with the ios public api, but Appcelerator can do this within its api, so i have to assume this can be done in some way.
I would also need the sound file to loop for as the notification will be an alarm.
Kind Regards
Gary

https://www.doobox.co.uk

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Play sound file with local notification

Post by Mark » Fri Jul 05, 2013 10:11 am

Hi,

What have you tried so far? By "local notification", do you mean an answer dialog? Or do you mean a local push notification? In case of local push notifications, I think it is up to the user to determine in the control panel whether to play a system sound or not. This is a privilege the programmer doesn't have. If you do mean push notifications, then you posted in the wrong place. Move this question to an iOS or Android forum.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

doobox
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Tue May 24, 2011 11:47 pm

Re: Play sound file with local notification

Post by doobox » Fri Jul 05, 2013 10:36 am

Hi there,

I basically want to schedule an alarm. And had stated building the app without looking at this portion properly, assuming i could do this with local Notifications.

It looks like i can't, as the local notification is only capable of playing a system sound (1 time) when the app is not in use :-(

So how are all the alarm clock apps out there handling this :
The user sets an alarm time.
The app schedules the alarm ( with message, sound file etc etc).
The user closes the app.
The notification and alarm still fires and plays until interacted with.

Looking at the iOS sdk it looks like there is a UILocalNotification class with tasks that i need :
firedate
repeatinterval ------------ the important one i need to loop the sound file i think
repeatcalender

alertbody
alertaction
alertlaunchimage
alerticonbadgenumber
soundname --------------- the important one i need


reading between the lines, it looks to me that this is the class that "mobileCreateLocalNotification" is based on..?
But it is obviously not fully implemented if this is the case.

So from what you said, if i had an external that fully implemented this class, could the users prefs still be disabling the sound file attached to this notification..?
Kind Regards
Gary

https://www.doobox.co.uk

doobox
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Tue May 24, 2011 11:47 pm

Re: Play sound file with local notification

Post by doobox » Fri Jul 05, 2013 6:45 pm

@Mark
I have been trying to find a way to contact you regarding building externals, but there is some problems with your site.
Do you have a direct email i can get you on..?
I am : sales at doobox dot co dot uk
Kind Regards
Gary

https://www.doobox.co.uk

Jim Mac
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 54
Joined: Wed Jun 28, 2006 9:22 pm

Re: Play sound file with local notification

Post by Jim Mac » Wed Aug 08, 2018 4:31 am

Has this been answered?

I am using local push notifications to show banners reminding people to check my app based on a schedule they define.

My original desire was to have the user also select a sound to accompany the banner... I've seen some apps do this. Unfortunately I have had zero luck with systemBeep or anything else in geting sounds to accompany teh banner. I can get my app to play a sound once opened in response to the banner but that's backwards behavior.

Would having my app active in the background be the way to go... so it's available to play whatever sound I want (invisibly when the banner is showing?). I don't even know if it's possilbe to access the OS's built in sounds.

Jim

Will likely cross post this to the iOS board.

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Play sound file with local notification

Post by Mikey » Wed Aug 08, 2018 3:25 pm

My apps play sound when they receive a push notification when the app isn't open. It's not a custom sound though.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Play sound file with local notification

Post by jacque » Thu Aug 09, 2018 6:58 pm

It's a system setting, the user has to turn it on. On Android notifications can be granular down to the individual app, I'm not sure about iOS.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”