Working AdMob ANE for AIR 4.0 or 13 - android

I am trying to add an AdMob ANE to an empty Flex Mobile Project but I can see nothing inside the view. Also I am checking the load events and no error occurs. :(
My setup:
Adobe FlashBuilder 4.7 (64 bit) Windows
Apache Flex 4.10 ( AIR 4.0 )
Valid AdMob GUID
Updated -app.xml file to allow AdMob
Tested with the samples from following open source ANEs
https://code.google.com/p/flash-air-admob-ane-for-ios-and-android/
https://github.com/pozirk/ANEAdMob
And so far no luck...
Can someone suggest better anes or comment if the listed ones work for their apps ?
Thanks!
Update
I have reupdated my sdk and updated AIR on my device to latest version from
/sdk/runtimes/air/android/device/
Now with the ANE from 1st URL i receive the following message in console:
admob ane log:status code:onBannerFailedReceivelevel:3
My code for this ANE looks like this (just same as in the sample from github )
package com.redcodelabs.view
{
import flash.geom.Rectangle;
import mx.core.UIComponent;
import so.cuo.platform.admob.Admob;
import so.cuo.platform.admob.AdmobEvent;
import so.cuo.platform.admob.AdmobPosition;
public class AdMobView extends UIComponent
{
public var admob:Admob=Admob.getInstance();//create a instance
public function AdMobView()
{
super();
admob.addEventListener(AdmobEvent.onBannerReceive, onAdReceived);
//set admob banner ID
admob.setKeys("ca-app-pub-246436233824XXXX/361665XXXX");
//show banner with relation position
admob.showBanner(Admob.BANNER,AdmobPosition.BOTTOM_CENTER);
}
protected function onAdReceived(event:AdmobEvent):void
{
trace(event.type);
if(event.type==AdmobEvent.onBannerReceive)
{
trace(" -- "+event.data.width,event.data.height);
}
}
}
}

With Milkmangames Admob ANE, you now have to add another ANE : Google Services.
It's a new update, and ads won't show if you don't add this ANE (even if it works an no error messages is shown).
I don't know if it's only for MilkmanGames ANEs, but maybe you have to look if a new version if available.
By the way i'm trying Adbuddiz which is a free ANE and seems to give more money than admob.

I have worked with Flash Mobile apps and the first Adobe ANE link mentioned by you where the ads show up fine. Not sure if it would be different for Flex Mobile.
Are you working with the updated Admob interface or the new one. Maybe you want to recheck your Ad id.
Also which platform are you compiling your app to? Can you share a bit of your code?
Alternately, there are many ANEs more for Admob -
MilkMan Games - http://www.milkmangames.com/blog/2012/09/27/admob-air-native-extension-now-for-ios-and-android/
This ANE is a paid one
You can also add the Admob network to MoPub and use the MoPub ANE.
https://github.com/StickSports/MoPub-ANE

onBannerFailedReceivelevel:3
error code 3 mean not enough ad for show.not your code error
package so.cuo.platform.admob
{
public class AdmobError
{
public static const ERROR_CODE_ERNAL_ERROR :int= 0;
public static const ERROR_CODE_INVALID_REQUEST :int= 1;
public static const ERROR_CODE_NETWORK_ERROR :int= 2;
public static const ERROR_CODE_NO_FILL :int= 3;
}
}
ref
https://github.com/lilili87222/admob-for-flash/blob/master/admob_ane_ios_android/doc/AdmobError.as

you are using an old ane version,admob need new version sdk after update to admob 2.0
and the error admob ane log:status code:onBannerFailedReceivelevel:3 mean that no ad for show.
check out the new version(the old link is brike project has moved to http://code.google.com/p/flash-air-admob-ane-for-ios-and-android/ ),you will get more error detail about the error code 3.

Related

google_sign_in Flutter plugin always returns null serverAccessCode

I have the current workflow for my authentication
User signs in via google OAuth2
User is then given a server_auth_code which they send to my backend authentication
The auth code is validated on the back end and users is sent a JWT
I had this all working in raw Java with the Android SDK, but Flutter seemed a lot nicer. But now when using the google_sign_in plugin on android, I am unable to retrieve the serverAuthCore anymore, this plugin just wants to return null the entire time.
I Am using the client ID that's specified for Android, however, I tested the WebApplication that's auto-generated by google too but that's the same issue (Null serverAutHCode)
This is the code that I am currently using:
/// Provides the `GoogleSignIn` class
import 'package:google_sign_in/google_sign_in.dart';
class GoogleLoginPage extends StatefulWidget {
final String name = "Logging in with google.";
late GoogleSignIn _googleSignIn;
GoogleLoginPage() : super() {
_googleSignIn = GoogleSignIn(
scopes: ['https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile'],
serverClientId: "XX-XXX.apps.googleusercontent.com"
);
}
Future<void> fetchAuthToken() async {
try {
var response = await _googleSignIn.signIn();
log(response?.serverAuthCode ?? "No server auth code");
_googleSignIn.signOut();
} catch (error) {
print("ERR");
print(error);
}
}
#override
State<GoogleLoginPage> createState() => GoogleLoginState();
}
The output of this code is: [log] No server auth code
The question:
Am I doing something wrong? As mentioned this works 100% on my java project using the google play services SDK so I know it's nothing to do with my google console configurations.
Okay so I figured out the issues:
It appears that by default the google login plugin for flutter comes on an older version (If I remember correctly it was 20.0.5)
I Simply changed the version to the latest version:
'com.google.android.gms:play-services-auth:20.2.0'
You can do this by editing the project's build.gradle (In IntelliJ you open build.gradle and click "Open for editing in the android studio" in the top right, from there you need to find the gradle file for google_sign_in, and change the import there, remember to click sync in the top right of android studio before you close out of it)
And I began to receive my serverAuthCode as normal, cheers!

PayPal Here Android SDK Error - BadConfiguration: Cannot proceed with this merchant account

I'm trying to integrate the PayPal Here swipers into a Xamarin Android app. Everything is fine until I try and give my credentials to the SDK. Specifically, the line containing the call to PayPalHereSDK.SetCredentials
public void InitializeSdk( Context context, string serverName, string accessToken, string refreshUrl, string expires, IPayPalHereSdkWrapperCallback listener ) {
PayPalHereSDK.Init( context, serverName );
PayPalHereSDK.RegisterAuthenticationListener( this );
PayPalHereSDK.CardReaderManager.RegisterCardReaderConnectionListener( this );
if ( !string.IsNullOrEmpty( accessToken ) ) {
var credentials = new OAuthCredentials( accessToken, refreshUrl, expires );
PayPalHereSDK.SetCredentials( credentials, new SetAccessTokenResponseHandler( listener ) );
}
}
My SetAccessTokenResponseHandler class implements the Com.PayPal.Merchant.Sdk.Domain.IDefaultResponseHandler interface. As described above, the OnError function is called when call the PayPalHereSDK.SetCredentials function. I'm given the error code "BadConfiguration" and the message "Cannot proceed with this merchant account. ready"
I've searched Google high and low and, I believe, scoured SO pretty thoroughly. I can't seem to overcome the error, so I'm asking for help!
I think the paypal email is not verified properly. Please go through the merchant onboarding guide document to get more details regarding making the merchant eligible.
https://github.com/paypal/paypal-here-sdk-android-distribution/blob/master/docs/Merchant%20Onboarding%20Guide.pdf
Hope this helps. Cheers.
I'm not sure what exactly the issue was, but I ended up deleting the Sandbox App in my PayPal dev portal and creating a new one. Everything works now. head scratch
I resorted to this because, while trying to follow Sundar's suggestion, I started getting an "invalid scope" error. I had received them before and KNEW I had it fixed ( and no code had changed ). When I deleted/recreated the app, that error went away. Frustrating, but that's what worked!

cordova.file.* (all directories) are null

I'm working on Ionic mobile app development.
My requirement is to create client side logger to track issues in app. I used the methods mentioned in https://github.com/pbakondy/filelogger, and I could able to create the log file in both Android and iOS.
For the first time when I open the app, it creates the log file in cordova.file.dataDirectory, when I close and reopen the app in i*OS, I'm trying to read the content of the file which was created using the below
$fileLogger.getLogfile().then(function (loggerContent) {
var temp =loggerContent;
});
But the application says
{
"applicationDirectory":null,
"applicationStorageDirectory":null,
"dataDirectory":null,
"cacheDirectory":null,
"externalApplicationStorageDirectory":null,
"externalDataDirectory":null,
"externalCacheDirectory":null,
"externalRootDirectory":null,
"tempDirectory":null,
"syncedDataDirectory":null,
"documentsDirectory":null,
"sharedDirectory":null
}
So I couldn't able to find the file where i saved my logs.
Please help me resolve this issue or if you could recommend me a different method to get around this issue, that would be great!
Thanks for the answers
There is a check list here and should solve your problem :
1-Be sure that the cordova-file-plugin is installed and works in your test environment.
2-Be sure that the cordova.js file is refrenced by your html and before your code usage.
3-Be sure to call your codes after device_ready state :
check this
4-Call your function after a short delay (use setTimeOut in Javascirpt)
Ali's item 4 is very important:
I had a similiar problem on different platforms: cordova.file.dataDirectory was null.
I tracked cordova.file.dataDirectory over the lifecycle and it was first accessed by my Ionic 2 code BEFORE the device ready event was fired.
My "mistake": I wanted to load data during the constructor(!) of a service. Seems too early.

Unity Plugin AndroidJavaException NoSuchMethodError on Function with parameters

I got a very annoying issue. All of my Android plugins in Unity just work if I dont use parameters in the calling functions. I am working on this issue since 2 days and I am slowly running out of ideas. Even a minimal project doesnt work. I am sure Iam doing it right because my functions are working fine without parameters.
Unity:
void Start (){
AndroidJavaClass pluginClass = new AndroidJavaClass("tnbrtrm.lications.de.myplugin.MyPlugin");
String test = pluginClass.CallStatic<string>("getMessage", new object[] { "alalalalala" });
Debug.Log("callShareAppAARPlugin: " + test);}
Android:
public class MyPlugin extends UnityPlayerActivity {
public static String getMessage(String text)
{ return "Hello World! " + text; }
}
My plugin prints "Hello world" correctly when I delete the parameter "String text", but with parameter I get this annoying error:
AndroidJavaException: java.lang.NoSuchMethodError: no static method "Ltnbrtrm/lications/de/myplugin/MyPlugin;.getMessage(Ljava/lang/String;)Ljava/lang/String;"
I see this error using Plugins as *.jar or *.aar. And I also had a look into this packages and my Classes and Functions are there. Otherwise it wouldnt work without parameters... I tried AndroidJavaClass and AndroidJavaObject.
Can anyone please help me? I tried a lot of things... (older JDK versions, etc.) I seems so easy in all the turorials so I assume it has something to do with my system or unity (5.3.5 pro).
Kind regards,
Tino

Checking disk space on cordova iOS

I am trying to check disk space available in mobile using below code:
cordova.exec(function(result) {
var diskSizeInMB = result/1024;
alert(diskSizeInMB)
}, function(error) {
alert("Error: " + error);
}, "File", "getFreeDiskSpace", []);
In Android device it gives me correct result, whereas if I use iPhone/iPad it always returns me 0 as a output. Can anyone guide me how to resolve this issue? Or is there a way to check the disk size in iOS using cordova without writing custom plugin? To make this happen I haven't changed any configuration changes
It was a bug, but was fixed long time ago.
Old answer:
I confirm there is a bug on the code, the problem is getFreeDiskSpace is undocumented and cordova team want to remove the native code as getFreeDiskSpace isn't part of the w3c file API.
If you want to fix the bug for you app, go to CDVFile.m and change the line
NSNumber* pNumAvail = [self checkFreeDiskSpace:self.appDocsPath];
to
NSNumber* pNumAvail = [self checkFreeDiskSpace:self.rootDocsPath];
on the getFreeDiskSpace method

Categories

Resources