Data call android app

Мониторинг сообщений и звонков в Android

На разрабатываемом мною проекте под Android возникла необходимость мониторинга входящих и исходящих звонков и сообщений. Полез читать документацию и подручные книги и к сожалению понял, что задача не совсем из тривиальных, так как каждая часть одной проблемы требует различного подхода к реализации. Вообще заметил, что многие книги или же статьи всегда стараются подавать более легкие примеры, например обработка входящего сообщения, а вот про исходящее ни слова если реализация более сложна. Возможно это мое предубеждение, но уже не первый раз обращаю на это внимание
Решил собрать все воедино и поделиться с теми, кто возможно будет набивать себе оскомину пытаясь найти решение данной проблемы. На оптимальность не претендую, так как сам учусь

Мониторинг входящих сообщений

Наверное реализация этой части самая простая и легкая. В манифесте приложения даем разрешение на обработку получения сообщения

И регистрируем Receiver, который будет срабатывать по событию входящего сообщения

Как видно из примера кода, при получении сообщения управление будет передаваться Receiver-у MessageReceiver.

Мониторинг исходящих сообщений

К сожалению с исходящими сообщениями не так просто как со входящими. Telephony API не предоставляет отдельного события исходящего сообщения. Для меня это выглядит весьма странным в довольно отточенном продукте, которым является Android. Тем не менее решение все-таки есть.

В манифесте приложения даем разрешение на чтение сообщений

А далее следует создать и зарегистрировать обработчик изменения базы сообщений. Вприцнипе тут можно объеденить обработку входящих и исходящих сообщений, но как-то со входящими сообщениями все намного проще. При обработке исходящих сообщений следует учесть тот факт, что обработчик может быть вызван несколько раз при отправке одного и того-же сообщения. Рекомендуется создать таблицу хешей всех сообщений проверять нету ли обрабатываемого сообщения в базе. В коде ниже показана примитивная проверка по идентификатору сообщения

Мониторинг звонков

Android предоставляет возможность мониторить состояние телефона посредством действия android.intent.action.PHONE_STATE, но у меня снова таки возникла проблема получения номера абонента при исходящем звонке, поэтому мне пришлось регистрировать ресивер для двух действий.

В манифесте приложения даем разрешение на чтение состояния телефона и обработки исходящих звонков.

И регистрируем Receiver, который будет срабатывать по событию входящего сообщения

Резюмируя проблемы, которые я описал в самом начале, снова таки скажу, что меня не покидало ощущение некоторой недоделанности Android API. Входящее сообщение весьма легко перехватывается, что не скажешь о исходящем. Тоже самое касается и звонков. Конечно можно использовать одно решение и для сообщений, но если для входящих так просто, то почему нету такой простоты для исходящих?

Источник

10 best free calls apps for Android

We don’t really differentiate between physical phone calls with numbers or VoIP calls because they ultimately serve the same function, but we did include both types of apps on the list. We do recommend VoIP over physical calls, though, because Internet is available basically everywhere and it’s a lot easier. Here are the best free calls apps for Android! You can also click here to check out the best free call apps and sites for PC, Mac, Linux, and iOS!

Read more:

Dingtone

Price: Free with in-app purchases

Dingtone is one of many free call apps on Google Play. However, this one seems to strike a good balance. It gives you a dedicated phone number in your local area code if you want. Additionally, it can call phones in over 200 countries. You can make unlimited calls over data as long as your friends and family also use Dingtone. You can make calls to real phone numbers with a credit system, hence the in-app purchases. You can add free credits through various promotions and adverts. Thus, it’s not 100% free in terms of time, but at least you don’t have to spend money if you don’t want to.

Читайте также:  Список всех смартфонов android one

Facebook Messenger

Price: Free

Facebook apps are generally pretty average. They’re clunky, slow, and eat up quite a bit of battery. However, virtually everybody uses Facebook. That makes it a pretty decent option. Facebook Messenger is Facebook’s standalone messaging app. It features free messaging, free calls, and free video chats. The app even has some games to play. The only thing you’ll need is to be friends on Facebook with somebody and you’re good to go, although in some cases even that’s not necessary. It’s a good app to try because it’s easier to convince people to use Facebook than it is to switch to something different.

