admob html5,html - Android + HTML5(LocalStorage) + Admob: Bug? - Stack Overflow

I had exeprienced the same issues in getting AdMob working together with storage using Phonegap/Cordova and a sqlite file with my db being copied from the apk into the db location.

I have tried the delay solution mentioned here. My observation was that to access the database with the correct data the window.openDatabase("xxx", "1.0", "xxx", 1000000); needs to be done before the AdRequest is created. This wasn't a solution in my case, since opening the connection again on another page where it is neded will result in the database being empty.

The way I solved this issue was with a plugin available at https://github.com/lite4cordova/Cordova-SQLitePlugin. It works exactly the same as the websql with the exception of opening the database in a different way (not much to rewrite if you have your queries already written). If you open it using:

var db = window.sqlitePlugin.openDatabase({name: "DB"});

it will use a DB.db file rather than the default 0000000000000001.db. This should prevent conflicts with AdMob. 2 things to watch out for:

The plugin needs ondeviceready to be trigerred not just document to

be loaded to open the db.

If you are coping an sqlite file you ship

with the apk, make sure to adjust the location where you copy it to.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值