Created
July 17, 2019 15:03
-
-
Save Cuncis/c725bcee4ae7128febd75e51ef6e9c44 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
private void openWhatsApp() { | |
// Ganti nomermu | |
String smsNumber = "6283854775376"; // awal +62 berubah cuma 62 aja | |
try { | |
Intent sendIntent = new Intent("android.intent.action.MAIN"); | |
sendIntent.setAction(Intent.ACTION_SEND); | |
sendIntent.setType("text/plain"); | |
sendIntent.putExtra(Intent.EXTRA_TEXT, "Aku Orang Ganteng dan Intelek"); | |
sendIntent.putExtra("jid", smsNumber + "@s.whatsapp.net"); | |
sendIntent.setPackage("com.whatsapp"); | |
startActivity(sendIntent); | |
} catch(Exception e) { | |
Toast.makeText(this, "Error/n" + e.toString(), Toast.LENGTH_SHORT).show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment