5

Flurryを評価していて、テストプロジェクトに統合しました

アクティビティ:

public class TestFlurryActivity extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Button button = (Button) findViewById(R.id.button1);
    button.setOnClickListener(new View.OnClickListener(){

        @Override
        public void onClick(View v){
            Hashtable<String, String> map = new Hashtable<String, String>();
            for(int i = 0; i < 20; i++){
                map.put("MappedKey"+i, "MappedValue"+i);
            }
            Log.d("Flurry", "Event2");
            FlurryAgent.logEvent("buttonPressedEvent", map);
        }
    });
}

public void onStart()
{
   super.onStart();
   Log.d("Flurry", "Starting1");
   FlurryAgent.onStartSession(this, "FlurryKey");
   Log.d("Flurry", "Setting user");
   FlurryAgent.setUserId("user1");
   Log.d("Flurry", "Event1");
   FlurryAgent.logEvent("Event1");
}

public void onStop()
{
   super.onStop();
   FlurryAgent.onEndSession(this);
}

}

マニフェスト:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.flurry"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".TestFlurryActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>

このサンプルをデバイスで実行すると、フラリーが機能していないように見えます。私のログ(「Flurry」タグ)を除いて、logcatに急なログはありません。

フラリーキーを再確認し、「XXX」の文字列を試してみましたが、何もしませんでした。

私は何が間違っているのですか?

4

2 に答える 2

0

セッションを終了するのを忘れている可能性があります。これは、私が信じるデータを投稿するために必要です。

于 2013-01-11T17:19:43.463 に答える
0
@Override  
     public void onStop() {
         super.onStop();
         FlurryAgent.onEndSession(this);
     }

このコードを追加すると、機能します。

于 2013-08-30T17:18:35.110 に答える