When killing task, service activity to start on incoming call was lost.
This commit is contained in:
parent
c79317486d
commit
b894516ab5
4 changed files with 28 additions and 6 deletions
|
@ -74,7 +74,6 @@ public class LinphoneLauncherActivity extends Activity {
|
|||
classToStart = LinphoneActivity.class;
|
||||
}
|
||||
|
||||
LinphoneService.instance().setActivityToLaunchOnIncomingReceived(classToStart);
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -1236,4 +1236,12 @@ public class LinphonePreferences {
|
|||
public void neverAskCameraPerm(){
|
||||
getConfig().setBool("app", "camera_perm", true);
|
||||
}
|
||||
|
||||
public String getActivityToLaunchOnIncomingReceived() {
|
||||
return getConfig().getString("app", "incoming_call_activity", "org.linphone.LinphoneActivity");
|
||||
}
|
||||
|
||||
public void setActivityToLaunchOnIncomingReceived(String name) {
|
||||
getConfig().setString("app", "incoming_call_activity", name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,6 +127,7 @@ public final class LinphoneService extends Service {
|
|||
mMsgNotifCount = 0;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
@ -163,8 +164,14 @@ public final class LinphoneService extends Service {
|
|||
LinphoneManager.createAndStart(LinphoneService.this);
|
||||
|
||||
instance = this; // instance is ready once linphone manager has been created
|
||||
LinphoneManager.getLc().addListener(mListener = new LinphoneCoreListenerBase(){
|
||||
|
||||
incomingReceivedActivityName = LinphonePreferences.instance().getActivityToLaunchOnIncomingReceived();
|
||||
try {
|
||||
incomingReceivedActivity = (Class<? extends Activity>) Class.forName(incomingReceivedActivityName);
|
||||
} catch (ClassNotFoundException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
|
||||
LinphoneManager.getLc().addListener(mListener = new LinphoneCoreListenerBase() {
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, LinphoneCall.State state, String message) {
|
||||
if (instance == null) {
|
||||
|
@ -411,6 +418,7 @@ public final class LinphoneService extends Service {
|
|||
private Object[] mSetForegroundArgs = new Object[1];
|
||||
private Object[] mStartForegroundArgs = new Object[2];
|
||||
private Object[] mStopForegroundArgs = new Object[1];
|
||||
private String incomingReceivedActivityName;
|
||||
private Class<? extends Activity> incomingReceivedActivity = LinphoneActivity.class;
|
||||
|
||||
void invokeMethod(Method method, Object[] args) {
|
||||
|
@ -569,8 +577,15 @@ public final class LinphoneService extends Service {
|
|||
super.onDestroy();
|
||||
}
|
||||
|
||||
public void setActivityToLaunchOnIncomingReceived(Class<? extends Activity> activity) {
|
||||
incomingReceivedActivity = activity;
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setActivityToLaunchOnIncomingReceived(String activityName) {
|
||||
try {
|
||||
incomingReceivedActivity = (Class<? extends Activity>) Class.forName(activityName);
|
||||
incomingReceivedActivityName = activityName;
|
||||
LinphonePreferences.instance().setActivityToLaunchOnIncomingReceived(incomingReceivedActivityName);
|
||||
} catch (ClassNotFoundException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
resetIntentLaunchedOnNotificationClick();
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ public class RemoteProvisioningActivity extends Activity {
|
|||
|
||||
private void goToLinphoneActivity() {
|
||||
if (LinphoneService.isReady()) {
|
||||
LinphoneService.instance().setActivityToLaunchOnIncomingReceived(LinphoneLauncherActivity.class);
|
||||
LinphoneService.instance().setActivityToLaunchOnIncomingReceived("org.linphone.LinphoneLauncherActivity");
|
||||
//finish(); // To prevent the user to come back to this page using back button
|
||||
startActivity(new Intent().setClass(this, LinphoneLauncherActivity.class));
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue