How to initialize Meta Audience Adapter in Android Studio? - android

i want to use Meta (Facebook) Audience Network bidding inside my app with Google Admob , i have done all that was written in documentation , but the problem is when i test the bidding with AdMob's test suite i see this error ..
See Image here
these are my dependencies
implementation 'com.google.android.gms:play-services-ads:21.3.0'
implementation 'com.facebook.android:audience-network-sdk:6.12.0'
implementation 'com.google.ads.mediation:facebook:6.12.0.0'
and this is in Main Activity
#Override
public void onInitializationComplete(InitializationStatus initializationStatus) {
Map<String, AdapterStatus> statusMap = initializationStatus.getAdapterStatusMap();
for (String adapterClass : statusMap.keySet()) {
AdapterStatus status = statusMap.get(adapterClass);
Log.d("MyApp", String.format(
"Adapter name: %s, Description: %s, Latency: %d",
adapterClass, status.getDescription(), status.getLatency()));
}
MediationTestSuite.launch(MainActivity.this);
}
});
can you please tell me where am i wrong ?
i have tried to changing version code of both facebook and admob's sdk, but not works

Related

Awareness API: com.google.android.gms.common.api.ApiException: 15

In my onCreate I call the following function to detect the weather.
private void detectWeather() {
if( !checkLocationPermission() ) {
return;
}
Awareness.getSnapshotClient(this).getWeather()
.addOnSuccessListener(new OnSuccessListener<WeatherResponse>() {
#Override
public void onSuccess(WeatherResponse weatherResponse) {
Weather weather = weatherResponse.getWeather();
}
})
.addOnFailureListener(new OnFailureListener() {
#Override
public void onFailure(#NonNull Exception e) {
Log.e("Testing", "Could not get weather: " + e);
}
});
}
In my Manifest file I have added the following meta data and permissions:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
<meta-data
android:name="com.google.android.awareness.API_KEY"
android:value="MYKEY"/>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="MYKEY"/>
And in my Gradle file I've added the following dependencies.
compile 'com.google.android.gms:play-services:+'
compile 'com.google.android.gms:play-services-gcm:+'
compile 'com.google.android.gms:play-services-location:+'
compile 'com.google.android.gms:play-services-awareness:+'
The app launches fine and gets to the awareness API, however it throws the following error in the log: com.google.android.gms.common.api.ApiException: 15. I can't really find the explanation for this error in the documentation nor on Google/Stackoverflow. Am I missing something obvious?
For future readers, weather and place is now deprecated in the Google Awareness API.
An alternative is the NumberEight SDK, which can do a lot more than Awareness (although no regioning is available at the time of writing).
It performs a wide variety of context recognition tasks on both iOS and Android including:
Real-time physical activity detection
Current place categories
Motion detection
Reachability
Local weather
It can also record user context for reports and analysis via the online portal.
To quickly receive weather updates in Java, you would write:
NumberEight ne = new NumberEight();
ne.onWeatherUpdated(
new NumberEight.SubscriptionCallback<NEWeather>() {
#Override
public void onUpdated(#NonNull Glimpse<NEWeather> glimpse) {
Log.d("CurrentWeather", glimpse.getMostProbable().toString());
}
});
Here are some iOS and Android example projects.
Disclosure: I'm one of the developers.

How Can I Integrate mobileCore Stickeez Ad?

I explored mobileCore a month ago and decided to use today. But I couldnt integrate.
My Code for İntegrate Stickeez Ad Type:
MobileCore.init(MainActivity.this, "4U5PUKTA688XO2HBFI8O2SPYVVJ47",
MobileCore.LOG_TYPE.PRODUCTION,MobileCore.AD_UNITS.INTERSTITIAL, MobileCore.AD_UNITS.STICKEEZ);
MobileCore.showStickee(MainActivity.this, MobileCore.AD_UNIT_TRIGGER.APP_START);
I dont know why showStickee but it isnt wrong. How can I fix it?
It seems that you're trying to show the ad unit before it is ready. We recommend to use the Ad Unit Event Listener to confirm that the ad unit is ready before calling showStickee(), or at least to not call it together with MobileCore.Init().
Also, if you're using the latest version (v2.0), note that we've added a new loadAdUnit() method that requires to manually fetch the ads before displaying.
Here's an example using Android SDK v2.0:
First, In the onCreate() method of your main activity, Init the SDK:
MobileCore.init(MainActivity.this, *YOUR_DEVELOPER_HASH_HERE*,
MobileCore.LOG_TYPE.PRODUCTION,MobileCore.AD_UNITS.INTERSTITIAL, MobileCore.AD_UNITS.STICKEEZ);
Now here's an example code that loads the ad unit after Init has finished and then displays the ad upon receiving AD_UNIT_READY event:
MobileCore.setAdUnitEventListener(new AdUnitEventListener() {
#Override
public void onAdUnitEvent(MobileCore.AD_UNITS adUnit, EVENT_TYPE eventType,
MobileCore.AD_UNIT_TRIGGER... trigger) {
if (adUnit == MobileCore.AD_UNITS.STICKEEZ) {
if (eventType == EVENT_TYPE.AD_UNIT_INIT_SUCCEEDED) {
MobileCore.loadAdUnit(MobileCore.AD_UNITS.STICKEEZ, MobileCore.AD_UNIT_TRIGGER.APP_START);
}
else if (eventType == AdUnitEventListener.EVENT_TYPE.AD_UNIT_READY) {
for (MobileCore.AD_UNIT_TRIGGER myTrigger : trigger) {
if (myTrigger.equals(MobileCore.AD_UNIT_TRIGGER.APP_START)) {
MobileCore.showStickee(MainActivity.this,
MobileCore.AD_UNIT_TRIGGER.APP_START);
}
}
}
}
}
});
Feel free to contact us at support#mobilecore.com with any question.

