I have integrated Flurry SDK successfully in Eclipse. Earlier it used to reflect properly in DASHBOARD, but now its not reflecting the "Active Users" in DASHBOARD.
Here are some codes which I've used :
#Override
public void onCreate(Bundle savedInstanceState)
{
// flurry inint
FlurryAgent.init(this, Constants.MY_FLURRY_APIKEY);
}
//For Flurry Integration
#Override
public void onStart()
{
super.onStart();
FlurryAgent.onStartSession(this, Constants.MY_FLURRY_APIKEY);
FlurryAgent.logEvent("Dialer");
}
// #Override
public void onStop()
{
super.onStop();
FlurryAgent.onEndSession(this);
}
Any help will be appreciated. Thanks in advance.Here you can see Active User is not reflecting.
Related
I am using interstitial ads from Admob in my app. Google rejects my app and claims ad fraud. They say that my app displays an ad after exiting the app.
I have changed my ad code to be sure that ad loading and ad displaying only happens when the activity is running and the app is in the foreground. Still they reject my app and claim ad fraud.
I am just doing basic interstitial code here:
implementation 'com.google.android.gms:play-services-ads:19.7.0'
public class AdManager {
boolean activityStarted;
public void onStart() {
activityStarted=true;
}
public void onStop() {
activityStarted=false;
}
public void initializeAds(Context context) {
MobileAds.initialize(context);
MobileAds.setAppMuted(true);
List<String> testDeviceIds = Arrays.asList("some id");
RequestConfiguration configuration =
new RequestConfiguration.Builder().setTestDeviceIds(testDeviceIds).build();
MobileAds.setRequestConfiguration(configuration);
}
public InterstitialAd getInterstialAdWithUnit(Context context) {
InterstitialAd mInterstitialAd = new InterstitialAd(context);
mInterstitialAd.setAdUnitId(BuildConfig.INTERSTITIAL_AD_UNIT_ID);
setAdListener(mInterstitialAd);
checkNewAdNeeded(mInterstitialAd);
return mInterstitialAd;
}
public void setAdListener(InterstitialAd mInterstitialAd) {
mInterstitialAd.setAdListener(new AdListener() {
#Override
public void onAdClosed() {
super.onAdClosed();
checkNewAdNeeded(mInterstitialAd);
}
});
}
public void showAdIfNeeded(InterstitialAd mInterstitialAd) {
if (activityStarted && mInterstitialAd.isLoaded())
mInterstitialAd.show();
else {
checkNewAdNeeded(mInterstitialAd);
}
}
public void requestNewInterstitial(InterstitialAd mInterstitialAd) {
AdRequest adRequest = new AdRequest.Builder()
.build();
mInterstitialAd.loadAd(adRequest);
}
public void checkNewAdNeeded(InterstitialAd mInterstitialAd) {
//do not load ad when acticity is stopped
if (activityStarted && !mInterstitialAd.isLoading() && !mInterstitialAd.isLoaded())
requestNewInterstitial(mInterstitialAd);
}
}
public class FullscreenActivity extends AppCompatActivity {
AdManager adManager=new AdManager();
public void onButtonClicked() {
//call another activity when Button is clicked and wait for return to display ad
activity.startActivityForResult(intent, requestCode);
runOnUiThread(new Runnable() {
#Override
public void run() {
adManager.checkNewAdNeeded(mInterstitialAd);
}
});
}
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//back from other activity, try to display ads only if app has focus
if ( from activity xy) {
if (mHasFocus)
showAdWhileHasFocus();
else
showAdWhenHasFocus=true;
}
}
#Override
protected void onStart() {
super.onStart();
adManager.onStart();
}
#Override
protected void onStop() {
adManager.onStop();
super.onStop();
}
boolean showAdWhenHasFocus;
public void showAdWhileHasFocus() {
showAdWhenHasFocus=false;
adManager.showAdIfNeeded(mInterstitialAd,promotionAndAdsEvent);
}
boolean mHasFocus=false;
#Override
public void onWindowFocusChanged(boolean hasFocus) {
if (!hasFocus) {
} else {
if (showAdWhenHasFocus)
showAdWhileHasFocus();
}
super.onWindowFocusChanged(hasFocus);
}
#Override
protected void onDestroy() {
super.onDestroy();
}
}
I recently faced this issue. But got my app update approved after the following update:
We were having Interstitial ad right while opening the app, This was causing the next screen (Home dashboard) banner ad to hide behind the interstitial add. So I removed the interstitial. This got us the problem fixed.
It might be that playstore/Admob doesn't accept ad at app start, Might be they are trying to force us to use their app open ad instead of interstitial or any other ad unit.
In my case it turned out to be an old version in the test track. In the first version I had an interstitial when exiting the app - which is not allowed. I fixed the issue, but still my app got rejected. After about 10 more tries, I realized that the first version of the app (with the interstitial on exit) was still in the test track, so I removed (or updated) the test track version, and my app was approved.
Seems like after 5 months of app rejections with ad fraud claims my apps are passing review process again. The final change I made was to change the Interstitial class in my AdMob lib to the new API.
import com.google.android.gms.ads.interstitial.InterstitialAd;
InterstitialAd mInterstitialAd;
MobileAds.initialize(...
mInterstitialAd.setFullScreenContentCallback(...
mInterstitialAd.show(...
Admob has made a lot of restructuring and I was using the legacy API. Though it was not declared as legacy until a few weeks ago. The first claim was for version 19.4.0 (https://developers.google.com/admob/android/rel-notes) and it continued until version 19.7.0. Here is a discussion about the topic. https://groups.google.com/g/google-admob-ads-sdk/c/XTJ9kcgxvbY
I am new to in app subscription. I have looked at Google's official documentation but that wasn't helpful. In my app I want to integrate monthly in app subscription. There are no proper tutorials for subscription on YouTube either, there are only for one time in app products. All I know is that I need a product Id and license key for in app purchases and I have them both with me. Can anyone help me with subscription? Here is my code
public class MainActivity extends Activity implements BillingProcessor.IBillingHandler{
BillingProcessor bp;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
bp = new BillingProcessor(this, Constants.base64EncodedPublicKey, this);
bp.purchase(MainSellerActivity.this,"subscription_product_id");
}
#Override
public void onProductPurchased(String productId, TransactionDetails details) {
Toast.makeText(this, "Subscribed Successfully", Toast.LENGTH_SHORT).show();
}
#Override
public void onPurchaseHistoryRestored() {
}
#Override
public void onBillingError(int errorCode, Throwable error) {
}
#Override
public void onBillingInitialized() {
}
The provided code above is a little bit modified, but this is basically where I am stuck at. Everything is working fine with when I use android.test.purchased in place of product Id, but I am getting an error when I use an actual product Id. Please help. If possible please provide a complete code for subscription.
Try this library.it is easy to integrate
android-inapp-billing-v3
I have been trying to use Flurry Analytics with the official documentation but I am not getting it. As answered in the question here: How to use flurry in an application? I used
import com.flurry.android.FlurryAgent;
#Override
protected void onStart()
{
super.onStart();
FlurryAgent.onStartSession(this, "YOUR_API_KEY");
}
#Override
protected void onStop()
{
super.onStop();
FlurryAgent.onEndSession(this);
}
But the above code seems to be deprecated, the official documentation says to use
//If you are shipping an app, extend the Application class if you are not already doing so:
public class MyApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
// configure Flurry
FlurryAgent.setLogEnabled(false);
// init Flurry
FlurryAgent.init(this, MY_FLURRY_APIKEY);
}
}
What is meant by shipping an app?
How to integrate new Flurry analytics? Help me.
The previous versions of Flurry analytics required adding a line of code to each Activity in your app - in the onStart() and onStop() methods:
#Override
public void onStart() {
super.onStart();
// Start Flurry
FlurryAgent.onStartSession(this, );
}
#Override
public void onStop() {
// stop Flurry
FlurryAgent.onEndSession(this);
super.onStop();
}
The latest version of Flurry simplifies this by having you add a single line of code to the Application class of your app - so if you don't have an application class (and for most apps it is probably not needed) you will have to create one:
public class CKApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
// configure flurry...
// init Flurry
FlurryAgent.init(this, MY_FLURRY_APIKEY);
}
</code>
"Shipping" and app means submitting it to Google Play store - or any other app store - in other words making your app available to the public is called "shipping the app".
I had integrated GA in My app but still not able to get any data on GA dashboard.can anyone explain how to do it. dont add any link i had already checked all the sites regarding this.
public void onCreate(Bundle savedInstanceState)
{
tracker=GoogleAnalyticsTracker.getInstance();
tracker.startNewSession("id",this);
tracker.trackPageView("page");
boolean isTracker = tracker.dispatch();
Log.v(TAG, "isTracker "+isTracker);
}
#Override
protected void onDestroy()
{
super.onDestroy();
tracker.stopSession();
Log.v("newslistView","onDestory()");
}
Thank You.
I want to make a test app which uses android facebook sdk.
I have followed all the steps mentioned at http://developers.facebook.com/docs/mobile/android/build/
I am using following snippet given at this link
public class AndroidFacebookActivity extends Activity {
Facebook facebook = new Facebook("282009485165563");
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
facebook.authorize(this, new DialogListener() {
#Override
public void onComplete(Bundle values) {}
#Override
public void onFacebookError(FacebookError error) {}
#Override
public void onError(DialogError e) {}
#Override
public void onCancel() {}
});
}
However when i run this app on emulator, I get following error
The Appliaction has stopped unexpectedly.
from Logcat i see following
java.lang.NoClassDefFoundError: com.facebook.android.Facebook
I have built the facebook application and installed it successfully before running my app.
Please help.
Thanks in Advance
I was able to do it.
Right click on facebook project->Android->check IsLibrary option.
now go to your app, and when you go to add library, it would list facebook library.
just select it and you are good to go...