简体   繁体   English

启动其他短信应用,以编程方式发送短信,而无需打开它

[英]Launch a different sms app to send sms programmatically without opening it

This below approach opens the app but doesn't do anything. 这种以下方法可打开应用程序,但不执行任何操作。

button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String phoneNumber = "phone number here";
            String text = "Hi belated happy diwali";


            Intent smsIntent = getPackageManager().getLaunchIntentForPackage("sun.way2sms.hyd.com");
            smsIntent.setType("vnd.android-dir/mms-sms");
            smsIntent.putExtra("address", phoneNumber);
            smsIntent.putExtra("sms_body", text);
            startActivity(smsIntent);
        }
    });

As per my knowledge, like default SMS Manager you can't send message directly with other apps....like way2sms / whatsapp. 据我所知,像默认的SMS Manager一样,您不能直接与其他应用发送消息。...如way2sms / whatsapp。 If and only if they are providing there SDK and with that option. 当且仅当他们提供SDK并带有该选项时。

Do you know the 'key' -> "address" and "sms_body" are using by way2sms app to receive your data!!!! 您知道'key'->“ address”和“ sms_body”通过way2sms应用程序使用来接收您的数据!!!

For Eg: Facebook you can post directly with ur app by using some user permissions. 例如:Facebook,您可以使用某些用户权限直接在ur应用中发布。

If you are using a third party app the best you can do is launch the third party app with the data pre filled just like the native app. 如果您使用的是第三方应用程序,则最好的办法是启动第三方应用程序,该程序具有与本机应用程序一样预先填充的数据。

If the third party app provides any support for sending sms in the background (like a broadcast or something) then you can do it. 如果第三方应用程序提供了在后台发送短信的任何支持(例如广播等),则可以做到。 Although the chances of any app having such functionality is low 尽管任何具有此类功能的应用程序的机会均很小

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM