Amazon Ads

Mind,

I don’t know if this is your exact problem - but it may be something relevant to your issue.

Android application loses state after launching another intent - Stack Overflow
Issue 2373 - android - Activity stack behaves incorrectly during the first run of an app when started from Eclipse - Android Open Source Project - Issue Tracker - Google Project Hosting
Issue 5277 - android - Marketplace / browser app installer allows second instance off app - Android Open Source Project - Issue Tracker - Google Project Hosting

There are two ways suggested to avoid having multiple copies of an app run (as there was a bug with Google Play which if you run from the “Open” button there would launch a second version of the app, even if you already had the first version running - esp. if the first version was running another activity of that app at that time).

One way requires use of GET_TASKS etc.

The second way - which I had selected as perhaps the “better” version uses the launch intent - checks if it includes MAIN and LAUNCHER.

These two are taken from the above links - however the second one seemed better - and requires less permissions.

Basically you insert a first dummy Activity - that is mentioned in the AndroidManifest.xml as the first activity (MAIN and LAUNCHER etc. stuff).

This first dummy activity launches the real activity.

However in this first dummy activity you do the check - if the activity was NOT launched with MAIN and LAUNCHER intent, you do a finish().

This supposdly prevents (or quickly exits) a second run of the app - WELL BEFORE any of your other real and complex code within the “real app” actually gets to run.

The first activity mentioned in AndroidManifest.xml can be identified with this stuff:


<intent-filter>
	<action android:name="android.intent.action.MAIN" />
	<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

This activity can be defined to have no history (since is a dummy first activity, would not want it to be visible in the activity history).

In AndroidManifest.xml define it to have:


	android:noHistory="true"

For example:


	<activity android:name=".FirstDummyActivity"
		android:noHistory="true" ...>

From the onCreate() of your first dummy activity are going to check:



private static boolean isAMultipleLaunch(Activity activity) {

	if (!activity.isTaskRoot()) {
		// return the intent that stated this activity
		//	http://developer.android.com/intl/zh-tw/reference/android/app/Activity.html#getIntent%28%29
		Intent intent = activity.getIntent();

		//	http://developer.android.com/intl/zh-tw/reference/android/content/Intent.html#getAction%28%29
		//	getAction()
		//	Retrieve the general action to be performed, such as ACTION_VIEW.
		String action = intent.getAction();

		//	http://developer.android.com/intl/zh-tw/reference/android/content/Intent.html
		//	hasCategory()
		//	Check if a category exists in the intent.

		if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) &&
				action != null &&
				action.equals(Intent.ACTION_MAIN)) {

			//----------
			// is a multiple launch ..
			return true;
			//----------
		}
	}

	//----------
	// is not a multiple launch ..
	return false;
	//----------
}

public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	if (isAMultipleLaunch(this)) {

		//----------
		// exit
		finish();
		return;
		//----------

	}
	// is NOT a multiple launch .. can move forward ..

	// layout for this dummy activity etc.
	setContentView(R.layout.forthisfirstactivity);


	//----------
	// start the real activity - let's say it's called "TheRealActivity.java"
	{
		Intent startIntent = new Intent(this, TheRealActivity.class);
		startActivity(startIntent);
	}
	//----------

}


np, glad I could help!

Regarding Activity / Fragment, well, I dont use fragments also lol. But remember, the Activity is no much more than a placeholder for the Context and callbacks from the OS. All the logic should be spread into other classes relevant to your app/game, so it doesn’t really matter if you have 1 or 10 activities. My current game has 19k LOC (which isnt much but isnt a small game also), and has only 1 activity, and that activity has only 214 LOC. Thats why I said there is no practical gain from using multiple activities.

Steal the code from Millennial Media example… Banner Ad Refresh Timer ? Android SDK ? Millennial Media Developers

Anyone else seeing CORRECT totals for the Amazon reporting interface ?

I have around 800k adverts per day… but pushing all my USA traffic to Amazon. Mopub saw 480k… so the assumption is that all the rest went to Amazon. However my Amazon stats look like this:

Requests: 18k
Impressions: 31k
Revenue: $27

Amazon seems to be reporting 1/10th of what it is getting… which would make my effective eCPM $0.08 instead of $0.80 …

EDIT: (the next day)…

So, it seems their reporting is broken on the day … the next day, the report was:
Requests: 160k
Fill: 77%
RPM: $0.77

What is LOC ?

Lines of Code.

Regarding Amazon, I’ve had a steep drop in Requests on the last 2 days. Dropped by about 30%.

I didnt change anything on my code regarding it, and according to my analytics the time spent on the app is stable on this last week (around 45 days per day), so the only thing that makes sense to me right now is a bug on their side.

Did anyone experience the same?

@rottz: same here.

I guess it’s something there, then, thanks. I’ve posted on their forum asking for more info.

@mind and others who also use Amazon, is your revenue normal for these last 2-3 days?

Mine is dropping steeply, I believe something is wrong on their side again. Yesterday my revenue was about 20% of what it was 4 days ago, for the same number of requests (while on AdMob it is increasing every day).

@rottz : yep, I am seeing that too! No drop in CTR or requests, but eCPM is down a LOT.

I see the drop but only for December 5. I’m not pushing a lot of traffic there, but the difference in eCPM for that day is huge (3x if I’m counting correctly). By the way I’ve just noticed how high the eCPM normally is, I would have to push more traffic there, especially before Christmas.

meh… my problem is the CTR for WordHero SUCKS because Amazon keeps running the same 3 adverts (no variety!)… because I retain the players for a long time. After they have seen the same 3 adverts for weeks, they just WILL NOT CLICK… why would they … they probably already clicked on at least one of the adverts!

I was thinking about Amazon Ads - but not got around to it.

What I find intruiging is the possibility to have a page of products that you point users to (links having your referral code).

While Amazon does not like apps which are PRIMARILY store apps (i.e. direct competitors of their Amazon Store App) - it should be ok in apps which are primarily something else (after all Amazon DID open up it’s API for mobile app use).

So how has the experience been with the ads delivered by Amazon ? Are they relevant ads ?

Have you considered making an ad page where you point users to merchandise on Amazon that is related to your app’s theme - for example for Word Hero maybe point users to some very good/famous Word Puzzle books or “how to make your own puzzle” or some such. Or perhaps (if the users of Word Hero are primarily women with kids) - having a section for “improve your kid’s vocabulary” - as that would be a strong sense running through your users (in this day and age anyone doing word puzzles will always think the rest of society is not emphasizing vocabulary etc. as much - and will be likely to think of gift books etc. for others or their kids etc. …).

I am also considering using amazon ads in my games. I will report back with any feedback.

@mind - maybe you could limit the number of time users see Amazon Ads? For example show it only once or twice per day for user?