Inherits from UIResponder
Conforms to C2CallPhoneDelegate
UIApplicationDelegate
Declared in C2CallAppDelegate.h

Overview

Application Delegate base class for an automatic initialization of C2Call services.

As a VoIP and Messaging Service the C2Call Framework requires a complex initialization procedure and as well a detailed monitoring of all application states like active (app is in foreground), inactive (screensaver is active), background (app is in background) or termined. During the different states, the C2Call Framework has to maintain the connection to the C2Call backend systems, monitor network changes, automatically retrieve missed messages or call records and nevertheless save battery power as good as possible. In order to make it easy for the developer, all this complex application management has been capsuled into the C2CallAppDelegate base class. This base class should now be the UIApplicationDelegate base class for apps using the C2Call Framework.

The C2CallAppDelegate class implements the following methods from UIApplicationDelegate:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- (void)applicationDidBecomeActive:(UIApplication *)application;
- (void)applicationWillResignActive:(UIApplication *)application;
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url;
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation 
- (void)applicationWillTerminate:(UIApplication *)application;
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
- (void)applicationDidEnterBackground:(UIApplication *)application
- (void)applicationWillEnterForeground:(UIApplication *)application

On all methods above the corresponding super method has to be called when overwriting in your own C2CallAppDelegate subclass.

Properties

affiliateid

Sets the AffiliateId from the C2Call SDK Developer Account.

@property (nonatomic, strong) NSString *affiliateid

Declared In

C2CallAppDelegate.h

c2email

Optional: Sets the email address for Login.

@property (nonatomic, strong) NSString *c2email

Discussion

If no email address and password will be set in the C2CallAppDelegate, the C2CallAppDelegate will fire a segue named “SCLaunchScreenControllerSegue” on applicationDidBecomeActive.

@try {
    [self.mainScreenController performSegueWithIdentifier:@"SCLaunchScreenControllerSegue" sender:nil];
}
@catch (NSException *exception) {
}

The SCLaunchScreenController represents the startup dialog for the user to authenticate or register to the service. In case the segue is not existing, nothing happens. The SDK provides a predefined SCLaunchScreenController, SCLoginController and SCRegisterController to implement login and registration. The standard Login and Registration Controler stores the email address and password in the NSUserDefaults. C2CallAppDelegate will automatically use them next time on application start for an automatic login. For a new application development it is recommended to use the standard login and register controls to create test accounts before implementing an individual login and registration process.

Declared In

C2CallAppDelegate.h

c2password

Optional: Sets the password address for Login.

@property (nonatomic, strong) NSString *c2password

Declared In

C2CallAppDelegate.h

customStoryboard

References to the Application Custom Storyboard.

@property (nonatomic, strong) UIStoryboard *customStoryboard

Discussion

In Storyboard Applications, this will be the storyboard, referenced by the rootViewController of the App. In case the App is using tradition XIB Files, an additional Custom Storyboard needs to be created and correctly set by Application delegateMethod didFinishLaunchingWithOptions. Please see the Sample Code SDK-UsingXIBFiles Sample

Declared In

C2CallAppDelegate.h

hasValidCredentials

Are valid credentials available for single sign on

@property (nonatomic, readonly) BOOL hasValidCredentials

Declared In

C2CallAppDelegate.h

loginCompleted

Is the user with the current credentials logged in and has a server session

@property (nonatomic, readonly) BOOL loginCompleted

Declared In

C2CallAppDelegate.h

loginSession

Auto-Login Session (Enterprise Customers only)

@property (nonatomic, strong) NSString *loginSession

Declared In

C2CallAppDelegate.h

loginToken

Auto-Login Token (Enterprise Customers only)

@property (nonatomic, strong) NSString *loginToken

Declared In

C2CallAppDelegate.h

mainScreenController

Applications main screen controller.

@property (nonatomic, weak) UIViewController *mainScreenController

Discussion

Will be set on applicationDidFinishLaunching.

self.mainScreenController = self.window.rootViewController;

Declared In

C2CallAppDelegate.h

pushKitPushTypes

Set the Supported PushTypes for PushKit Framework

@property (nonatomic, strong) NSSet *pushKitPushTypes

Declared In

C2CallAppDelegate.h

sdkbundle

References to the C2Call SDK Resource Bundle.

