當彈出的共享出現時,我在WhatsApp上成功共享內容,但仍返回RESULT_CANCELLED。使用Gmail發送電子郵件時,結果相同。StartActivityForResults始終爲Intent.ACTION_SEND返回RESULT_CANCELLED
調用共享的意圖,ACTION_SEND
與startActivityForResult
總是返回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代碼
@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();
}
}
}
我也這麼認爲,但我認爲問題在於電子郵件應用程序(Gmail)需要提供結果,然後需要將結果轉發給Chooser,然後需要將它傳遞給您的應用程序。我認爲谷歌沒有考慮將價值傳遞給客戶。 – RelativeGames