全画面広告のOOM対策

自メモ)



最近は普通に入れてるAdのインプレッションだけでは喰っていけないって話で
やたらと全画面広告を導入する流れ。とくにAndroidは凄く顕著

 GAに関しても、IOSに関しては実はあんまり入れること強制されてない。
なぜならそれなりに放置してても収益出てるから。*1

な検証もしてみるとNWアクセスがやはり重いかな。。。(汗

だけどAndに関してはかなりがっちり入れてる。
理由的には、

  • PVはIOSの倍ぐらい有るみたい*2だけどクリック率が凄く悪い

どうやってクリックに誘導するか的な分析情報がほしいから

なレベルの話‥‥‥。

  • 試したことがあるもの
広告名 導入 安定性 特記 資料URL
GameFeat InstallResiverを受信してなんぼなので凄く儲からない*3 Android Q&A - GAMEFEAT マニュアル
Adfurikun 出す広告枠の指定の仕方がわかりづらい ログイン必須
AppliPromotion そこそこ。でも結局Wall形式のほうを多用してたりとか(苦笑 https://www.applipromotion.com/sdk/android
metaps ? 今のところこれが収益的には一番っぽい ログイン必須
appC ? ? 単価的に微妙って話で上の人の判断から外れたみたい ログイン必須?

 GameFeat や ADSTAとか一部の処以外は
基本ユーザ登録しないとドキュメントも見れない状況。
出来ること見られて真似されたりするのがイヤなんだろうな。。。
 
 metapsはパッケージ名と一致しないと広告が出ない*4
したがってsampleですら表示が出来ない気がするんだかうーん?*5

  • △ OOMがでやすい*6

原因的には ARGB8888の画面サイズ8割程度の画像をフルに出したActivityを呼ぶからで
ここらへんはGalaxy S3/Galaxy S4 ででかいサイズのbmpを自前で作っただけでもOOMに苦しめられてる経験があるので
どうにかしないとな‥‥‥という感じ。

アプリで節約するために、画像を9patchにするというのもかなり限界がある

ユーザさん的にはアプリが落ちないで広告が死ぬだけのほうがいいわけだから
色々と試してみる*7



方針的には以下のように考える)

IntentService だとUIを表示する系は駄目>

UIが絡まないなら処理投げっぱなしで勝手に終了する系のIntentServiceのほうが楽だが。。。

従って通常のServiceで実行する形になる。

Activityを引数としてわたす InterstitialAd が実は多い
Serviceが取得できるのはgetApplication まで

従ってカスタムApplicationクラスを拡張してCurrentActityの参照を保持するように拡張する必要がある

Metaps>

表示テストするのに凄く時間かかった。。。つうかフザケンナ的なプロテクトいらん!

AppliPromotion>
initして直ぐshowするintentを発行できるイメージですが
特に終了時に表示するような奴の場合はカスタムApplicationにActivityCallback実装して終了時にstopSelf();
呼ぶイメージになる

Callbackが実装できるIntersAd>

  1. このタイプは onCreateで並行初期化しておくタイプが多い
    1. ただログ見てるとrotateAd等のスレッドがぐるぐる回ってるのが低端末だと負荷的にきつそう*8
  2. 使う所でshowAd等で表示

の形式。

onDissmiss等のタイミングで
stopSelf();
activity.finish()
呼んでやるイメージかなと



9-patchで苦しんだ系メモ)− NG

<LinearLayout
	android:orientation="vertical"
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
>
	<TextView 
    	android:id="@+id/up_sp"
		android:layout_width="match_parent"
		android:layout_height="0dp"
		android:gravity="center"
		android:layout_weight="1"
	/>
	<Button
    	android:id="@+id/btn_test1"
	    android:background="@drawable/test1"
		android:layout_width="match_parent"
		android:layout_height="0dp"
		android:layout_weight="1"
		android:text="test1"
		android:textColor="@color/white"
		android:textSize="20dp"
	/>
	<Button
    	android:id="@+id/btn_test2"
	    android:background="@drawable/test2"
		android:layout_width="match_parent"
		android:layout_height="0dp"
		android:layout_weight="1"
		android:text="test2"
		android:textColor="@color/white"
		android:textSize="20dp"
	/>
	<Button
    	android:id="@+id/btn_test3"
	    android:background="@drawable/test3"
		android:layout_width="match_parent"
		android:layout_height="0dp"
		android:layout_weight="1"
		android:text="test3"
		android:textColor="@color/white"
		android:textSize="20dp"
		/>
	<TextView 
    	android:id="@+id/down_sp"
		android:layout_width="match_parent"
		android:layout_height="0dp"
		android:gravity="center"
		android:layout_weight="1"
	/>
</LinearLayout>

これは均等にならない。。。up_sp/down_sp が存在しない的な認識に鳴る

  • OK
<LinearLayout
	android:orientation="vertical"
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
>
	<TextView 
    	android:id="@+id/up_sp"
		android:layout_width="match_parent"
		android:layout_height="30dp"
		android:gravity="center"
		android:layout_weight="1"
	/>
	<Button
    	android:id="@+id/btn_test1"
	    android:background="@drawable/test1"
		android:layout_width="match_parent"
		android:layout_height="0dp"
		android:layout_weight="1"
		android:text="test1"
		android:textColor="@color/white"
		android:textSize="20dp"
	/>
	<Button
    	android:id="@+id/btn_test2"
	    android:background="@drawable/test2"
		android:layout_width="match_parent"
		android:layout_height="0dp"
		android:layout_weight="1"
		android:text="test2"
		android:textColor="@color/white"
		android:textSize="20dp"
	/>
	<Button
    	android:id="@+id/btn_test3"
	    android:background="@drawable/test3"
		android:layout_width="match_parent"
		android:layout_height="0dp"
		android:layout_weight="1"
		android:text="test3"
		android:textColor="@color/white"
		android:textSize="20dp"
		/>
	<TextView 
    	android:id="@+id/down_sp"
		android:layout_width="match_parent"
		android:layout_height="30dp"
		android:gravity="center"
		android:layout_weight="1"
	/>
</LinearLayout>

android:layout_heightをup_sp/down_sp に指定すれば隙間が開けられる
なかんじ。普通はサイズ均等になるはずなんだけどな。。。*9

一応上記の
 @drawable/test1〜test3 は勿論 9patch
あと 9patch pluginで表示すると[9patchではありません]
と表示が出てうまく認識しないものがあるので、convertをおした後に save-asで保存しなおしてる
認識できるものと出来ないものとの差分がいまいちわからない
ファイル名 XXXX.9.png とする以外に別の要素があるのだろうか?

*1:実は速度体感差はそこにも現れてる気がする。IOSとAndの。。

*2:そのぶんPVでのお金はかなり低めに設定されてる

*3:1月に数クリック程度だったらしい

*4:ログにivalid package と表示される

*5:だったらテスト用のキーをnakamapみたいに入れておいて欲しいんだけどな。。orz

*6:クラッシュレポートに何件か毎verあがってくる

*7:収益的には逆なんだろうけどね。。。<汗

*8:タイムを競うミニゲーム系だと結構重い等のクレームが来る><

*9:shapeとか普通の画像は問題なかった