Added Background bitmap (white square). Changed notification title.

This commit is contained in:
aminecmi 2014-12-04 08:05:06 +01:00
parent 39216f4bf7
commit 9b1307bdd3
2 changed files with 15 additions and 2 deletions

View File

@ -3,6 +3,8 @@ package com.amine.bou.sendtowear.app;
import android.app.Activity; import android.app.Activity;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat;
import android.view.View; import android.view.View;
@ -48,11 +50,22 @@ public class MainActivity extends Activity {
} }
private void createNotification(String sharedText) { private void createNotification(String sharedText) {
Bitmap icon = BitmapFactory.decodeResource(this.getResources(),
R.drawable.background);
NotificationCompat.WearableExtender wearableExtender =
new NotificationCompat.WearableExtender()
.setHintHideIcon(true)
.setBackground(icon);
NotificationCompat.Builder mBuilder = NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this) new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher) .setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("My notification") .setContentTitle("Send To Wear")
.setContentText(sharedText); .setContentText(sharedText)
.extend(wearableExtender)
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(sharedText));
int mNotificationId = 001; int mNotificationId = 001;
NotificationManager mNotifyMgr = NotificationManager mNotifyMgr =

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB