1
- package com .plugin .gcm ;
2
-
3
- import android .app .Activity ;
4
- import android .content .Intent ;
5
- import android .content .pm .PackageManager ;
6
- import android .os .Bundle ;
7
- import android .util .Log ;
8
-
9
- public class PushHandlerActivity extends Activity
10
- {
11
- private static String TAG = "PushHandlerActivity" ;
12
-
13
- /*
14
- * this activity will be started if the user touches a notification that we own.
15
- * We send it's data off to the push plugin for processing.
16
- * If needed, we boot up the main activity to kickstart the application.
17
- * @see android.app.Activity#onCreate(android.os.Bundle)
18
- */
19
- @ Override
20
- public void onCreate (Bundle savedInstanceState )
21
- {
22
- super .onCreate (savedInstanceState );
23
- Log .v (TAG , "onCreate" );
24
-
25
- boolean isPushPluginActive = PushPlugin .isActive ();
26
- if (!isPushPluginActive ) {
27
- forceMainActivityReload ();
28
- }
29
- processPushBundle (isPushPluginActive );
30
-
31
- GCMIntentService .cancelNotification (this );
32
-
33
- finish ();
34
- }
35
-
36
- /**
37
- * Takes the pushBundle extras from the intent,
38
- * and sends it through to the PushPlugin for processing.
39
- */
40
- private void processPushBundle (boolean isPushPluginActive )
41
- {
42
- Bundle extras = getIntent ().getExtras ();
43
-
44
- if (extras != null ) {
45
-
46
- Bundle originalExtras = extras .getBundle ("pushBundle" );
47
-
48
- if ( !isPushPluginActive ) {
49
- originalExtras .putBoolean ("coldstart" , true );
50
- }
51
-
52
- PushPlugin .sendExtras (originalExtras );
53
- }
54
- }
55
-
56
- /**
57
- * Forces the main activity to re-launch if it's unloaded.
58
- */
59
- private void forceMainActivityReload ()
60
- {
61
- PackageManager pm = getPackageManager ();
62
- Intent launchIntent = pm .getLaunchIntentForPackage (getApplicationContext ().getPackageName ());
63
- startActivity (launchIntent );
64
- }
65
-
1
+ package com .plugin .gcm ;
2
+
3
+ import android .app .Activity ;
4
+ import android .content .Intent ;
5
+ import android .content .pm .PackageManager ;
6
+ import android .os .Bundle ;
7
+ import android .util .Log ;
8
+
9
+ public class PushHandlerActivity extends Activity
10
+ {
11
+ private static String TAG = "PushHandlerActivity" ;
12
+
13
+ /*
14
+ * this activity will be started if the user touches a notification that we own.
15
+ * We send it's data off to the push plugin for processing.
16
+ * If needed, we boot up the main activity to kickstart the application.
17
+ * @see android.app.Activity#onCreate(android.os.Bundle)
18
+ */
19
+ @ Override
20
+ public void onCreate (Bundle savedInstanceState )
21
+ {
22
+ super .onCreate (savedInstanceState );
23
+ Log .v (TAG , "onCreate" );
24
+
25
+ boolean isPushPluginActive = PushPlugin .isActive ();
26
+ if (!isPushPluginActive ) {
27
+ forceMainActivityReload ();
28
+ }
29
+ processPushBundle (isPushPluginActive );
30
+
31
+ GCMIntentService .cancelNotification (this );
32
+
33
+ finish ();
34
+ }
35
+
36
+ /**
37
+ * Takes the pushBundle extras from the intent,
38
+ * and sends it through to the PushPlugin for processing.
39
+ */
40
+ private void processPushBundle (boolean isPushPluginActive )
41
+ {
42
+ Bundle extras = getIntent ().getExtras ();
43
+
44
+ if (extras != null ) {
45
+
46
+ Bundle originalExtras = extras .getBundle ("pushBundle" );
47
+
48
+ if ( !isPushPluginActive ) {
49
+ originalExtras .putBoolean ("coldstart" , true );
50
+ }
51
+
52
+ PushPlugin .sendExtras (originalExtras );
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Forces the main activity to re-launch if it's unloaded.
58
+ */
59
+ private void forceMainActivityReload ()
60
+ {
61
+ PackageManager pm = getPackageManager ();
62
+ Intent launchIntent = pm .getLaunchIntentForPackage (getApplicationContext ().getPackageName ());
63
+ startActivity (launchIntent );
64
+ }
65
+
66
66
}
0 commit comments