问题描述
我认为这是合适的论坛,而不是android.stackechange,因为它与软件有关.
I assume this is the proper forum , not android.stackechange since it is software related.
我是Java新手开发人员,需要创建具有以下功能的自定义Android电话应用程序
I am a novice Java developer and need to create a custom Android telephony application with the following functionality
- 设备启动时自动启动,启动
- 以信息亭模式启动,没有任何通知,或无法访问其他应用程序!
- 只有一个通话"按钮,可以将电话拨打到有线电话号码.
- 具有通过蓝牙与外部设备(如arduino)进行1路简单数据通信的能力.即当呼叫收到信号到arduino的闪光灯等时
- 可选显示的硬编码消息或收到的号码.
我应该使用单个Activity类吗?
我还应该创建或使用其他哪些类?
为了正确测试呼入和呼出电话,我是否需要先部署到带有初始化(带有电话号码)SIM卡的实际设备上?
Should I make use of a single Activity class?
What other classes should I create or make use of?
In order to properly test both incoming and outgoing calls do I need to first deploy to an actual device with an initialized(with phone number) SIM?
在Github上或其他地方是否有任何我可以学习和学习的部分Android功能项目?
Are there any Android projects on Github or elsewhere that have parts of this functionality I might study and learn from?
还有其他体系结构提示或建议吗?
Any other architecture tips or suggestions?
推荐答案
是的,您可以创建单个活动类.但是,由于要添加一些功能,因此最好创建几个活动类.与仅一种大型活动类相比,它易于检查和管理较小的活动类.并且类的数量取决于功能.如果为一个函数创建一个类,则很好.
Yes you can make single activity class. But as you want to add few functions so its better to create few activity classes. As its easy to check and manage smaller activity classes as compare to only one large activity class. And the number of classes depend upon functions. Its good if you create one class for one function.
1.要在设备启动时自动启动它,可以使用以下代码-
public class YourReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Intent intent = new Intent(context, YourActivity.class);
context.startActivity(intent);
}
}
并将以下代码添加到清单文件中-
And add following code to your manifest file-
<receiver
android-permission="android.permission.RECEIVE_BOOT_COMPLETED"
android:name="YourReceiver" >
<intent-filter >
<action android:name="android.intent.action.SCREEN_ON" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
2.用于以信息亭模式启动它-
3.用于拨打电话-
4.对于蓝牙选项-
这篇关于自定义Android电话应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!