Speech call is now working
This commit is contained in:
parent
a666888ef8
commit
7a3c4d66ee
3 changed files with 17 additions and 3 deletions
|
|
@ -33,12 +33,13 @@
|
|||
</application>
|
||||
|
||||
<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_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<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.WRITE_EXTERNAL_STORAGE" />
|
||||
</manifest>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import com.ericsson.uecontrol.core.UeBehaviour;
|
|||
import com.ericsson.uecontrol.gui.MainActivity;
|
||||
import com.ericsson.uecontrol.gui.util.Configurator.Configurable;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
|
|
@ -18,6 +20,7 @@ import java.lang.reflect.Method;
|
|||
* Created by ezivkoc on 2014-07-15.
|
||||
*/
|
||||
public class UeBehaviourSpeechCall extends UeBehaviour{
|
||||
private static final Logger log = Logger.getLogger(UeBehaviourSpeechCall.class);
|
||||
public static final int SLEEP_PERIOD = 100;
|
||||
|
||||
@Configurable("Phone Number")
|
||||
|
|
@ -35,7 +38,9 @@ public class UeBehaviourSpeechCall extends UeBehaviour{
|
|||
|
||||
|
||||
@Override
|
||||
protected void execute() throws InterruptedException {
|
||||
protected void execute() throws InterruptedException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
|
||||
startCall();
|
||||
|
||||
int elapsedTime = 0;
|
||||
while(elapsedTime < length){
|
||||
super.setProgress((float)elapsedTime/length);
|
||||
|
|
@ -43,17 +48,24 @@ public class UeBehaviourSpeechCall extends UeBehaviour{
|
|||
Thread.sleep(SLEEP_PERIOD);
|
||||
elapsedTime += SLEEP_PERIOD;
|
||||
}
|
||||
endCall();
|
||||
}
|
||||
|
||||
|
||||
private void startCall(){
|
||||
log.debug("Starting Speech Call");
|
||||
Context context = MainActivity.getContext();
|
||||
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);
|
||||
}
|
||||
|
||||
private void endCall() throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, NoSuchMethodException {
|
||||
log.debug("Ending Speech Call");
|
||||
Context context = MainActivity.getContext();
|
||||
TelephonyManager tm = (TelephonyManager) context
|
||||
.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourFtpUpload</item>
|
||||
<item>com.ericsson.uecontrol.core.behaviour.UeBehaviourSendSMS</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.UeBehaviourVideoStreaming</item>
|
||||
</string-array>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue