Um plugin Flutter derivado do telephony para usar recursos de telefonia, como buscar informações da rede, iniciar chamadas telefônicas, enviar e receber SMS, e corrigido para escutar SMS recebidos.
Orientação gerada a partir de informações públicas. Apenas para referência.
Another Telephony é um plugin Flutter derivado do pacote original telephony, projetado para permitir que aplicativos Android acessem recursos de telefonia. Ele permite que desenvolvedores obtenham informações de rede, iniciem chamadas telefônicas, enviem e recebam mensagens SMS e escutem mensagens SMS entrantes. O pacote inclui correções para detecção confiável de SMS entrantes, tornando-o adequado para aplicações que exigem interação em tempo real com SMS. Desenvolvido especificamente para Android, oferece uma interface simples para integrar funcionalidades centrais de telefonia em aplicativos Flutter.
Casos de uso
Sistemas de verificação por SMS
Início de chamadas dentro dos aplicativos
Monitoramento em tempo real de SMS recebidos
Rastreamento de status da rede
autenticação de dois fatores
Gerenciamento automático de mensagens
Principais recursos
Suporte para envio e recebimento de SMS
Habilita a iniciação de chamadas telefônicas
Busca informações de rede
Corrigido ouvinte de SMS recebidos
Suporte de plataforma exclusivo para Android
Integração de API simples
Indicado para
Desenvolvedores construindo autenticação baseada em SMS
Aplicativos que precisam de processamento automatizado de SMS
Aplicativos móveis que exigem acesso à telefonia
Projetos Flutter voltados para Android
Aplicações com necessidades de mensagens em tempo real
Considerações
Limitado à plataforma Android
Requer permissões em tempo de execução para SMS e chamadas
O monitoramento de SMS recebidos pode afetar a bateria
Depende dos serviços de telefonia específicos do dispositivo
Não compatível com iOS
Pode exigir configuração adicional para execução em segundo plano
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
Telephony
We create this fork because the original package is not maintained anymore. We will try to keep this package up to date with the latest Flutter version.
:exclamation: This plugin currently only works on Android Platform
Contribute or meet a problem
Please create pull-request/issue in the original package, i will check and fix it as soon as possible.
Happy to contribute this project together :heart:
From VietNam (with Paracel & Spratly Islands) contributor
Contact me for [instantly support](mailto:dangtrongthanh1998@gmail.com)
A Flutter plugin to use telephony features such as
Send SMS Messages
Query SMS Messages
Listen for incoming SMS
Retrieve various network parameters
Start phone calls
This plugin tries to replicate some of the functionality provided by Android's Telephony class.
Check the Features section to see the list of implemented and missing features.
Although this plugin will check and ask for permissions at runtime, it is advisable to manually ask for permissions before calling any other functions.
The plugin will only request those permission that are listed in the AndroidManifest.xml.
SMS can either be sent directly or via the default SMS app.
Send SMS directly from your app:
telephony.sendSms(
to: "1234567890",
message: "May the force be with you!"
);
If you want to listen to the status of the message being sent, provide SmsSendStatusListener to the sendSms function.
finalSmsSendStatusListener listener = (SendStatus status) {
// Handle the status
};
telephony.sendSms(
to: "1234567890",
message: "May the force be with you!",
statusListener: listener
);
If the body of the message is longer than the standard SMS length limit of 160 characters, you can send a multipart SMS by setting the isMultipart flag.
Send SMS via the default SMS app:
telephony.sendSmsByDefaultApp(to: "1234567890", message: "May the force be with you!");
As of the 1.12 release of Flutter, plugins are automatically registered. This will allow you to use plugins as you normally do even in the background execution context.
Fetch various metrics such as network type, sim state, etc.
// Check if a device is capable of sending SMSbool canSendSms = await telephony.isSmsCapable;
// Get sim stateSimState simState = await telephony.simState;
If you want to call the telephony methods in background, you can do in the following ways.
1. Using only Telephony.instance
If you want to continue using Telephony.instance in the background, you will need to make sure that once the app comes back to the front, it again calls Telephony.instance.
@pragma('vm:entry-point')
backgroundMessageHandler(SmsMessage message) async {
// Handle background messageTelephony.instance.sendSms(to: "123456789", message: "Message from background")
}
voidmain() {
runApp(MyApp());
}
class_MyAppStateextendsState<MyApp> {
String _message;
// This will not work as the instance will be replaced by// the one in background.final telephony = Telephony.instance;
@overridevoidinitState() {
super.initState();
// You should make sure call to instance is made every time // app comes to foregroundfinal inbox = Telephony.instance.getInboxSms()
}
2. Use backgroundInstance
If you cannot make sure that the call to instance would be made every time app comes to foreground, or if you would prefer to maintain a separate background instance,
you can use Telephony.backgroundInstance in the background execution context.