yes, you are absolutely correct .
As i know App inventor code and java have some different code.
So, i am thinking to create extension. Which is easy .
Or it will also give me an idea to JAVA.
Please Help me
please check my code
yes, you are absolutely correct .
As i know App inventor code and java have some different code.
So, i am thinking to create extension. Which is easy .
Or it will also give me an idea to JAVA.
Please Help me
please check my code
here you are thinking wrong extensions are based on java. java is not based on extensions
okay,i will never ask for editing my java file.
but i am stuck at this point.
so, please check my code
Yeah, if you don't know java, and want to make extensions try making something simple as @Kumaraswamy recommended, making something big will come later on
Hope you understood...
Hope you understood...
Thanks I am Understanding what are you saying .
One more question - can you check my all Import
in my extension.
please reply this question
I have no idea about making ad extensions.
whats the error log
AndroidRuntime:
[mkdir] Created dir: C:\Users\dhana\appinventor-sources\appinventor\components\build\classes\AndroidRuntime
[javac] Compiling 283 source files to C:\Users\dhana\appinventor-sources\appinventor\components\build\classes\AndroidRuntime
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\com\ads\inter\interads.java:41: error: ';' expected
[javac] public String SetAdUnit(String UnitId) {
[javac] ^
[javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\com\ads\inter\interads.java:41: error: ';' expected
[javac] public String SetAdUnit(String UnitId) {
[javac] ^
[javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\com\ads\inter\interads.java:49: error: ';' expected
[javac] public void LoadAd(){
[javac] ^
[javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\com\ads\inter\interads.java:54: error: ';' expected
[javac] public void onAdLoaded(){
[javac] ^
[javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\com\ads\inter\interads.java:59: error: ';' expected
[javac] private void showInterstitial(){
[javac] ^
[javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\com\ads\inter\interads.java:66: error: reached end of file while parsing
[javac] }
[javac] ^
[javac] 6 errors
[javac] 1 warning
BUILD FAILED
C:\Users\dhana\appinventor-sources\appinventor\build.xml:46: The following error occurred while executing this line:
C:\Users\dhana\appinventor-sources\appinventor\components\build.xml:212: The following error occurred while executing this line:
C:\Users\dhana\appinventor-sources\appinventor\build-common.xml:125: Compile failed; see the compiler error output for details.
When i solving these errors.
it showing me another 6 error and 1 warning.
then i removing the 6 error and 1 warning.
it show me another 6 error and 1 warning.
And so on.
anything else do you need about this query
Add a curley closing bracket at the end.
now it say 5 error and 1 warning
here is the log
AndroidRuntime:
[mkdir] Created dir: C:\Users\dhana\appinventor-sources\appinventor\components\build\classes\AndroidRuntime
[javac] Compiling 283 source files to C:\Users\dhana\appinventor-sources\appinventor\components\build\classes\AndroidRuntime
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\com\ads\inter\interads.java:41: error: ';' expected
[javac] public String SetAdUnit(String UnitId) {
[javac] ^
[javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\com\ads\inter\interads.java:41: error: ';' expected
[javac] public String SetAdUnit(String UnitId) {
[javac] ^
[javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\com\ads\inter\interads.java:49: error: ';' expected
[javac] public void LoadAd(){
[javac] ^
[javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\com\ads\inter\interads.java:54: error: ';' expected
[javac] public void onAdLoaded(){
[javac] ^
[javac] C:\Users\dhana\appinventor-sources\appinventor\components\src\com\ads\inter\interads.java:59: error: ';' expected
[javac] private void showInterstitial(){
[javac] ^
[javac] 5 errors
[javac] 1 warning
BUILD FAILED
C:\Users\dhana\appinventor-sources\appinventor\build.xml:46: The following error occurred while executing this line:
C:\Users\dhana\appinventor-sources\appinventor\components\build.xml:212: The following error occurred while executing this line:
C:\Users\dhana\appinventor-sources\appinventor\build-common.xml:125: Compile failed; see the compiler error output for details.
Assuming the last Java code posted is accurate, it looks like you forgot a closing curly brace for the onCreate
method, so the rest of your code is considered to be a part of that function body (which is wrong).
Also, you'll probably get a compiler warning or error on that method because you annotated it @Override
but there isn't a onCreate
method in AndroidNonvisibleComponent
or its supers. You could move some of that logic into the constructor, and most of it isn't needed since it's inflating a view layout, which you can't do in a component.
i have do some changes in my code.
can you check my code again please.
package in.vetbossel.googleadmob;
import java.io.File;
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.common.*;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.DesignerProperty;
import com.google.appinventor.components.annotations.PropertyCategory;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.annotations.UsesLibraries;
import com.google.appinventor.components.annotations.UsesPermissions;
import com.google.appinventor.components.annotations.UsesActivities;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.runtime.util.MediaUtil;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.common.YaVersion;
import com.google.appinventor.components.runtime.*;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.reward.RewardItem;
import com.google.android.gms.ads.reward.RewardedVideoAd;
import com.google.android.gms.ads.reward.RewardedVideoAdListener;
@DesignerComponent(version = 1, // Update version here, You must do for each new release to upgrade your extension
description = "googleadmob",
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = "images/extension.png") // Change your extension's icon from here; can be a direct url
@SimpleObject(external = true)
@UsesPermission(permissionNames = "android.permission.INTERNET", "android.permission.ACCESS_NETWORK_STATE")
@UsesLibraries(libraries = "play-services-ads-15.0.0.jar")
public class googleadmob extends AndroidNonvisbleComponent {
private Context context;
private RewardedVideoAd mRewardedVideoAd;
public googleadmob(final ComponentContainer container) {
super(container.$form());
this.container = container;
}
@SimpleFunction
public void Initialize(String unitID){
MobileAds.initialize(this, unitID);
}
@SimpleFunction
public void LoadAd(){
//RewardedVideoAd
mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this);
mRewardedVideoAd.loadAd("unitID", new AdRequest.Builder().build());
RewardedVideoAdListener rewardedVideoAdListener = new RewardedVideoAdListener() {
@Override
public void onRewardedVideoAdLoaded() {
Loaded();
}
@Override
public void onRewardedVideoAdOpened() {
Opened();
}
@Override
public void onRewardedVideoStarted() {
Opened();
}
@Override
public void onRewardedVideoAdClosed() {
Closed();
}
@Override
public void onRewarded(RewardItem rewardItem) {
String currency = rewardItem.getType();
String amount rewardItem.getAmount();
Rewarded(currency,amount);
}
@Override
public void onRewardedVideoAdLeftApplication() {
LeftApp();
}
@Override
public void onRewardedVideoAdFailedToLoad(int i) {
Failed();
}
}
@SimpleFunction(description = "Block description")
public void showRewardedAd(AndroidViewComponent layout) {
if (mRewardedVideoAd != null && mRewardedVideoAd.isLoaded()) {
View view = layout.getView();
mRewardedVideoAd.show(view);
}
@SimpleEvent
public void Loaded(){
EventDispatcher.dispatchEvent(this,"Loaded");
}
@SimpleEvent
public void Failed(){
EventDispatcher.dispatchEvent(this,"Failed");
}
@SimpleEvent
public void Opened(){
EventDispatcher.dispatchEvent(this,"Opened");
}
@SimpleEvent
public void Started(){
EventDispatcher.dispatchEvent(this,"Started");
}
@SimpleEvent
public void Closed(){
EventDispatcher.dispatchEvent(this,"Closed");
}
@SimpleEvent
public void LeftApp(){
EventDispatcher.dispatchEvent(this,"LeftApp");
}
}
If you're not using any code editor, then use it, it will correct your mistakes in code!
okay now i am using notepad ++
code editor
Ide is better
Notepad++ is a text IDE and not a Java IDE.
Okay, eclipse IDE is good or not ??
Don't go much off-topic please