获取当前活动名称和包裹?

时间:2017-07-18 00:29:16

标签: androidviewclient

我有一个启动新活动的按钮。 AndroidViewClient中是否有API来获取当前活动的包和名称?类似的东西:

models

由于

1 个答案:

答案 0 :(得分:0)

这将打印顶部的活动和包

#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright (C) 2013-2017  Diego Torres Milano
Created on 2017-07-18 by Culebra v13.4.0
                      __    __    __    __
                     /  \  /  \  /  \  /  \ 
____________________/  __\/  __\/  __\/  __\_____________________________
___________________/  /__/  /__/  /__/  /________________________________
                   | / \   / \   / \   / \   \___
                   |/   \_/   \_/   \_/   \    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

TAG = 'CULEBRA'

_s = 5
_v = '--verbose' in sys.argv


kwargs1 = {'ignoreversioncheck': False, 'verbose': False, 'ignoresecuredevice': False}
device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1)
print device.getTopActivityName()

例如

com.android.calculator2/.Calculator