From 512093a3ee9ebf9e9b522a669542924e2718f2d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Fri, 7 Nov 2014 17:11:26 +0100 Subject: [PATCH] Set the application context while creating a LinphoneCore with LinphoneFactory.createLinphoneCore(listener, context) --- java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java | 4 +++- java/impl/org/linphone/core/LinphoneCoreImpl.java | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java index 2bf7b6245..925bae78d 100644 --- a/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreFactoryImpl.java @@ -98,7 +98,9 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory { public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, Object context) throws LinphoneCoreException { try { MediastreamerAndroidContext.setContext(context); - return new LinphoneCoreImpl(listener); + LinphoneCore lc = new LinphoneCoreImpl(listener); + if(context!=null) lc.setContext(context); + return lc; } catch (IOException e) { throw new LinphoneCoreException("Cannot create LinphoneCore",e); } diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 6e6f5a21f..ee360e13c 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -268,6 +268,7 @@ class LinphoneCoreImpl implements LinphoneCore { return logs; } public synchronized void destroy() { + setAndroidPowerManager(null); delete(nativePtr); nativePtr=0; }