Created
August 9, 2011 19:37
-
-
Save varis/1134983 to your computer and use it in GitHub Desktop.
Android / General
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
Toast.makeText(this, "Put your message here", Toast.LENGTH_SHORT).show(); |
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
// AndroidManifest.xml must have the following permission: | |
// <uses-permission android:name="android.permission.SEND_SMS"/> | |
SmsManager m = SmsManager.getDefault(); | |
String destinationNumber ="0123456789"; | |
String text = "Hello, MOTO!"; | |
m.sendTextMessage(destinationNumber, null, text, null, null); |
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
int notificationID = 10; | |
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); | |
// Create the notification | |
Notification notification = new Notification(R.drawable.yourIconId, "Put your notification text here", System.currentTimeMillis()); | |
// Create the notification expanded message | |
// When the user clicks on it, it opens your activity | |
Intent intent = new Intent(this, YourActivityName.class); | |
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0); | |
notification.setLatestEventInfo(this, "Put your title here", "Put your text here", pendingIntent); | |
// Show notification | |
notificationManager.notify(notificationID, notification); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment