QQ卡片分享
import "android.net.Uri"
import "android.content.Intent"
function base64(text)
local base64Text=Base64.encodeToString(String(text).getBytes(),Base64.DEFAULT)
return base64Text
end
function qqShare(分享ID,跳转链接,预览图链接,图片链接,标题,描述)
local shareId=分享ID
local jumpUrl=base64(跳转链接)
local previewImgUrl=base64(预览图链接)
local imgUrl=base64(图片链接)
local title=base64(标题)
local description=base64(描述)
local mqqapi="mqqapi://share/to_fri?file_type=news&src_type=web&version=1&share_id="..shareId.."&url="..jumpUrl.."&previewimageUrl="..previewImgUrl.."&image_url="..imgUrl.."&title="..title.."&description="..description.."&callback_type=scheme&thirdAppDsplayName=UVE&app_name=UVE&cflag=0&shareType=0"
activity.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(mqqapi)))
end
--分享ID可以自己去腾讯申请或抓取其他app和网站的,默认手机腾讯网
local 分享ID=1101685683
local 跳转链接="https://m.baidu.com"
local 预览图链接="https://m.baidu.com/static/index/plus/plus_logo.png"
local 图片链接="https://m.baidu.com/static/index/plus/plus_logo.png"
local 标题="这里写标题"
local 描述="这里写内容"
qqShare(分享ID,跳转链接,预览图链接,图片链接,标题,描述)
自定义双击退出
参数=0
function onKeyDown(code,event)
if string.find(tostring(event),"KEYCODE_BACK") ~= nil then
if 参数+2 > tonumber(os.time()) then
activity.finish()--退出程序
else
if(webView.canGoBack())then
webView.goBack()
else
Toast.makeText(activity,"再按一次退出" , Toast.LENGTH_SHORT )
.show()
参数=tonumber(os.time())
end
return true
end
end
end
注明出处
--注明作者
if作者~="浅欢"or
QQ~=1851405918
then
print("请注明出处")
end
文件操作
import "java.io.File"
function 写入文件(路径,内容)
f=File(tostring(File(tostring(路径)).getParentFile())).mkdirs()
io.open(tostring(路径),"w"):write(tostring(内容)):close()
end
function 读取文件(路径)
文件内容=io.open(路径):read("*a")
return 文件内容--return用来返回值
end
写入文件("/storage/emulated/0/Download/浅欢/设置.txt","浅欢:我的;")
a="/storage/emulated/0/Download/浅欢/设置.txt"
b=读取文件(a)
strings=b
c=strings:match("浅欢:(.-);")
print(c)
--如果包名为则弹出
local pm = activity.getPackageName();--获取包名
if pm=="cn.coldsong.fusionapp"--如果包名等于则
then
print("启动销毁模式")
end
--检测抓包软件
if pcall(function() activity.getPackageManager().getPackageInfo("app.greyshirts.sslcapture",0) end) then
print("有抓包软件")
end
网友评论