@property (nonatomic, readonly) NSBundle *sdkbundle

Discussion

The C2Call SDK Resource Bundle contains all SDK resources. This property is only set when provided as Cocoapods SDK

Declared In

C2CallAppDelegate.h

secret

Sets the Application Secret from the C2Call SDK Developer Account.

@property (nonatomic, strong) NSString *secret

Declared In

C2CallAppDelegate.h

storyboard

References to the C2Call SDK storyboard.

@property (nonatomic, strong) UIStoryboard *storyboard

Discussion

The C2Call SDK storyboard provides all C2Call SDK GUI components, which will be set on applicationDidFinishLaunching.

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"SCStoryboard" bundle:nil];
self.storyboard = sb;

Declared In

C2CallAppDelegate.h

useApplicationBadge

Automatically sets the Application Badge to the number of missed events

@property (nonatomic) BOOL useApplicationBadge

Discussion

This will set the useApplicationBadge property in C2CallPhone on initialization

Declared In

C2CallAppDelegate.h

useOnlineStatusPrompt

Show the Online/Offline Status prompt

@property (nonatomic) BOOL useOnlineStatusPrompt

Discussion

Default is on. Overwrite method :

-(void) showPrompt:(NSString *) p tmo:(NSTimeInterval) t

To define your own prompt.

Declared In

C2CallAppDelegate.h

usePhotoEffects

Use Photo Effects for Picture Messages

@property (nonatomic) SCPhotoEffects usePhotoEffects

Discussion

This is the pre-set for using photo effects when sending a picture message from camera or photo album.
3 values are possible:
    - SC_PHOTO_NOEFFECTS : No effects will be applied
    - SC_PHOTO_APPLYEFFECTS : Always apply photo effects when sending a picture message
    - SC_PHOTO_USERCHOICE : A popup menu allows the user to choose whether he wants to applay a photo effect, after capturing an image.

    In order to use photo effects with the C2Call SDK, please add the following library from the 3rdparty-libs folder:
    R1PhotoEffectsSDK.a and add the CoreText Framework to your application.

    In your project target settings, add the parameter "-ObjC" to "other Linker Flags".

Declared In

C2CallAppDelegate.h

usePushKit

Enable the iOS8 VoIP Push feature

@property (nonatomic) BOOL usePushKit

Discussion

Before setting this option to YES, please check whether the device is currently running iOS8 or higher. You also need to upload a VoIP Push Certificate in the DevArea then. This option has to be set in applicationDidFinishLaunching:withOptions

With VoIP Push all incoming calls will wake-up the app immediately and receive the push notification first, before it will be presented to the user. The Application has the chance to restore the network connections then and present a custom notification to the user.

Please also see the methods :

- callNotificationForUserid:displayName:videoCall
- missedCallNotificationForUserid:displayName:

The presented call notification can be customized here.

Declared In

C2CallAppDelegate.h

useSandboxMode

Sets the Sandbox Mode.

@property (nonatomic) BOOL useSandboxMode

Discussion

If set to YES, Push Notifications will use the Developer Push Certificate.

If set to NO, Push Notification will use the Production Push Ceterificate.

Also, in Sandbox Mode all type of rewarded offers are available.

Declared In

C2CallAppDelegate.h

window

Standard UIApplicationDelegate window property.

@property (strong, nonatomic) UIWindow *window

Declared In

C2CallAppDelegate.h

Class Methods

appDelegate

Gets the current Application Delegate.

+ (C2CallAppDelegate *)appDelegate

Return Value

Current Application Delegate

Declared In

C2CallAppDelegate.h

Instance Methods

callNotificationForUserid:displayName:videoCall:

Customize Notification Message for inbound call in background

- (UILocalNotification *)callNotificationForUserid:(id)userid displayName:(id)displayName videoCall:(id)isVideoCall

Parameters

userid
  • Userid of the Caller
displayName
  • Display Name of the Caller
isVideoCall
  • YES - it’s a video call, NO it’s an audio call

Return Value

UILocalNotifcation to display, if nil no notification will be presented

Discussion

Actually an App using C2Call SDK with VoIP services has two background modes. During the frist 10 minutes in background the app keeps being active and will receive call notifications via normal SIP communication. After 10 minutes, the app goes to sleep and any call notification will be sent by the server via Apple Push Notification Service. During the first 10 mintues, the inbound call will then be presented as NSLocalNotification to the user. In order to customize the message, presented to the user via NSLocalNotification, please overwrite this method and provide a UILocalNotification which will be presented to the user instead.

