-1

I am using Jelly Bean 4.2.2 on my device and trying to make a call using Monkeyrunner script. I am using the below code which was working on ICS very well but in JB, it doesn't type the phone number in the edit text box once the key dialer screen is opened.. Does anyone experience this issue?

device.startActivity(component='com.android.contacts/com.android.contacts.activities.DialtactsActivity')

device.type("8888888888")

BR Srini

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

The intent alternative is the correct one for many cases, however if you really want to simulate a real user dialing a number you can use this culebra script slightly edited from autogenerated to add the dialNumber method and other minor things:

#! /usr/local/bin/shebang monkeyrunner -plugin $AVC_HOME/bin/androidviewclient-$AVC_VERSION.jar @!
# -*- coding: utf-8 -*-
'''
Copyright (C) 2013  Diego Torres Milano
Created on 2013-05-15 by Culebra v0.9.8

                      __    __    __    __
                     /  \  /  \  /  \  /  \ 
____________________/  __\/  __\/  __\/  __\_____________________________
___________________/  /__/  /__/  /__/  /________________________________
                   | / \   / \   / \   / \   \___
                   |/   \_/   \_/   \_/   \    o \ 
                                           \_____/--<
@author: Diego Torres Milano
@author: Jennifer E. Swofford (ascii art snake)
'''


import re
import sys
import os


from com.dtmilano.android.viewclient import ViewClient

from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice

def dialNumber(number):
    print "dialing", number
    digits = [zero, one, two, three, four, five, six, seven, eight, nine]
    for d in number:
        if d in ['-', ' ']:
            continue
        digits[int(d)].touch()
        vc.sleep(0.5)
    dial.touch()

device, serialno = ViewClient.connectToDeviceOrExit()
device.startActivity(component='com.android.contacts/com.android.contacts.activities.DialtactsActivity')
vc = ViewClient(device, serialno, autodump=False)
vc.dump(window='-1')

back = vc.findViewWithContentDescriptionOrRaise('backspace')
one = vc.findViewWithContentDescriptionOrRaise('one')
two = vc.findViewWithContentDescriptionOrRaise('two')
three = vc.findViewWithContentDescriptionOrRaise('three')
four = vc.findViewWithContentDescriptionOrRaise('four')
five = vc.findViewWithContentDescriptionOrRaise('five')
six = vc.findViewWithContentDescriptionOrRaise('six')
seven = vc.findViewWithContentDescriptionOrRaise('seven')
eight = vc.findViewWithContentDescriptionOrRaise('eight')
nine = vc.findViewWithContentDescriptionOrRaise('nine')
star = vc.findViewWithContentDescriptionOrRaise('star')
zero = vc.findViewWithContentDescriptionOrRaise('zero')
pound = vc.findViewWithContentDescriptionOrRaise('pound')
dial = vc.findViewWithContentDescriptionOrRaise('dial')
search = vc.findViewWithContentDescriptionOrRaise('search')
moreOptions = vc.findViewWithContentDescriptionOrRaise('More options')


dialNumber("800-555-1234")
Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134