@@ -103,7 +103,7 @@ Add the following blocks to your app's `MainActivity`:
103103
104104```java
105105
106- import com.hoxfon.react.RNTwilioVoice.Constants ;
106+ import com.hoxfon.react.RNTwilioVoice.TwilioModule ;
107107...
108108
109109public class MainActivity extends ReactActivity {
@@ -117,30 +117,7 @@ public class MainActivity extends ReactActivity {
117117 }
118118 @Override
119119 protected Bundle getLaunchOptions() {
120- Bundle initialProperties = new Bundle();
121- Intent intent = this.getPlainActivity().getIntent();
122- if (intent == null || intent.getAction() == null) {
123- return initialProperties;
124- }
125- switch (intent.getAction()) {
126- case Constants.ACTION_INCOMING_CALL_NOTIFICATION:
127- Bundle callInviteBundle = new Bundle();
128- callInviteBundle.putString(Constants.CALL_SID, intent.getStringExtra(Constants.CALL_SID));
129- callInviteBundle.putString(Constants.CALL_FROM, intent.getStringExtra(Constants.CALL_FROM));
130- callInviteBundle.putString(Constants.CALL_TO, intent.getStringExtra(Constants.CALL_TO));
131- initialProperties.putBundle(Constants.CALL_INVITE_KEY, callInviteBundle);
132- break;
133-
134- case Constants.ACTION_ACCEPT:
135- Bundle callBundle = new Bundle();
136- callBundle.putString(Constants.CALL_SID, intent.getStringExtra(Constants.CALL_SID));
137- callBundle.putString(Constants.CALL_FROM, intent.getStringExtra(Constants.CALL_FROM));
138- callBundle.putString(Constants.CALL_TO, intent.getStringExtra(Constants.CALL_TO));
139- callBundle.putString(Constants.CALL_STATE, Constants.CALL_STATE_CONNECTED);
140- initialProperties.putBundle(Constants.CALL_KEY, callBundle);
141- break;
142- }
143- return initialProperties;
120+ return TwilioModule.getActivityLaunchOption(this.getPlainActivity().getIntent());
144121 }
145122 };
146123 }
0 commit comments