我可以在 Android 中实现自动呼叫某人吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10378866/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I implement automatic call to someone in Android?
提问by OnkarDhane
I want to implement an automatic call from my android phone. If I set message for a particular number and date as well, then my android phone should call that number automatically. Is it possible without any user interaction to call on any number via my android phone?
我想从我的 android 手机实现自动呼叫。如果我还为特定号码和日期设置了消息,那么我的 android 手机应该会自动拨打该号码。是否可以在没有任何用户交互的情况下通过我的 android 手机拨打任何号码?
回答by nithinreddy
Yes it is possible. The code for call is straight forward.
对的,这是可能的。调用代码很简单。
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:09999"));
startActivity(intent);
Use your number in place of 09999
.
Don't forget to specify the permission to call in Android Manifest.xml
使用您的号码代替09999
。别忘了在Android Manifest.xml中指定调用权限
回答by Lalit Poptani
Create an Alarm
that will be fired at a particular time and add the code to call any particular number. Hereis how you can set the AlarmManager
to fire at a particular time. Then you can just call Intent.ACTION_CALL
when your Alarm is fired.
创建一个Alarm
将在特定时间触发并添加代码以呼叫任何特定号码。以下是如何将 设置AlarmManager
为在特定时间触发。然后你可以Intent.ACTION_CALL
在你的闹钟被触发时打电话。
回答by Yusuf X
Yes you can, with Intent.ACTION_CALL.
是的,你可以,使用Intent.ACTION_CALL。