解析安装包
2023-01-24 09:16:15 最后更新
call(c,"mlua","lua.getApp","com.iapp.app",2)
sl(c,";",c)
sgsz(c,0,pn)
us(1,"text",pn)
.解析包名
sgsz(c,1,name)
us(2,"text",name)
.解析图标
sgsz(c,2,ver)
us(3,"text",ver)
.解析名字
sgsz(c,3,last)
us(4,"text",last)
.解析安装时间
以下代码放到lua模块中
重命名为lua.mlua
--请标明"摘自枭燚的源码"请尊重他人智力劳动
function getApp(packageName,id)
  require "import"
  import "android.content.pm.PackageManager"
  import "android.widget.ImageView"
  local pm = activity:getPackageManager()
  local icon = pm:getApplicationInfo(tos(packageName),0)
  local appIcon = icon:loadIcon(pm)
  local imageView = i:gvs(id)
  imageView:setBackground(appIcon)

  local pkg = activity:getPackageManager():getPackageInfo(packageName, 0)
  local appName = pkg.applicationInfo:loadLabel(activity:getPackageManager())
  local version = activity:getPackageManager():getPackageInfo(packageName, 0).versionName
  local last = activity:getPackageManager():getPackageInfo(packageName, 0).lastUpdateTime
  local cal = Calendar:getInstance()
  cal:setTimeInMillis(last) 
  local lastTime = cal:getTime():toLocaleString()
  local list = packageName..";"..appName..';'..version..";"..lastTime

  return list
end
function savePicture(name,bm)
  if bm then
    require "import"
    import "java.io.FileOutputStream"
    import "java.io.File"
    import "android.graphics.Bitmap"
    local name=tos(name)
    local f = File(name)
    local out = FileOutputStream(f)
    bm:compress("PNG",90, out)
    out:flush()
    out:close()
    return true
  else
    return false
  end
end