As the share pop up appears, I shared the content on WhatsApp successfully, but still returns RESULT_CANCELLED. Same result when I send a email using Gmail.
Calling Sharing intent, ACTION_SEND
with startActivityForResult
always returns CANCELLED
Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(android.content.Intent.EXTRA_TITLE, "Taxeeta, Cab Around The Curb"); sharingIntent .putExtra( android.content.Intent.EXTRA_TEXT, "Hiring a cab no longer needs you to wait on call centers, or pay a" + " convenience (yeah right!!) charge. Taxeeta connects you" + " to drivers directly, for a quick book experience. With Taxeeta" + " you can take matters in your own hands (literally). To download" + " the app for your phone visit http://www.taxeeta.com"); startActivityForResult(Intent.createChooser(sharingIntent, "Share and earn a extra Priviledge"), 111);
ActivityForResult Code
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 111) { if (resultCode == RESULT_OK) { Toast.makeText(this, "Ok DUDE", Toast.LENGTH_LONG).show(); } else if (resultCode == RESULT_CANCELED) { Toast.makeText(this, "Oversmart Eh!!", Toast.LENGTH_LONG).show(); } } }