Monday, November 10, 2014
On 11:48 PM by Unknown in admob,
Android,
Android Development,
android help,
google adsense,
How to develop android application,
phonegap
1 comment
Like the article?
Well! Hello Android Developers! It’s been amazing what Google doing since its birth! But, it’s also some kind of pain to cope up with its updates and newer things. It’s been painful for some people to set up new Admob for PhoneGap in new updated system. Previously we used to use an Admob jar file, but now system has been changed. We’ll see this today. The developers who are from web developing background loves to code work with PhoneGap for Android Application development.
For the post, the first recommendation is reading this post: Google Play New Android SDK Setup for AdMob ( AdSense )
In this post I’ll just show the code placement along with file placement. PhoneGap files placement steps:
Step 1: Place cordova.js file in your project folder > assets > www > from workspace.
Step 2: Place XML folder to your project folder > res from workspace.
If you don’t know what I’m talking about, or what is cordova.js file / xml folder, please follow this: http://phonegap.com/install/
Read More: 9 Ideas for Career ( Online Money Making ) based on your Love
Now, The code placement steps:
Step 1: First of all, place the below code in import section, for PhoneGap cordova:
Step 2: We need more importing for AdMob Advertisement. Place the below codes in import section too:
Step 3: Now rename this line ‘public class Second extends Activity ‘ to ‘public class MainActivity extends DroidGap ‘ for using Phonegap
Step 4: Now declare a private variable ‘private AdView adView;’ just before onCreate method.
Step 5: Into onCreate method place this line super.loadUrl("file:///android_asset/www/index.html"); right after super.onCreate(savedInstanceState);
Step 6: Make the onCreate Method public from protected.
Step 7: Now, place the below codes into onCreate method.
Replace setAdUnitID with your Ad Code.
We are done! Now you can compile and see output. If you are not clear yet, you can follow the below image.
After successful placement, Admob add will appear like below image. I took a screenshot for you guys.
Read More: R cannot be resolved to a variable error in Android Development and Solution
I hope you did it successfully, leave a comment if you face any problem. Share this post for others then others will share something good for you too. Subscribe for more.
Read More: Career in Mobile Application Development for You : My Experience
For the post, the first recommendation is reading this post: Google Play New Android SDK Setup for AdMob ( AdSense )
In this post I’ll just show the code placement along with file placement. PhoneGap files placement steps:
Step 1: Place cordova.js file in your project folder > assets > www > from workspace.
Step 2: Place XML folder to your project folder > res from workspace.
If you don’t know what I’m talking about, or what is cordova.js file / xml folder, please follow this: http://phonegap.com/install/
Read More: 9 Ideas for Career ( Online Money Making ) based on your Love
Now, The code placement steps:
Step 1: First of all, place the below code in import section, for PhoneGap cordova:
import org.apache.cordova.DroidGap;
Step 2: We need more importing for AdMob Advertisement. Place the below codes in import section too:
import com.google.android.gms.ads.*;
Step 3: Now rename this line ‘public class Second extends Activity ‘ to ‘public class MainActivity extends DroidGap ‘ for using Phonegap
Step 4: Now declare a private variable ‘private AdView adView;’ just before onCreate method.
Step 5: Into onCreate method place this line super.loadUrl("file:///android_asset/www/index.html"); right after super.onCreate(savedInstanceState);
Step 6: Make the onCreate Method public from protected.
Step 7: Now, place the below codes into onCreate method.
// Create the adView. [ www.imrubel.blogspot.com ]
adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId("ca-app-pub-bbbbb5816378148090/6054xxxxxxxxx");
LinearLayout layout = super.root;
layout.addView(adView);
// [ www.imrubel.blogspot.com ]
AdRequest request = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.build();
// [ www.imrubel.blogspot.com ]
// Start loading the ad in the background.
adView.loadAd(request);
Replace setAdUnitID with your Ad Code.
We are done! Now you can compile and see output. If you are not clear yet, you can follow the below image.
admob ad placement in phonegap for android |
After successful placement, Admob add will appear like below image. I took a screenshot for you guys.
PhoneGap Admob add |
Read More: R cannot be resolved to a variable error in Android Development and Solution
I hope you did it successfully, leave a comment if you face any problem. Share this post for others then others will share something good for you too. Subscribe for more.
Read More: Career in Mobile Application Development for You : My Experience
RELATED POSTS
Subscribe to:
Post Comments (Atom)
Search
Powered by Blogger.
Contact with Rubel
Popular Articles
-
Hello mobile apps developers! if you are developing Mobile application in Phonegap platform. You might face a problem in sometime ' C...
-
Hello Google Play Android Developers! Recently, Google is forcing its developers to use Android Studio rather than using Android Developmen...
-
Hello developers! Hope you are doing well. Many people are coming to application developing, specially in the Android arena. Now, What! Th...
-
Polymorphism We are going to create four Java class in our Polymorphism class. Those are: 1. human.java class 2. women.java class...
-
Even if you are not from Computer Engineering background, still you can have Career in Mobile Application Development. Honestly speaking, b...
-
People related to programming and coding often make mistakes or misuse the words Coders and Programmers by not knowing properly. So, questi...
-
Today we are going to learn Inheritance in JAVA. I've created four java class file. Those are: 1. fatherswealth.java ( Superclass ) ...
Tags
- About Me
- admob
- advice
- Android
- Android Development
- android help
- Android SDK set Up
- Android Studio
- Apps development
- Artcell
- bluehost
- body building
- Can't you make your body building at home?
- Career
- career opportunities
- Coding
- coding problem
- computer science and engineering
- cse
- CSS
- css tricks
- Differences Between Programmers and Coders
- Do you really need to go at Gym?
- Do you really need to go to Gym for having a good shaped body?
- Education
- engineering
- Error
- experience sharing
- fitness center
- Free templates
- good life advice
- google adsense
- google adsense success
- google play
- google play account open
- gym
- hostgator
- How can I get a Google Adsense account
- How to be a freelance
- How to develop android application
- how to develop mobile application
- how to earn money online
- how to make money online
- how to monetize mobile application
- HTML
- HTML/CSS
- Java Tutorial
- Lifestyle
- Linux
- Linux Os
- making money online
- Mobile Application Development
- mosharrof rubel
- noakhali zilla school
- online earning tips
- online earning ways
- phonegap
- Phonegap problem
- Programming
- r cannot be resolved to a variable type
- rubel
- software engineering
- southeast university
- Templates
- Ubuntu
- Ubuntu Help
- web hosting buy
- web hosting reseller
- why computer science?
- wordpress theme
Techonlogy
Subscribe Here
Label
- About Me
- admob
- advice
- Android
- Android Development
- android help
- Android SDK set Up
- Android Studio
- Apps development
- Artcell
- bluehost
- body building
- Can't you make your body building at home?
- Career
- career opportunities
- Coding
- coding problem
- computer science and engineering
- cse
- CSS
- css tricks
- Differences Between Programmers and Coders
- Do you really need to go at Gym?
- Do you really need to go to Gym for having a good shaped body?
- Education
- engineering
- Error
- experience sharing
- fitness center
- Free templates
- good life advice
- google adsense
- google adsense success
- google play
- google play account open
- gym
- hostgator
- How can I get a Google Adsense account
- How to be a freelance
- How to develop android application
- how to develop mobile application
- how to earn money online
- how to make money online
- how to monetize mobile application
- HTML
- HTML/CSS
- Java Tutorial
- Lifestyle
- Linux
- Linux Os
- making money online
- Mobile Application Development
- mosharrof rubel
- noakhali zilla school
- online earning tips
- online earning ways
- phonegap
- Phonegap problem
- Programming
- r cannot be resolved to a variable type
- rubel
- software engineering
- southeast university
- Templates
- Ubuntu
- Ubuntu Help
- web hosting buy
- web hosting reseller
- why computer science?
- wordpress theme
Sponsor
Categories
- About Me
- admob
- advice
- Android
- Android Development
- android help
- Android SDK set Up
- Android Studio
- Apps development
- Artcell
- bluehost
- body building
- Can't you make your body building at home?
- Career
- career opportunities
- Coding
- coding problem
- computer science and engineering
- cse
- CSS
- css tricks
- Differences Between Programmers and Coders
- Do you really need to go at Gym?
- Do you really need to go to Gym for having a good shaped body?
- Education
- engineering
- Error
- experience sharing
- fitness center
- Free templates
- good life advice
- google adsense
- google adsense success
- google play
- google play account open
- gym
- hostgator
- How can I get a Google Adsense account
- How to be a freelance
- How to develop android application
- how to develop mobile application
- how to earn money online
- how to make money online
- how to monetize mobile application
- HTML
- HTML/CSS
- Java Tutorial
- Lifestyle
- Linux
- Linux Os
- making money online
- Mobile Application Development
- mosharrof rubel
- noakhali zilla school
- online earning tips
- online earning ways
- phonegap
- Phonegap problem
- Programming
- r cannot be resolved to a variable type
- rubel
- software engineering
- southeast university
- Templates
- Ubuntu
- Ubuntu Help
- web hosting buy
- web hosting reseller
- why computer science?
- wordpress theme
About
Social Share
Recent
Business
Video
Gallery
videos
Popular Posts
-
Hello mobile apps developers! if you are developing Mobile application in Phonegap platform. You might face a problem in sometime ' C...
-
Hello Google Play Android Developers! Recently, Google is forcing its developers to use Android Studio rather than using Android Developmen...
-
Even if you are not from Computer Engineering background, still you can have Career in Mobile Application Development. Honestly speaking, b...
-
You could find this topic little bit interesting and may not be hoping from me! Well, I was at gym for almost one year and I think I'm ...
-
Today, we are going to learn about Thread in JAVA. simpleThread.java Class public class simpleThread implements Runnable { /* ...
-
Polymorphism We are going to create four Java class in our Polymorphism class. Those are: 1. human.java class 2. women.java class...
-
Array: An array is something more or less like a container of data. Array container contains same type of data. Read More from Orac...
-
People related to programming and coding often make mistakes or misuse the words Coders and Programmers by not knowing properly. So, questi...
-
Today we are going to learn Inheritance in JAVA. I've created four java class file. Those are: 1. fatherswealth.java ( Superclass ) ...
-
Hello developers! Hope you are doing well. Many people are coming to application developing, specially in the Android arena. Now, What! Th...
You can make $20 for each 20 minute survey!
ReplyDeleteGuess what? This is exactly what large companies are paying for. They need to know what their customer needs and wants. So large companies pay $1,000,000's of dollars per month to the average person. In return, the average person, like me, participates in surveys and gives them their opinion.