Declared In

C2CallAppDelegate.h

instantiateViewControllerWithIdentifier:

Instantiates a C2Call SDK GUI Component.

- (id)instantiateViewControllerWithIdentifier:(id)vcname

Parameters

vcname
  • Storyboard Name of the ViewController

Discussion

The C2Call SDK provides various standard components for all its communication features. These components may be used as is or can be modified by the application developer. To do so, copy the GUI Component from the SCStoryboard to the application MainStoryboard and modify it.

instantiateViewControllerWithIdentifier first seeks the component in the MainStoryboard and then in the SCStoryboard to instantiate the component. This ensures that the developer version takes precedence over the standard version.

Declared In

C2CallAppDelegate.h

logoutUser

Logouts the current user and show the launch screen.

- (void)logoutUser

Declared In

C2CallAppDelegate.h

missedCallNotificationForUserid:displayName:

Customize Notification Message for missed call in background

- (UILocalNotification *)missedCallNotificationForUserid:(id)userid displayName:(id)displayName

Parameters

userid
  • Userid of the Caller
displayName
  • Display Name of the Caller

Return Value

UILocalNotifcation to display, if nil no notification will be presented

Declared In

C2CallAppDelegate.h

notifySIPEvent:andData:

Handle custom SIP Events.

- (void)notifySIPEvent:(id)event andData:(id)data

Parameters

event
  • Name of the event
data

-

Discussion

Always call super class with unhandled events

Declared In

C2CallAppDelegate.h

processRegisterResult:

Will be called by C2CallPhone on register result.

- (void)processRegisterResult:(id)doc

Declared In

C2CallAppDelegate.h

showCallStatus

Presents the SCCallStatusController on call connected event

- (void)showCallStatus

Discussion

Overwrite this Method to present your own

Declared In

C2CallAppDelegate.h

showHint:withNotificationType:

Shows User Notification from C2Call Service.

- (void)showHint:(id)message withNotificationType:(id)notificationType

Parameters

message
  • The actual hint message
notificationType
  • The notification type

Discussion

The C2Call Backend Service sends notifications of the following type:

 SC_NOTIFICATIONTYPE_REWARD - The user has received a reward from a rewarded advertising.
 SC_NOTIFICATIONTYPE_NEWFRIENDS - The user got new friends connected.
 SC_NOTIFICATIONTYPE_USERMESSAGE - A system message for the user like new version information etc.
 SC_NOTIFICATIONTYPE_ADDCREDIT - Credit has been added to the users account.

The developer should overwrite this method to present the hint to the user.

Declared In

C2CallAppDelegate.h

showIncomingCall

Presents the SCInboundCallController on incoming call

- (void)showIncomingCall

Discussion

Overwrite this Method to present your own

Declared In

C2CallAppDelegate.h

showLaunchScreen

Present the LaunchScreen in case, no user is currently defined for autologin.

- (void)showLaunchScreen

Discussion

Overwrite this method to do your own action here. This method fires performSegueWithIdentifier:@“SCLaunchScreenControllerSegue” by default.

Declared In

C2CallAppDelegate.h

showPaymentRequiredForType:

Callback to Present a dialog for payment required actions

- (void)showPaymentRequiredForType:(id)type

Parameters

type
  • “Call” or “Message”

Discussion

The parameter type indicates whether is a call or message action. Overwrite this method to present a specific action to the user here.

Declared In

C2CallAppDelegate.h

showPrompt:tmo:

Shows the online status prompt when connected to the service

- (void)showPrompt:(id)prompt tmo:(id)tmo

Parameters

prompt
  • Message to show
tmo
  • time interval to remove the message from screen

Discussion

Overwrite this method to show your own customized prompt This method uses SCPromptController. For GUI modification, just copy SCPromptController in your storyboard file and change it accordingly.

Declared In

C2CallAppDelegate.h

startUsingFacebookLogin

Can be called from launch screen when choosing Facebook login

- (BOOL)startUsingFacebookLogin

Return Value

Returns NO, for free users, YES for professional and enterprise users.

Discussion

The Facebook Login option is for professional users only.

Declared In

C2CallAppDelegate.h