1
1
package com .dimelo .sampleapp ;
2
2
3
3
import android .app .IntentService ;
4
- import android .app .PendingIntent ;
5
- import android .content .Context ;
6
4
import android .content .Intent ;
7
5
import android .os .Bundle ;
8
- import android .support .annotation .NonNull ;
9
- import android .support .v4 .app .TaskStackBuilder ;
10
6
11
- import com .dimelo .dimelosdk .main .ChatActivity ;
12
7
import com .dimelo .dimelosdk .main .Dimelo ;
13
8
import com .google .android .gms .gcm .GoogleCloudMessaging ;
14
9
@@ -23,14 +18,13 @@ protected void onHandleIntent(Intent intent) {
23
18
Bundle extras = intent .getExtras ();
24
19
GoogleCloudMessaging gcm = GoogleCloudMessaging .getInstance (this );
25
20
String messageType = gcm .getMessageType (intent );
26
-
27
21
if (!extras .isEmpty ()) { // has effect of unparcelling Bundle
28
22
if (GoogleCloudMessaging .MESSAGE_TYPE_SEND_ERROR .equals (messageType )
29
23
|| GoogleCloudMessaging .MESSAGE_TYPE_DELETED .equals (messageType )){
30
24
// An error occured
31
25
}
32
26
else if (GoogleCloudMessaging .MESSAGE_TYPE_MESSAGE .equals (messageType )) {
33
- if (Dimelo .consumeReceivedRemoteNotification (this , extras , notifDisplayer )){
27
+ if (Dimelo .consumeReceivedRemoteNotification (this , extras , null )){
34
28
// Cool !
35
29
}
36
30
else {
@@ -41,17 +35,4 @@ else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {
41
35
// Release the wake lock provided by the WakefulBroadcastReceiver.
42
36
GcmBroadcastReceiver .completeWakefulIntent (intent );
43
37
}
44
-
45
- Dimelo .BasicNotificationDisplayer notifDisplayer = new Dimelo .BasicNotificationDisplayer () {
46
-
47
- @ Override
48
- public @ NonNull PendingIntent createPendingIntent (Context context , String message ) {
49
- return TaskStackBuilder .create (GcmIntentService .this )
50
- .addParentStack (ChatActivity .class )
51
- .addNextIntent (new Intent (context , ChatActivity .class ).addFlags (Intent .FLAG_ACTIVITY_SINGLE_TOP | Intent .FLAG_ACTIVITY_CLEAR_TOP ))
52
- .getPendingIntent (1 , PendingIntent .FLAG_CANCEL_CURRENT );
53
- }
54
-
55
- };
56
-
57
38
}
0 commit comments