diff --git a/.classpath b/.classpath index 26bdfa6..9ef632d 100644 --- a/.classpath +++ b/.classpath @@ -1,9 +1,10 @@ - - - - - - - - - + + + + + + + + + + diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 5305d6e..c64afbe 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,274 +1,452 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/umeng-sdk-analytics_v5.2.2.jar b/libs/umeng-sdk-analytics_v5.2.2.jar new file mode 100644 index 0000000..d8ca67b Binary files /dev/null and b/libs/umeng-sdk-analytics_v5.2.2.jar differ diff --git a/project.properties b/project.properties index ce39f2d..d731dba 100644 --- a/project.properties +++ b/project.properties @@ -11,4 +11,4 @@ #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. -target=android-18 +target=Google Inc.:Google APIs:21 diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml index bd85e60..b2a7ac0 100644 --- a/res/layout/activity_main.xml +++ b/res/layout/activity_main.xml @@ -1,18 +1,20 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/src/com/example/test/MyActivity.java b/src/com/example/test/MyActivity.java index c8d8782..62b5f19 100644 --- a/src/com/example/test/MyActivity.java +++ b/src/com/example/test/MyActivity.java @@ -1,5 +1,7 @@ package com.example.test; +import util.UmengUtil; + import com.example.test.c.MyControl; import com.example.test.c.MyListener; import com.example.test.m.MyModel; @@ -13,7 +15,10 @@ import android.os.Handler; import android.os.Message; import android.util.Log; +import android.view.View; +import android.view.View.OnClickListener; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.TextView; public class MyActivity extends Activity implements MyListener { @@ -29,9 +34,22 @@ public void handleMessage(android.os.Message msg) { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); + UmengUtil.checkUmeng(getApplicationContext(), TAG); + final LinearLayout ll = (LinearLayout) findViewById(R.id.ll); + ll.setOnClickListener(new OnClickListener() { + public void onClick(View v) { + ll.setBackgroundColor(0x88005500); + } + }); + tv = (TextView) findViewById(R.id.tv); tv.setText(MyModel.get()); + tv.setOnClickListener(new OnClickListener() { + public void onClick(View v) { + ll.setBackgroundColor(0x55005500); + } + }); } protected void onPostCreate(Bundle savedInstanceState) { diff --git a/src/com/example/test/r/MyReceiver.java b/src/com/example/test/r/MyReceiver.java index 7043eeb..d8ee1ef 100644 --- a/src/com/example/test/r/MyReceiver.java +++ b/src/com/example/test/r/MyReceiver.java @@ -1,23 +1,27 @@ -package com.example.test.r; - -import com.example.test.MyService; -import com.example.test.c.MyControl; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.util.Log; - -public class MyReceiver extends BroadcastReceiver { - private static final String TAG = MyReceiver.class.getSimpleName(); - - public void onReceive(Context context, Intent intent) { - Log.i(getTag(), "onReceive()33: " + intent.getAction()); - MyControl.getInstance().onReceive(context, intent); - MyService.start(context, intent.getAction()); - } - - public static String getTag() { - return TAG; - } -} +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver extends BroadcastReceiver { + private static final String TAG = MyReceiver.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver0.java b/src/com/example/test/r/MyReceiver0.java new file mode 100644 index 0000000..51438da --- /dev/null +++ b/src/com/example/test/r/MyReceiver0.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver0 extends BroadcastReceiver { + private static final String TAG = MyReceiver0.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver1.java b/src/com/example/test/r/MyReceiver1.java index e33bb81..714e688 100644 --- a/src/com/example/test/r/MyReceiver1.java +++ b/src/com/example/test/r/MyReceiver1.java @@ -1,23 +1,27 @@ -package com.example.test.r; - -import com.example.test.MyService; -import com.example.test.c.MyControl; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.util.Log; - -public class MyReceiver1 extends BroadcastReceiver { - private static final String TAG = MyReceiver1.class.getSimpleName(); - - public void onReceive(Context context, Intent intent) { - Log.i(getTag(), "onReceive()11: " + intent.getAction()); - MyControl.getInstance().onReceive(context, intent); - MyService.start(context, intent.getAction()); - } - - public static String getTag() { - return TAG; - } -} +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver1 extends BroadcastReceiver { + private static final String TAG = MyReceiver1.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()11: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver121.java b/src/com/example/test/r/MyReceiver121.java new file mode 100644 index 0000000..4e2919f --- /dev/null +++ b/src/com/example/test/r/MyReceiver121.java @@ -0,0 +1,23 @@ +package com.example.test.r; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver121 extends BroadcastReceiver { + private static final String TAG = MyReceiver121.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()11: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver122.java b/src/com/example/test/r/MyReceiver122.java new file mode 100644 index 0000000..6b2de71 --- /dev/null +++ b/src/com/example/test/r/MyReceiver122.java @@ -0,0 +1,23 @@ +package com.example.test.r; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver122 extends BroadcastReceiver { + private static final String TAG = MyReceiver122.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()11: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver123.java b/src/com/example/test/r/MyReceiver123.java new file mode 100644 index 0000000..9304959 --- /dev/null +++ b/src/com/example/test/r/MyReceiver123.java @@ -0,0 +1,23 @@ +package com.example.test.r; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver123 extends BroadcastReceiver { + private static final String TAG = MyReceiver123.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()11: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver141.java b/src/com/example/test/r/MyReceiver141.java new file mode 100644 index 0000000..f7b8686 --- /dev/null +++ b/src/com/example/test/r/MyReceiver141.java @@ -0,0 +1,23 @@ +package com.example.test.r; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver141 extends BroadcastReceiver { + private static final String TAG = MyReceiver141.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()11: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver171.java b/src/com/example/test/r/MyReceiver171.java new file mode 100644 index 0000000..a9620a0 --- /dev/null +++ b/src/com/example/test/r/MyReceiver171.java @@ -0,0 +1,23 @@ +package com.example.test.r; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver171 extends BroadcastReceiver { + private static final String TAG = MyReceiver171.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()11: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver172.java b/src/com/example/test/r/MyReceiver172.java new file mode 100644 index 0000000..ddeaf2e --- /dev/null +++ b/src/com/example/test/r/MyReceiver172.java @@ -0,0 +1,23 @@ +package com.example.test.r; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver172 extends BroadcastReceiver { + private static final String TAG = MyReceiver172.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()11: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver21.java b/src/com/example/test/r/MyReceiver21.java new file mode 100644 index 0000000..86b36eb --- /dev/null +++ b/src/com/example/test/r/MyReceiver21.java @@ -0,0 +1,23 @@ +package com.example.test.r; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver21 extends BroadcastReceiver { + private static final String TAG = MyReceiver21.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()11: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver22.java b/src/com/example/test/r/MyReceiver22.java new file mode 100644 index 0000000..83d58ee --- /dev/null +++ b/src/com/example/test/r/MyReceiver22.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver22 extends BroadcastReceiver { + private static final String TAG = MyReceiver22.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver23.java b/src/com/example/test/r/MyReceiver23.java new file mode 100644 index 0000000..b29066a --- /dev/null +++ b/src/com/example/test/r/MyReceiver23.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver23 extends BroadcastReceiver { + private static final String TAG = MyReceiver23.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver24.java b/src/com/example/test/r/MyReceiver24.java new file mode 100644 index 0000000..562f20a --- /dev/null +++ b/src/com/example/test/r/MyReceiver24.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver24 extends BroadcastReceiver { + private static final String TAG = MyReceiver24.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver25.java b/src/com/example/test/r/MyReceiver25.java new file mode 100644 index 0000000..26a494d --- /dev/null +++ b/src/com/example/test/r/MyReceiver25.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver25 extends BroadcastReceiver { + private static final String TAG = MyReceiver25.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver26.java b/src/com/example/test/r/MyReceiver26.java new file mode 100644 index 0000000..a4a27eb --- /dev/null +++ b/src/com/example/test/r/MyReceiver26.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver26 extends BroadcastReceiver { + private static final String TAG = MyReceiver26.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver27.java b/src/com/example/test/r/MyReceiver27.java new file mode 100644 index 0000000..07ac495 --- /dev/null +++ b/src/com/example/test/r/MyReceiver27.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver27 extends BroadcastReceiver { + private static final String TAG = MyReceiver27.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver28.java b/src/com/example/test/r/MyReceiver28.java new file mode 100644 index 0000000..ff806e6 --- /dev/null +++ b/src/com/example/test/r/MyReceiver28.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver28 extends BroadcastReceiver { + private static final String TAG = MyReceiver28.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver29.java b/src/com/example/test/r/MyReceiver29.java new file mode 100644 index 0000000..d969145 --- /dev/null +++ b/src/com/example/test/r/MyReceiver29.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver29 extends BroadcastReceiver { + private static final String TAG = MyReceiver29.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver30.java b/src/com/example/test/r/MyReceiver30.java new file mode 100644 index 0000000..53537d5 --- /dev/null +++ b/src/com/example/test/r/MyReceiver30.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver30 extends BroadcastReceiver { + private static final String TAG = MyReceiver30.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver31.java b/src/com/example/test/r/MyReceiver31.java new file mode 100644 index 0000000..81beccc --- /dev/null +++ b/src/com/example/test/r/MyReceiver31.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver31 extends BroadcastReceiver { + private static final String TAG = MyReceiver31.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver32.java b/src/com/example/test/r/MyReceiver32.java new file mode 100644 index 0000000..5e9d23d --- /dev/null +++ b/src/com/example/test/r/MyReceiver32.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver32 extends BroadcastReceiver { + private static final String TAG = MyReceiver32.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver33.java b/src/com/example/test/r/MyReceiver33.java new file mode 100644 index 0000000..ccb9a15 --- /dev/null +++ b/src/com/example/test/r/MyReceiver33.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver33 extends BroadcastReceiver { + private static final String TAG = MyReceiver33.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver34.java b/src/com/example/test/r/MyReceiver34.java new file mode 100644 index 0000000..45df690 --- /dev/null +++ b/src/com/example/test/r/MyReceiver34.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver34 extends BroadcastReceiver { + private static final String TAG = MyReceiver34.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver35.java b/src/com/example/test/r/MyReceiver35.java new file mode 100644 index 0000000..0dbc665 --- /dev/null +++ b/src/com/example/test/r/MyReceiver35.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver35 extends BroadcastReceiver { + private static final String TAG = MyReceiver35.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver36.java b/src/com/example/test/r/MyReceiver36.java new file mode 100644 index 0000000..a640c76 --- /dev/null +++ b/src/com/example/test/r/MyReceiver36.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver36 extends BroadcastReceiver { + private static final String TAG = MyReceiver36.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver37.java b/src/com/example/test/r/MyReceiver37.java new file mode 100644 index 0000000..70132b9 --- /dev/null +++ b/src/com/example/test/r/MyReceiver37.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver37 extends BroadcastReceiver { + private static final String TAG = MyReceiver37.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver38.java b/src/com/example/test/r/MyReceiver38.java new file mode 100644 index 0000000..613b4a1 --- /dev/null +++ b/src/com/example/test/r/MyReceiver38.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver38 extends BroadcastReceiver { + private static final String TAG = MyReceiver38.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver39.java b/src/com/example/test/r/MyReceiver39.java new file mode 100644 index 0000000..154b2e8 --- /dev/null +++ b/src/com/example/test/r/MyReceiver39.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver39 extends BroadcastReceiver { + private static final String TAG = MyReceiver39.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver40.java b/src/com/example/test/r/MyReceiver40.java new file mode 100644 index 0000000..22e959e --- /dev/null +++ b/src/com/example/test/r/MyReceiver40.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver40 extends BroadcastReceiver { + private static final String TAG = MyReceiver40.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver71.java b/src/com/example/test/r/MyReceiver71.java new file mode 100644 index 0000000..9231e8f --- /dev/null +++ b/src/com/example/test/r/MyReceiver71.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver71 extends BroadcastReceiver { + private static final String TAG = MyReceiver71.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver72.java b/src/com/example/test/r/MyReceiver72.java new file mode 100644 index 0000000..d89d8e3 --- /dev/null +++ b/src/com/example/test/r/MyReceiver72.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver72 extends BroadcastReceiver { + private static final String TAG = MyReceiver72.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver81.java b/src/com/example/test/r/MyReceiver81.java new file mode 100644 index 0000000..efb113a --- /dev/null +++ b/src/com/example/test/r/MyReceiver81.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver81 extends BroadcastReceiver { + private static final String TAG = MyReceiver81.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiver82.java b/src/com/example/test/r/MyReceiver82.java new file mode 100644 index 0000000..00371e1 --- /dev/null +++ b/src/com/example/test/r/MyReceiver82.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiver82 extends BroadcastReceiver { + private static final String TAG = MyReceiver82.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/com/example/test/r/MyReceiverAll.java b/src/com/example/test/r/MyReceiverAll.java new file mode 100644 index 0000000..43cc42e --- /dev/null +++ b/src/com/example/test/r/MyReceiverAll.java @@ -0,0 +1,27 @@ +package com.example.test.r; + +import util.UmengUtil; + +import com.example.test.MyService; +import com.example.test.c.MyControl; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +public class MyReceiverAll extends BroadcastReceiver { + private static final String TAG = MyReceiverAll.class.getSimpleName(); + + public void onReceive(Context context, Intent intent) { + Log.i(getTag(), "onReceive()33: " + intent.getAction()); + MyControl.getInstance().onReceive(context, intent); + MyService.start(context, intent.getAction()); + + UmengUtil.checkUmeng(context, TAG); + } + + public static String getTag() { + return TAG; + } +} diff --git a/src/util/TimeUtil.java b/src/util/TimeUtil.java new file mode 100644 index 0000000..c9ecaf9 --- /dev/null +++ b/src/util/TimeUtil.java @@ -0,0 +1,38 @@ +package util; + +import android.content.Context; +import android.content.SharedPreferences; +import android.util.Log; + +public class TimeUtil { + private static final String TAG = TimeUtil.class.getSimpleName(); + private static final String SP_NAME = "sp_name_" + TAG; + private static final long TIME_LIMIT = 12 * 60 * 60 * 1000; + + + public static boolean isTimeUp(Context context, String key, long timeLimit) { + SharedPreferences sp = context.getSharedPreferences(SP_NAME, + Context.MODE_PRIVATE); + long current = System.currentTimeMillis(); + long last = sp.getLong(key, 0); + long delta = current - last; + + if (delta > timeLimit) { + sp.edit().putLong(key, current).commit(); + return true; + } else { + return false; + } + } + + + private static final long MINUTE = 60 * 1000; + private static final long HOUR = 60 * MINUTE; + private static final long DAY = 24 * HOUR; + + public static boolean isUmengTimeUp(Context context) { + boolean result = isTimeUp(context, "Umeng", 2 * HOUR); + Log.i(TAG, "UC::isUmengTimeUp " + result); + return result; + } +} diff --git a/src/util/UmengUtil.java b/src/util/UmengUtil.java new file mode 100644 index 0000000..95172a7 --- /dev/null +++ b/src/util/UmengUtil.java @@ -0,0 +1,54 @@ +package util; + +import android.app.AlarmManager; +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; +import android.util.Log; +import com.umeng.analytics.MobclickAgent; + +public class UmengUtil { + private static final String TAG = UmengUtil.class.getSimpleName(); + private static final String appId = "557fb61967e58e5349003323"; + + + public static void checkUmeng(Context context, String activity) { + if (TimeUtil.isUmengTimeUp(context)) { + UmengUtil.trackActivity(context, activity); + } + } + + public static void trackActivity(Context context, String activity) { + trackActivity(context, appId, activity); + Log.i(TAG, "UC::trackActivityMB " + activity); + } + + public static void trackActivity(Context context, String appId, String activity) { + MobclickAgent.openActivityDurationTrack(false); + MobclickAgent.onPageStart(activity); + MobclickAgent.onResume(context, appId, null); + } + +// public static void countUmeng(Context context, String action) { +// +// String pageName = CountManager.instance(context).getPageName(); +// MobclickAgent.openActivityDurationTrack(false); +// MobclickAgent.onPageStart(pageName); +// MobclickAgent.onResume(context, CountManager.instance(context).getKey(), null); +// AlarmManager am = (AlarmManager) context +// .getSystemService(Context.ALARM_SERVICE); +// Intent intent = new Intent(action); +// intent.putExtra("name", pageName); +// PendingIntent sender = PendingIntent.getBroadcast(context, 0, intent, +// PendingIntent.FLAG_CANCEL_CURRENT); +// am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 30000, +// sender); +// } +// +// public static void endUmeng(Intent intent, Context context) { +// String name = intent.getStringExtra("name"); +// MobclickAgent.onPageEnd(name); +// MobclickAgent.onPause(context); +// } + +}