Skip to content

Commit

Permalink
use auto close notification, dont require wakelock
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfedr committed Mar 16, 2014
1 parent d5378c9 commit 9a6ebfd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
1 change: 0 additions & 1 deletion Android/App/AndroidManifest.xml
Expand Up @@ -6,7 +6,6 @@

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<permission android:name="tv.hromadske.app.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
Expand Down
6 changes: 2 additions & 4 deletions Android/App/res/values/analytics.xml
Expand Up @@ -4,12 +4,10 @@
<!--Replace placeholder ID with your tracking ID-->
<string name="ga_trackingId">UA-46233904-1</string>

<!--Enable automatic activity tracking-->
<bool name="ga_autoActivityTracking">true</bool>

<!--Enable automatic exception tracking-->
<!--Enable automatic exception tracking-->
<bool name="ga_reportUncaughtExceptions">true</bool>

<string name="tv.hromadske.app.MainActivity">Home</string>
<string name="tv.hromadske.app.VideoUkrActivity">Online</string>
<!-- <string name="ga_logLevel">verbose</string> -->
</resources>
@@ -1,20 +1,21 @@
package tv.hromadske.app.gcm;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.support.v4.content.WakefulBroadcastReceiver;

public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {
public class GcmBroadcastReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
// Explicitly specify that GcmIntentService will handle the intent.
ComponentName comp = new ComponentName(context.getPackageName(),
GcmIntentService.class.getName());
// Start the service, keeping the device awake while it is launching.
startWakefulService(context, (intent.setComponent(comp)));
context.startService(intent.setComponent(comp));
setResultCode(Activity.RESULT_OK);
}

Expand Down
5 changes: 2 additions & 3 deletions Android/App/src/tv/hromadske/app/gcm/GcmIntentService.java
Expand Up @@ -61,7 +61,8 @@ protected void onHandleIntent(Intent intent) {
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher))
.setContentTitle(getApplicationContext().getString(R.string.app_name))
.setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
.setContentText(msg);
.setContentText(msg)
.setAutoCancel(true);

PendingIntent contentIntent = PendingIntent.getActivity(this, 0, urlIntent, 0);
mBuilder.setContentIntent(contentIntent);
Expand All @@ -72,8 +73,6 @@ protected void onHandleIntent(Intent intent) {
Log.i(TAG, "Received: " + extras.toString());
}
}
// Release the wake lock provided by the WakefulBroadcastReceiver.
GcmBroadcastReceiver.completeWakefulIntent(intent);
}

protected boolean getPushEnabled()
Expand Down

0 comments on commit 9a6ebfd

Please sign in to comment.