Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autojs 可以对接穿山甲的 gromore吗? #300

Open
maomaoshu opened this issue Jan 11, 2025 · 1 comment
Open

autojs 可以对接穿山甲的 gromore吗? #300

maomaoshu opened this issue Jan 11, 2025 · 1 comment
Labels
Doubt ❔ 疑惑 Any doubts about this repository Feedback Awaited 🕒 等待反馈 Waiting for the feedback from issue creater and issue will be closed if duration is over one month

Comments

@maomaoshu
Copy link

autojs 可以对接穿山甲的 gromore吗?谢谢

@SuperMonster003
Copy link
Owner

通过 AutoJs6 的外部插件加载功能 (runtime.loadJar/runtime.loadDex), 理论上可以集成 GroMore 或其他类似的广告 SDK. 但能否正常执行脚本代码, 以及实现预期的功能, 需要你亲自尝试.

以下是一种可能的实现方式用于参考:

runtime.loadJar("./groMore.jar");

// 如果以下声明语句报错, 可以尝试移出这些声明代码.
const TTAdSdk = "com.bytedance.sdk.openadsdk.TTAdSdk";
const AdSlot = "com.bytedance.sdk.openadsdk.AdSlot";
const TTAdNative = "com.bytedance.sdk.openadsdk.TTAdNative";

const appId = "your_app_id";
const codeId = "your_ad_slot_id";

TTAdSdk.init(context, {
    appId,
    debug: true,
});

let adSlot = new AdSlot.Builder()
    .setCodeId(codeId)
    .setSupportDeepLink(true)
    .setAdCount(1)
    .build();

let adManager = TTAdSdk.getAdManager();
let adNative = adManager.createAdNative(context);
adNative.loadRewardVideoAd(adSlot, new TTAdNative.RewardVideoAdListener({
    onError(code, message) {
        console.log(`广告加载失败: ${message}`);
    },
    onRewardVideoAdLoad(ad) {
        console.log("广告加载成功");
        ad.showRewardVideoAd(context);
    },
    onRewardVideoCached() {
        console.log("广告缓存完成");
    }
}));

@SuperMonster003 SuperMonster003 added Doubt ❔ 疑惑 Any doubts about this repository Feedback Awaited 🕒 等待反馈 Waiting for the feedback from issue creater and issue will be closed if duration is over one month labels Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Doubt ❔ 疑惑 Any doubts about this repository Feedback Awaited 🕒 等待反馈 Waiting for the feedback from issue creater and issue will be closed if duration is over one month
Projects
None yet
Development

No branches or pull requests

2 participants