Cordova: (ion-google-place) google map api callback not working on Android Phone

i am using ion-google-place directive in my ionic project and when i run it in the ripple I can see that this directive works as expected, however when i deploy it on my Android phone the search bar comes up but when i type no drop down is shown.
I tried to debug the code and can see the issue to be around the following code:
var geocoder = new google.maps.Geocoder();
geocoder.geocode(req, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
scope.$apply(function () {
scope.locations = results;
});
} else {
// #TODO: Figure out what to do when the geocoding fails
console.log("error getting google place...");
}
});
the callback function is never called when running within the android phone, however from ripple its working.
Any ideas as to what I may be missing ?
EDIT 1:
I created a Blank Cordova project and added the refrences to angular and google map. Then added a button and added a ng-onclick to that button as below
$scope.onButtonClick = function () {
var api = new google.maps.places.AutocompleteService();
api.getPlacePredictions({ input: "Banga" }, function (results, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
console.log("google place... success");
} else {
// #TODO: Figure out what to do when the geocoding fails
console.log("error getting google place...");
}
});
Now I see that google is not defined when debugging the Android Phone, where as same when being debugged in ripple, it is working.
is there something on the phone that can prevent the maps from being available to the app?
Regards
Kiran

I can't get Deferred DeepLink

Recently I tested 'deferred deeplink' function by using facebook SDK.
But there is one problem.
# I did it.
First, I have completed all of setting for apps by using the "App Ads Helper" function from developers.facebook.com.
https://developers.facebook.com/tools/app-ads-helper
Second, so I obtained the good result by using "DeepLink Test" provided by"App Ads Helper".
And I could see what i want (AppLinkData)
06-04 12:58:25.598 11903-11925/? I/DEBUG_FACEBOOK_SDK﹕ Bundle[{com.facebook.platform.APPLINK_NATIVE_CLASS=, target_url=myapp://myapp.co.kr?test=1111, com.facebook.platform.APPLINK_NATIVE_URL=myapp://myapp.co.kr?test=1111}]
Third, here is the code what I used.
protected void onCreate(){
....
FacebookSdk.sdkInitialize(getApplicationContext());
AppLinkData.fetchDeferredAppLinkData(getApplicationContext(),
BSTracker.getInstance().getFacebookIdMeta() ,
new AppLinkData.CompletionHandler() {
#Override
public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
if (appLinkData != null) {
Bundle bundle = appLinkData.getArgumentBundle();
Log.i("DEBUG_FACEBOOK_SDK", bundle.toString());
} else {
Log.i("DEBUG_FACEBOOK_SDK", "AppLinkData is Null");
}
}
});
}
Finally. This is My App Setting
Ad Setting
It is My Ad setting.
i did input the DeepLink in "Get install of your App" Ad Product.
# Problem
When I created commercial ad at Facebook and released for the audience but I can't get Deferred DeepLink.
Please let me know, anything is wrong with it.

TweetViewFetchAdapter.setTweetIds does not work in android

I want to display some tweets with the twitter API in my app. To do so I have fetched some tweet ids (which is working without any hassle) and use the TweetViewFetchAdapter adapter provided by the Twitter API to display my tweets.
The weird thing is: this has worked at some point! But then suddenly it stopped working (company app, multiple people working on the code but I haven't seen any changes to the twitter stuff in the time between working and not working)
The code is super straight forward taken from the official twitter site:
// fill the tweet adapter with the loaded tweet ids
#Override
protected void onPostExecute(List<Long> params){
if (params != null && params.size() > 0) {
adapter.setTweetIds(params,
new LoadCallback<List<Tweet>>() {
#Override
public void success(List<Tweet> tweets) {
Log.i("twitter", "Success!");
}
#Override
public void failure(TwitterException exception) {
Log.e("twitter", "Exception: " + exception.getMessage());
}
});
}
Log.i("twitter", "params.size = " + params.size() + "adapter.tweetCount = " + adapter.getCount());
}
(inside an AsyncTask). The adapter seems to fail to set the tweet ids as the debug output is I/twitter﹕ params.size = 10 adapter.tweet Count = 0
I tried to debug/have a log output in the success/failure callbacks, but I never got anything as if the methods would never be called (quite weird actually..)
Regarding log cat output I haven't seen any, but I'm afraid there is a little chance I might have messed it up as we just recently moved to Android Studio and I just can't get my head around some stuff there yet.
Issue was caused by an wrong version of okhttp / okhttp-urlconnection.
The weird part is that no debug messages was shown. This code resolved the debug message issue and helped resolve the issue overall:
final Fabric fabric = new Fabric.Builder(this)
.kits(new Twitter(authConfig))
.logger(new DefaultLogger(Log.DEBUG))
.debuggable(true)
.build();
Fabric.with(fabric);
Overall fix: change build.gradle:
dependencies {
// ...
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.3.0'
}
Original conversation: https://twittercommunity.com/t/adapter-settweetid-seems-to-be-unable-to-load-the-tweets-but-doesnt-fire-a-success-failure-callback/36506/13

Categories

Resources