1

i want direct sent message to phone number with viber , this code not work any one can help

Intent smsIntent = new Intent(Intent.ACTION_SENDTO);
            smsIntent.addCategory(Intent.CATEGORY_DEFAULT);
            smsIntent.setPackage("com.viber.voip");
            smsIntent.setData(Uri.parse("sms:+1001002003"));
            smsIntent.putExtra("address", "+1001002003");
            smsIntent.putExtra("sms_body", "body  text");
            startActivity(smsIntent);
4

1 回答 1

0

你可以使用这个方法

public void sendToViber(String messageBody, String viberContact) {
        Uri uri = Uri.parse("smsto:" + viberContact);
        Intent viberIntent = new Intent(Intent.ACTION_SENDTO, uri);
        viberIntent.setPackage("com.viber.voip");
        startActivity(Intent.createChooser(viberIntent, "Share"));
    }
于 2017-01-10T09:28:43.740 回答