hi there,
I am close to finishing my first external, to schedule a local notification with a specified sound file.
I am just getting into obj-c so am really struggling here, and would be most grateful if some one with experience could pass an eye over this
to make sure i am not doing anything badly wrong.
It currently works but as you can see the parameters are currently static.
I will update the code below if and when i manage to learn how i pass in the parameter i need to pass from the function call in LC
//
// dooboxNotify.mm
// dooboxNotify
//
// Created by Joseph Gary Simpson on 05/07/2013.
// Copyright 2013 __Doobox__. All rights reserved.
//
#import "UIKit/UIDevice.h"
#import "UIKit/UILocalNotification.h"
#import "Foundation/Foundation.h"
#import "UIKit/UIApplication.h"
bool dooboxNotifyStartup (void)
{
}
void dooboxNotifyShutdown (void)
{
}
// Not sure how to pass in the parramaters for my
// soundfile name, alert body, time, and alert action yet.
// As you see the vars are currently static for testing.
bool dooboxNotifySetNotification (void)
{
// create an instance of UILocalNotification
UILocalNotification * myNotificationObj = [[UILocalNotification alloc]init];
// set the vars
NSDate *currentDate = [NSDate date];
NSDate *dateToFireNotification = [currentDate dateByAddingTimeInterval:60];
NSString *alertBody = [[NSMutableString alloc] initWithString:@"Merry Christmas"];
NSString *alertAction = [[NSMutableString alloc] initWithString:@"HO HO HO"];
NSString *soundfileName = [[NSMutableString alloc] initWithString:@""];
// add the parramaters
myNotificationObj.fireDate = dateToFireNotification;
myNotificationObj.timeZone = [NSTimeZone defaultTimeZone];
myNotificationObj.alertBody = alertBody;
myNotificationObj.alertAction = alertAction;
myNotificationObj.alertLaunchImage = nil;
// sound file
if(soundfileName == nil)
{
myNotificationObj.soundName = UILocalNotificationDefaultSoundName;
}
else
{
myNotificationObj.soundName = soundfileName;
}
// fire it of
[[UIApplication sharedApplication] scheduleLocalNotification:myNotificationObj];
[myNotificationObj release];
// not sure if a really need to release the following
[currentDate release];
[alertBody release];
[alertAction release];
[soundfileName release];
return true; // for testing in LC
}
Advice on external please
Are you developing an External using the LiveCode Externals SDK?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Return to “Building Externals”
Jump to
- LiveCode Community
- ↳ Announcements
- ↳ Developer Services Marketplace
- ↳ User Groups and Events
- ↳ SoCal LiveCode Group
- ↳ Greater Toronto Area LiveCode Users Group
- ↳ Off-Topic
- ↳ Made With LiveCode
- Getting Started With LiveCode
- ↳ Getting Started with LiveCode - Complete Beginners
- ↳ Getting Started with LiveCode - Experienced Developers
- ↳ Converting to LiveCode
- ↳ App Building Course
- ↳ Simple Messages
- ↳ Calculator
- ↳ Notes
- ↳ Clock
- ↳ Web Browser
- ↳ Weather
- ↳ Compass
- ↳ Photos
- Developing With LiveCode
- ↳ Talking LiveCode
- ↳ Databases
- ↳ Games
- ↳ Internet
- ↳ Multimedia
- ↳ Software Engineering
- ↳ Version Control
- ↳ Feature Proposals
- ↳ Bug Triage
- ↳ Legacy Project: MetaCard
- Extending LiveCode
- ↳ Using Plugins for Customizing the LiveCode IDE
- ↳ Using Externals
- ↳ Making IDE Plugins
- ↳ Building Externals
- ↳ LiveCode Builder
- Platform Specific
- ↳ Windows
- ↳ Mac OS
- ↳ Linux
- ↳ iOS Deployment
- ↳ Android Deployment
- ↳ CGIs and the Server
- ↳ HTML5
- ↳ Raspberry Pi
- Academic Endeavors
- ↳ Teaching with LiveCode
- ↳ Research and Post Secondary
- ↳ LiveCode University
- ↳ Educational Outreach
- Livecode Open Source Archived Forum- closed to posting
- ↳ Engine Contributors
- ↳ IDE Contributors
- ↳ Documentation and Tutorials
- ↳ Brainstorms
- ↳ Community Projects
- ↳ rIDE
- Third Party Extension Support
- ↳ Marketing Your Products
- ↳ Animation Engine
- ↳ chartsEngine
- ↳ MobGUI
- ↳ lcTaskList
- ↳ SQL Yoga
- ↳ MergEXT
- ↳ Data Grid Helper
- ↳ idea2app and Coding School
- ↳ Admin Archive
- LiveCode Hosting
- Forum Archives
- ↳ Archived: Third Party Extension Support
- ↳ rTree
- ↳ rGrid
- ↳ Data Tree
- ↳ Archived: LiveCode Open Source
- ↳ LiveCode Global Jam
- ↳ Testing Support
- ↳ Archived: Academic Endeavors
- ↳ September Academy
- ↳ Summer School 2013
- ↳ Archived: Project Specific
- ↳ Business and Kiosks
- ↳ Digital Art and Portfolios