I'm trying to integrate an admob banner into my Android application. I have no problem with activities and I see adds in my activities. However, I have problem with WebView. I don't know how should I embed Java Script code into WebView. I saw http://developer.admob.com/wiki/Android but I couldn't solve my problem. My code is:
<script type="text/javascript">
var admob_vars = {
pubid: 'MY_ID', // publisher id
bgcolor: '0000FF', // background color (hex)
text: 'ff8c00', // font-color (hex)
test: true // test mode, set to false to receive live ads
};
</script>
<script type="text/javascript" src="http://mmv.admob.com/static/iphone/iadmob.js"></script>
I want to show my adds at the top of the screen, therefore I have written something like following code in mt html file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>People</title>
</head>
<body>
<div>
<script type="text/javascript">
var admob_vars = {
pubid: 'MY_ID', // publisher id
bgcolor: '0000FF', // background col开发者_高级运维or (hex)
text: 'ff8c00', // font-color (hex)
test: false // test mode, set to false to receive live ads
};
</script>
<script type="text/javascript" src="http://mmv.admob.com/static/iphone/iadmob.js"></script>
</div>
</body>
</html>
What is my problem?
精彩评论