Google Duo

Price: Free

Google Duo is a video chatting app. It’s also one of the easier free calls apps to use. You simply download it, open it, put in your phone number, and you can start making free video calls. The only downside is that the other person will also have to be using Google Duo. However, the good news is that Google Duo is free and multi-platform. That means it works on iOS and Android at least. It only does video calls, but they’re of good quality and you can make as many of them as you want. A recent update lets people make only voice calls if needed.

GrooVeIP

Price: Free / $6.99 / Varies

GrooVeIP is a good app for free calls. It’ll give you an actual US phone number that you can actually give to people. The service itself supports both calls and texts. The free part is a little iffy, though. You can earn credits for free. However, you’ll have to complete offers and watch ad videos in order to do so. It’s a little tedious, but it definitely works. Of course, they have the option to purchase credits as well. The service will give you free credits to use monthly. Thus it is a great app for limited free calls. The app seems to be either good or annoying from update to update. However, free is free so we won’t complain too much.

Skype

Price: Free / Varies

Skype is one of the most popular free calls apps out there. Its hallmark feature is the ability to be used on mobile phones, computers, tablets, and most other computing devices. You can send text messages, voice calls, and video calls for free to other people who use Skype. You will have to pay for credits to use if you want to call actual phone numbers. However, we do appreciate the option to call actual phone numbers from the service. Of course, you can call other Skype members for free and you can chat with multiple people in a single voice call.

See more:

Signal Private Messenger

Price: Free

Signal Private Messenger is an increasingly popular service that focuses on security. It’s open source and it encrypts everything it sends. That includes voice calls, text messages, and everything between. It offers free calls and texts, although other people will have to be using Signal Private Messenger as well. Everything is completely free, at least for now. It’s definitely the go-to option for those who want free calls but are also concerned about security. Please note, it’s only fully secure if both parties are using Signal Private Messenger.

Slack

Price: Free / $6.67-$12.50 per member per month

We’re reaching a little bit with Slack. However, it does actually make free calls to other people who use Slack. It’s an increasingly popular chat service that’s aimed at businesses both big and small. You’ll be able to create text channels, message people individually, and it comes with integration with a ton of other apps. It’s also cross-platform and calls are easy enough to make. They may be a bit fuzzy if you’re talking to people on the other side of the world, though. For now, Slack is entirely free for almost everybody.

Читайте также:  Тв для андроид с открытыми каналами

TextNow

Price: Free with in-app purchases

TextNow is an app that offers free texting and free calls. You’ll get your own dedicated phone number that you can actually give to other people. You can call people in the US and Canada free of charge. However, you’ll have to pay in order to call International numbers. That’s not great if you live outside of the US, but this is exactly what you’re looking for if you do live there. The entire thing is funded by advertising. Signing up for a plan removes those. This is the best app to make free calls right now.

Viber

Price: Free with in-app purchases

Viber started life as a basic VoIP service. It has since expanded into a full-blown service that offers text chats, voice chats, and even video chats. You can call anyone else who uses Viber free of charge. Like Skype, there’s a small fee if you want to call phone numbers for people who don’t use Viber. It also comes with a ton of other features. Some of them, like hidden messaging, can be useful. However, many of them are goofy little things like stickers that don’t really matter too much. Viber to Viber calls, texts, and video chats are completely free. You can also buy stickers and some customization options with in-app purchases, but those are entirely optional.

WhatsApp

Price: Free

Last up is the venerable WhatsApp. It started out as a text-only platform but has slowly evolved to include free calls and free video chats. Like most, you can only use the free calls feature if you’re connecting with another person who uses WhatsApp. Since it’s one of the most popular chat apps in existence, it shouldn’t be too bad to get other people on it. It’s huge, its powerful, and it works really well. It also has a variety of other features that help make the experience that much better.

Thank you for reading! Try these out too:

If we missed any great free calls apps, tell us about them in the comments! You can also click here to check out our latest Android app and game lists.

Источник

Sample VoIP Calling App in Android

