Skip to main content

Check if app is running (app.is_running)

Declaration

ok = app.is_running(bid)

Parameters

  • bid
    String. App bundle identifier. You can find it in XXT App -> More -> App List.

Returns

  • ok
    Boolean. Whether the app is running (foreground or background).

Notes

  • To check if an app is in the foreground, compare with app.front_bid:
if "com.tencent.mqq" == app.front_bid() then
sys.alert('QQ is in foreground')
end

Note: uses non-chapter API sys.alert.

Example

if app.is_running("com.tencent.mqq") then
sys.alert('QQ is running')
end

Note: uses non-chapter API sys.alert.