Closed kerberosargos closed 6 years ago
Hi @kerbooo I thing I know what it is. Could you try this version please?
@deckameron Hi again. Firstly Thank you for your support. Unfortunately app is crashing When it is opening. I mean it does not open. May be below debug lines can help you. Thank you for your interest.
[WARN] : DynamiteModule: Local module descriptor class for com.google.android.gms.ads.dynamite not found.
[WARN] : System: ClassLoader referenced unknown path:
[WARN] : System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000013/n/armeabi-v7a
[WARN] : System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000013/n/armeabi
@kerbooo thank you for the logs. I will investigate it.
@deckameron I thank you very much. Have a good job..
Hi @deckameron did you find problem?
@kerbooo not yet. I could not reproduce it yet. But I will keep trying...
@deckameron thank you very much.
@deckameron Hi again. I need to publish new version for my app. Because of that I have changed my approach but this approach is not so useful. May be this approach can help you.
var Admob = require("ti.android.admob");
exports.FncCreateAdmobInterstitial = function() {
var AdmobInterstitial = Admob.createView({
top : 0,
adSizeType : "INTERSTITIALAD",
publisherId : "xxxxxxxxxxxxxxxxxxxxxxxx", //> USE YOUR PUBLISHER ID HERE
testing : false
});
var _Window = Titanium.UI.createWindow({
backgroundColor : "transparent",
theme : "Theme.AppCompat.Translucent.NoTitleBar",
});
_Window.addEventListener("close", function() {
_LabelForAdvertisement = null;
_Window = null;
});
var _LabelForAdvertisement = Ti.UI.createLabel({
color : "#2222222",
text : "Advertisement",
textAlign : Ti.UI.TEXT_ALIGNMENT_CENTER,
font : {
fontSize : 15
},
zIndex : 0,
backgrounColor: "#000000",
borderRadius: 4,
width: 100,
height: 30
});
_Window.add(_LabelForAdvertisement);
_Window.add(AdmobInterstitial);
_Window.open();
_Window.addEventListener('android:back', function(e) {
e.cancelBubble = true;
return false;
});
AdmobInterstitial.addEventListener('ad_not_received', function(e) {
_Window.close();
});
AdmobInterstitial.addEventListener('ad_ready_to_be_shown', function(e) {
AdmobInterstitial.showAdNow();
});
AdmobInterstitial.addEventListener('ad_being_shown', function(e) {
});
AdmobInterstitial.addEventListener('ad_closed', function(e) {
_Window.close();
});
mylibs.FncCreateAdmobInterstitial();
@deckameron Could you find a way? Problem source is about closing window before ad load. I mean If you close window before to load ad Interstitial application crash.
@kerbooo could you try this, please?
Use this version and edit your code like this:
_Window.addEventListener("close", function() {
AdmobInterstitial.destoyAdViewAndCancelRequest();
_LabelForAdvertisement = null;
_Window = null;
});
@deckameron Unfortunately not. I am getting below error;
[ERROR] : TiExceptionHandler: (main) [261,74748] ----- Titanium Javascript Runtime Error -----
[ERROR] : TiExceptionHandler: (main) [0,74748] - In /globalFunctions.js:92,20
[ERROR] : TiExceptionHandler: (main) [0,74748] - Message: Uncaught Attempt to invoke virtual method 'android.app.Activity org.appcelerator.kroll.KrollProxy.getActivity()' on a null object reference
[ERROR] : TiExceptionHandler: (main) [0,74748] - Source: AdmobInterstitial.destoyAdViewAndCancelRequest(),
[ERROR] : V8Exception: Exception occurred at /globalFunctions.js:92: Uncaught Attempt to invoke virtual method 'android.app.Activity org.appcelerator.kroll.KrollProxy.getActivity()' on a null object reference
[ERROR] : V8Exception: Attempt to invoke virtual method 'android.app.Activity org.appcelerator.kroll.KrollProxy.getActivity()' on a null object reference
Hi @kerbooo I am in a middle of trip and I can't work on my module right now. I will work on it again when I get back. In the meanwhile, could try something like this code, please?
var Admob = require("ti.android.admob");
exports.FncCreateAdmobInterstitial = function() {
var _Window = Titanium.UI.createWindow({
backgroundColor : "transparent",
theme : "Theme.AppCompat.Translucent.NoTitleBar",
});
_Window.addEventListener("close", function() {
_LabelForAdvertisement = null;
_Window = null;
});
_Window.addEventListener('android:back', function(e) {
AdmobInterstitial.removeEventListener('ad_ready_to_be_shown', adReadyToBeShownCallback);
e.cancelBubble = true;
return false;
});
var adReadyToBeShownCallback = function(e) {
if(_Window && AdmobInterstitial){
AdmobInterstitial.showAdNow();
}
}
var AdmobInterstitial = Admob.createView({
top : 0,
adSizeType : "INTERSTITIALAD",
publisherId : "xxxxxxxxxxxxxxxxxxxxxxxx", //> USE YOUR PUBLISHER ID HERE
testing : false
});
_Window.add(AdmobInterstitial);
AdmobInterstitial.addEventListener('ad_not_received', function(e) {
_Window.close();
});
AdmobInterstitial.addEventListener('ad_ready_to_be_shown', adReadyToBeShownCallback);
AdmobInterstitial.addEventListener('ad_being_shown', function(e) {
});
AdmobInterstitial.addEventListener('ad_closed', function(e) {
_Window.close();
});
var _LabelForAdvertisement = Ti.UI.createLabel({
color : "#2222222",
text : "Advertisement",
textAlign : Ti.UI.TEXT_ALIGNMENT_CENTER,
font : {
fontSize : 15
},
zIndex : 0,
backgrounColor: "#000000",
borderRadius: 4,
width: 100,
height: 30
});
_Window.add(_LabelForAdvertisement);
_Window.open();
};
mylibs.FncCreateAdmobInterstitial();
@deckameron Unfortunately not too. 3.0.1 and 3.0.2 release are not working. App crash when it opens. 3.0 release is working but last above codes is giving error too. Thank you for your support.
[WARN] : TiDrawableReference: (main) [645,645] Could not open stream to get bitmap
[WARN] : TiDrawableReference: (main) [1,646] Could not open stream to get bitmap
[WARN] : DynamiteModule: Local module descriptor class for com.google.android.gms.ads.dynamite not found.
[WARN] : System: ClassLoader referenced unknown path:
[WARN] : System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000013/n/armeabi-v7a
[WARN] : System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/00000013/n/armeabi
@deckameron I know I bored you. Could you look this issue?
@deckameron me again. I know really I bored you. Could you look that?
Hi @kerbooo I finally had some time to work on my module again. Could you please try this version?
Hi @deckameron Unfortunately it does not work too. App crashes when open.
DynamiteModule: Local module descriptor class for com.google.android.gms.ads.dynamite not found.
@kerbooo are you using these new attributes to create the Interstital View?
publisherId : "ca-app-pub-xxxxxxxxxxxxx~xxxxxxx", //USE YOUR PUBLISHER ID HERE
adUnitId: 'ca-app-pub-xxxxxxxxxxxxx/xxxxxxx', //USE YOUR AD_UNIT ID HERE
@deckameron I have tried after you wrote but I am sorry, result is same.
@kerbooo import this project into your workspace and tell me if it works, please. Don't forget to replace the adUnitId and publisherId for both ads.
@deckameron Thank you for your effort but result is same. I have extract module from project file and add my project. But app crassh when it was opening. After that import your project my workspace but I get error about SDK version. My project titanium SDK is 7.1.0 GA may be you could tray with SDK 7.1.0 GA.
Hİ @deckameron, I hope you are fine. Did you try codes with SDK 7.1.0?
Hi @kerbooo I was very busy with a Geofence Module I was creating for a project and could not work on this one for a few weeks. I will go back to it this weekend. ;-)
@deckameron thank you very much. I am waiting :) Have nice work.
Hi @deckameron could you find problem?
Hi @deckameron Firstly thank you and I am sorry. I was building my project with "run-on-main-thread = false" because of that your module crashing when app was opening. I have changed "run-on-main-thread = true" and it is working now. I am sorry again. Thank you for your support.
@kerbooo I am glad to know everything is ok. I will add this info to the module docs. :-)
@deckameron hi again. I have an error. My app has got multiple windows. I have created common function in my libs folder as below
I am calling above function as below
mylibs.FncCreateAdmobInterstitial($.windowId);
It is working when I wait and do not press android back button quickly. If I press quickly android back button app is crashing.
Do you have any idea?