This article describes the designing & implementation of a sample VoIP calling app using CometChat Pro. CometChat Pro is Messaging & Call SDK that provides enormous features for developers to integrate chat. Using CometChat Pro UI Kit, developers can easily integrate real-time messaging & calling support in their app. By the end of this article, you will create a fully functioning Sample VoIP Calling App.

Key Components & Libraries Used

CometChat Android UI Kit — An ready to use UI Kit library which will help us to develop real-time messaging & call support in our sample app within a few minutes.

Firebase — To receive an event when the app is not in the foreground we will use Firebase Push Notification.

ConnectionService — An abstract class that will help you to build VoIP Calls in a sample app. It uses a built-in System UI to manage a call which is also called System Managed. If you wish to use your own UI to manage calls you can use Self-Managed Service.

Читайте также:  Когда будет обновление андроид для планшета самсунг

Prerequisites

Before diving into more details please ensure that you have checked the below points.
— Android studio installed in your system.
— Android Device or Emulator to run your app.

    We will begin by fetching the code from GitHub.

You can clone the project from the Sample VoIP Calling repository.

  • It’s necessary to have CometChat Account to run the app.

You can create your account in CometChat and replace the credentials with yours.

Also, please make sure to setup Push Notification Extension in CometChat.
Please click here to know How to setup Push Notification in CometChat.

  • Next step is to setup Firebase Account and create a new project. Once the project is created, setup an Android App in the Firebase Project and add google-services.jsonfile in your “ app” folder
  • Once the above mentioned configurations are done you can open the project in Android Studio. You will find the project contains two packages ‘ app’ which is our sample app and ‘ uiKit’ is a library provided by CometChat.
  • In ‘ app’ you will find the ‘ utils’ package under which we have files to handle Push Notification and VoIP calls.

PushNotificationService

It extends FirebaseMessageService which is used to handle Push Notification received from Firebase. We are using it to notify the message sent to a user when they are not active. We are also handling incoming & outgoing calls through it.

onMessageReceived() : This method gets triggered whenever you receive a push notification from firebase.

CometChatHelper.processMessage() : This method is provided by CometChat SDK to get BaseMessage from “ data” received as JSON Object in Remote Message.

initiateCallService(call : Call) : This method is used to initiate a call through ConnectionService whenever a Call type message is received.

showMessageNotification(baseMessage: BaseMessage, title: String, alert: String) : This method is used to display and handle the notification for the message when is being received by the particular user.

CallConnectionService

CallConnectionService is custom connectionservice class which is binded with the app to handle incoming & outgoing calls. You will find onCreateIncomingConnection(), onCreateOutgoingConnection() methods in it.

onCreateIncomingConnection() : This method get triggered whenever telecomManager.addNewIncomingCall() get success on receiving a call.

onCreateIncomingConnectionFailed() : This method get triggered whenever telecomManager.addNewIncomingCall() fails to receive a call.

onCreateOutgoingConnection() : This method get triggered whenever telecomManager.placeCall() get successfully executed to place outgoing call.

onCreateOutgoingConnectionFailed() : This method get triggered whenever telecomManager.placeCall() get failed to place an outgoing call.

Currently, we are using CALL_PROVIDER as Capability of ConnectionService. So you can see your system’s native calling UI for incoming & outgoing calls.
You can change it SELF_MANAGED if you wan’t to show your own custom UI for incoming & outgoing calls.

CallConnection

It is a Connection class that is used to initiate a connection when a user receives an incoming or outgoing call. It usually helps the ConnectionService class to handle the connection requests and their callbacks. It includes certain methods like onAnswer(), onReject(), onHold(), onDestroy(),etc. Whenever the user receives an incoming call and if the user accepts the call then onAnswer() will be triggered. Similarly, if user rejects the call then onReject() is triggered.

onAnswer() : Whenever this method gets triggered, we use CometChat.acceptCall() which will start the CometChat Call Service and start the call session.

onReject() : Whenever this method gets triggered, we use CometChat.rejectCall() which will reject the CometChat Call Service and end the call session.

onDisconnect() : This method gets triggered whenever the initiator of a call ends the calls before the receiver accepts the call. This will ends the call session and make it a Missed Call.

CallHandler

It is a class that is used to handle and integrate ConnectionService in your app. Below are its methods that are used in your app.

Источник

Оцените статью