简体   繁体   English

自定义Android电话应用程序

[英]Custom Android Telephony application

I assume this is the proper forum , not android.stackechange since it is software related. 我认为这是正确的论坛,而不是android.stackechange,因为它与软件有关。

I am a novice Java developer and need to create a custom Android telephony application with the following functionality 我是新手Java开发人员,需要创建具有以下功能的自定义Android电话应用程序

  • launches automatically when device starts , boots 设备启动,启动时自动启动
  • launches in kiosk mode, no notifications, or access to other applications! 以自助服务终端模式启动,无通知或访问其他应用程序!
  • has a single 'call' button which places a phone call to a hardwired phone number. 有一个“呼叫”按钮,可以拨打有线电话号码。
  • has the ability to communicate 1 way simple data to external device(think arduino) via bluetooth. 能够通过蓝牙将1路简单数据传送到外部设备(想想arduino)。 ie when call received signal to arduino to flash lights, etc 即当呼叫接收信号到arduino到闪光灯等
  • optional display for either hardcoded message or number received. 硬编码消息或接收号码的可选显示。

Should I make use of a single Activity class? 我应该使用一个Activity类吗?
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? 为了正确测试传入和传出呼叫,我是否需要首先部署到具有初始化(带有电话号码)SIM的实际设备?

Are there any Android projects on Github or elsewhere that have parts of this functionality I might study and learn from? 在Github或其他地方是否有任何Android项目可以学习和学习这些功能的一部分?

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.For automatically launching it when device starts you can use following code- 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.For launching it in kiosk mode- 2.以自助终端模式启动 -

Is it possible to create an android app to make the phone run in sort of a kiosk mode? 是否有可能创建一个Android应用程序,使手机以某种自助服务终端模式运行?

3.For making phone calls- 3.打电话 -

How To Make A Simple Phone Call Application 如何制作一个简单的电话应用程序

How to make a phone call from your application 如何从您的应用程序拨打电话

4.For bluetooth option- 4.对于蓝牙选项 -

Android Bluetooth sample app Android蓝牙示例应用

As I can see you are trying to unite several existing apps in one ) 我可以看到你试图将几个现有的应用程序合二为一)

launches automatically when device starts , boots 设备启动,启动时自动启动

launches in kiosk mode, no notifications, or access to other applications! 以自助服务终端模式启动,无通知或访问其他应用程序!

this two you can borrow from parental control apps like Kids Space launcher 这两个你可以从家长控制应用程序借用,如儿童太空发射器

1) I do not know examples on github but fisrt of all you make your application main launcher of device after this it will launches automatically when device starts , boots 1)我不知道github上的例子,但是你所做的应用程序主要启动器的所有内容都会在设备启动后自动启动,启动

2) 2)

for in kiosk mode 用于信息亭模式

try to google how to kill onother application (probably it will be your service that running all time and checks the system for unwanted applications have been launched and trying to kill them) 尝试google如何杀死另一个应用程序(可能是你的服务一直运行并检查系统是否已启动不需要的应用程序并试图杀死它们)

3) 3)

has a single 'call' button which places a phone call to a hardwired phone number. 有一个“呼叫”按钮,可以拨打有线电话号码。

Yes just do it your launcher application as single Activity with one functionality - Dailer. 是的,只需将您的启动器应用程序作为具有一个功能的单个活动 - Dailer。 There a lot of dailer example in internet. 互联网上有很多dailer的例子。 For example this one https://github.com/mirontoli/android-dialer ; 例如,这一个https://github.com/mirontoli/android-dialer ;

... ...

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? 为了正确测试传入和传出呼叫,我是否需要首先部署到具有初始化(带有电话号码)SIM的实际设备?

Yes the better way for test is real devices. 是的,更好的测试方法是真实设备。

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

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