0
我試過這麼多的解決方案,但仍然沒有成功發送消息到特定的WhatsApp聯繫人在我的應用程序。這裏是我的代碼:通過WhatsApp在特定的聯繫人發送消息android
Intent sendIntent = new Intent("android.intent.action.MAIN");
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(Intent.EXTRA_TEXT, "Hey");
sendIntent.putExtra("jid", PhoneNumberUtils.stripSeparators(smsNumber) + "@s.whatsapp.net");
sendIntent.setPackage("com.whatsapp");
mContext.startActivity(sendIntent);
它只是打開特定聯繫人的聊天窗口,新的對話與沒有接觸名稱,個人檔案相片和舊的轉換。
請幫我解決這個問題。還附上截圖。
可讀性註釋:'whatsappInstalledOrNot()'應該更正確地命名'isWhatsappInstalled' –
感謝您的建議。 –
@Amrish Kakadiya我嘗試過,發現它的唯一接受號碼與國家代碼也需要時間來搜索whatsapp聯繫人列表中的特定聯繫人。 –