Last active
August 29, 2015 14:28
-
-
Save saturov/3adc2c513bd059d5ca3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends Activity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main_activity); | |
Button wearButton = (Button)findViewById(R.id.wearButton); | |
wearButton.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
int notificationId = 001; | |
NotificationCompat.Builder notificationBuilder = | |
new NotificationCompat.Builder(MainActivity.this) | |
.setSmallIcon(R.mipmap.ic_launcher) | |
.setContentTitle("Title") | |
.setContentText("Android Wear Notification"); | |
NotificationManagerCompat notificationManager = | |
NotificationManagerCompat.from(MainActivity.this); | |
notificationManager.notify(notificationId, notificationBuilder.build()); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment