Speech call is now working

This commit is contained in:
Ziver Koc 2014-08-08 17:41:17 +02:00
parent a666888ef8
commit 7a3c4d66ee
3 changed files with 17 additions and 3 deletions

View file

@ -33,12 +33,13 @@
</application> </application>
<uses-sdk android:minSdkVersion="15" <uses-sdk android:minSdkVersion="15"
android:targetSdkVersion="17" /> android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.SEND_SMS" /> <uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest> </manifest>

View file

@ -9,6 +9,8 @@ import com.ericsson.uecontrol.core.UeBehaviour;
import com.ericsson.uecontrol.gui.MainActivity; import com.ericsson.uecontrol.gui.MainActivity;
import com.ericsson.uecontrol.gui.util.Configurator.Configurable; import com.ericsson.uecontrol.gui.util.Configurator.Configurable;
import org.apache.log4j.Logger;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -18,6 +20,7 @@ import java.lang.reflect.Method;
* Created by ezivkoc on 2014-07-15. * Created by ezivkoc on 2014-07-15.
*/ */
public class UeBehaviourSpeechCall extends UeBehaviour{ public class UeBehaviourSpeechCall extends UeBehaviour{
private static final Logger log = Logger.getLogger(UeBehaviourSpeechCall.class);
public static final int SLEEP_PERIOD = 100; public static final int SLEEP_PERIOD = 100;
@Configurable("Phone Number") @Configurable("Phone Number")
@ -35,7 +38,9 @@ public class UeBehaviourSpeechCall extends UeBehaviour{
@Override @Override
protected void execute() throws InterruptedException { protected void execute() throws InterruptedException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
startCall();
int elapsedTime = 0; int elapsedTime = 0;
while(elapsedTime < length){ while(elapsedTime < length){
super.setProgress((float)elapsedTime/length); super.setProgress((float)elapsedTime/length);
@ -43,17 +48,24 @@ public class UeBehaviourSpeechCall extends UeBehaviour{
Thread.sleep(SLEEP_PERIOD); Thread.sleep(SLEEP_PERIOD);
elapsedTime += SLEEP_PERIOD; elapsedTime += SLEEP_PERIOD;
} }
endCall();
} }
private void startCall(){ private void startCall(){
log.debug("Starting Speech Call");
Context context = MainActivity.getContext(); Context context = MainActivity.getContext();
Uri number = Uri.parse("tel:" + phoneNumber); Uri number = Uri.parse("tel:" + phoneNumber);
Intent intent = new Intent(Intent.ACTION_DIAL, number);
Intent intent = new Intent();
//intent.setAction(Intent.ACTION_DIAL);
intent.setAction(Intent.ACTION_CALL);
intent.setData(number);
context.startActivity(intent); context.startActivity(intent);
} }
private void endCall() throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, NoSuchMethodException { private void endCall() throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, NoSuchMethodException {
log.debug("Ending Speech Call");
Context context = MainActivity.getContext(); Context context = MainActivity.getContext();
TelephonyManager tm = (TelephonyManager) context TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE); .getSystemService(Context.TELEPHONY_SERVICE);

View file

@ -6,6 +6,7 @@
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourFtpUpload</item> <item>com.ericsson.uecontrol.core.behaviour.UeBehaviourFtpUpload</item>
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourSendSMS</item> <item>com.ericsson.uecontrol.core.behaviour.UeBehaviourSendSMS</item>
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourSleep</item> <item>com.ericsson.uecontrol.core.behaviour.UeBehaviourSleep</item>
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourSpeechCall</item>
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourSurfing</item> <item>com.ericsson.uecontrol.core.behaviour.UeBehaviourSurfing</item>
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourVideoStreaming</item> <item>com.ericsson.uecontrol.core.behaviour.UeBehaviourVideoStreaming</item>
</string-array> </string-array>