diff --git a/Classes/LinphoneAppDelegate.h b/Classes/LinphoneAppDelegate.h
index f13b8cb84..f5e9508a1 100644
--- a/Classes/LinphoneAppDelegate.h
+++ b/Classes/LinphoneAppDelegate.h
@@ -48,6 +48,8 @@
-(void) setupUI;
-(void) setupGSMInteraction;
+-(void) startApplication;
+
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController* myTabBarController;
@property (nonatomic, retain) ABPeoplePickerNavigationController* myPeoplePickerController;
diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m
index fbb0524fb..c0f8723b6 100644
--- a/Classes/LinphoneAppDelegate.m
+++ b/Classes/LinphoneAppDelegate.m
@@ -94,6 +94,15 @@ int __aeabi_idiv(int a, int b) {
}
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
+ if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]
+ && [UIApplication sharedApplication].applicationState == UIApplicationStateBackground
+ && [[NSUserDefaults standardUserDefaults] boolForKey:@"disable_autoboot_preference"]) {
+ // autoboot disabled, doing nothing
+ return;
+ } else if ([LinphoneManager instance] == nil) {
+ [self startApplication];
+ }
+
[[LinphoneManager instance] becomeActive];
if (callCenter == nil) {
@@ -223,22 +232,30 @@ int __aeabi_idiv(int a, int b) {
nil];
[self loadDefaultSettings: appDefaults];
+
+ if ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)]
+ && [UIApplication sharedApplication].applicationState == UIApplicationStateBackground
+ && [[NSUserDefaults standardUserDefaults] boolForKey:@"disable_autoboot_preference"]) {
+ // autoboot disabled, doing nothing
+ } else {
+ [self startApplication];
+ }
+ return YES;
+}
+
+-(void) startApplication {
/* explicitely instanciate LinphoneManager */
LinphoneManager* lm = [[LinphoneManager alloc] init];
assert(lm == [LinphoneManager instance]);
-
-
[self setupUI];
-
+
[[LinphoneManager instance] startLibLinphone];
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound];
[self setupGSMInteraction];
-
- return YES;
}
diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m
index 30a3a526f..f04fac224 100644
--- a/Classes/LinphoneUI/LinphoneManager.m
+++ b/Classes/LinphoneUI/LinphoneManager.m
@@ -65,9 +65,6 @@ extern void libmsbcg729_init();
return self;
}
+(LinphoneManager*) instance {
- if (theLinphoneManager==nil) {
- [[LinphoneManager alloc] init];
- }
return theLinphoneManager;
}
diff --git a/Settings.bundle/Advanced.plist b/Settings.bundle/Advanced.plist
index 977c1c36f..f535cadc8 100644
--- a/Settings.bundle/Advanced.plist
+++ b/Settings.bundle/Advanced.plist
@@ -88,6 +88,16 @@
Type
PSToggleSwitchSpecifier
+
+ DefaultValue
+
+ Key
+ disable_autoboot_preference
+ Title
+ Disable application autostart
+ Type
+ PSToggleSwitchSpecifier
+
DefaultValue