Android Studio Chipmunk 2021.2.1-短信不会工作5/25/2022

发布于 2025-02-01 23:04:38 字数 2094 浏览 2 评论 0 原文

我一直在努力使用Android Studio Chipmunk 2021.2.1制作一个简单的SMS应用程序,但是我没有尝试接收SMS的尝试。

我能够从模拟器和设备上发送消息。虽然,我无法使用设备或模拟器的任何示例或教程的帮助中收到SMS消息。

我遵循了这些解决方案,只是发现与它们无效的东西,折旧的文件或贬低的依赖性或使用 API。

是否有一个地方 Current 如何发送SMS的示例?

我尝试过的事情

我尝试了几种不同版本的广播公司,清单和类,没有什么可以接收SMS消息的。

我在main_activity.java中做了一个方法:

public void logit(string msg){log.e(“ tag”,“ logit:”+msg);返回; }

..然后在 onReceive 类中调用该方法,以显示任何输出,例如:

logit(“ broadcastreceiver at nater a sms”);

..但是当设备或仿真器收到消息时,它不会在 onReceive 或我的自定义方法中运行代码。我不确定问题所在,我似乎无法测试是否收到了SMS意图,我的应用程序甚至看到SMS意图,我的“ LogCat”从未收到过SMS。我已经在清单文件中添加了权限,并创建了单独的.java文件以容纳自定义处理程序以供传入SMS'。但是,最终,某些版本什么都不会发生。一些版本给我一些有关使用的代码的错误。甚至GITHUB上的Google示例也无法正常工作,在修复了许多错误后,它给出了一个错误,我找不到修复的答案,“错误:软件包R不存在 setContentView(r.layout.activity_main) ;

有人可以向我展示一个可以接收SMS消息的当前工作的Android Studio(Java)'How-to'的示例吗?

谢谢

I have been working to make a simple SMS app with Android Studio Chipmunk 2021.2.1, but none of my attempts to receive SMS have worked.

I am able to send messages from the emulator and on my devices. Although, I can't receive SMS messages with help from any example or tutorial I have found, using a device or emulator.

I have followed these solutions, only to find out something with them didn't work, a depreciated include files or depreciated dependency or uses an old API.

Is there a place where current example of how to send an SMS?

Things I've tried

I have tried several different versions of broadcasters, manifests and classes, and nothing works to receive SMS messages.

I made a method in the main_activity.java:

public void logIt(String msg){ Log.e("TAG", "LogIt : "+msg); return; }

.. then call that method in the onReceive class to show any output like :

logIt("BroadcastReceiver called because of an SMS");

.. but when the device or emulator receives a message it doesn't run the code in the onReceive or my custom method. I am not sure where the problem is, I can't seem to test if an SMS intent is received, if my app even sees SMS Intents, my 'logcat' never shows an SMS was received. I have added permissions to the manifest file, and created separate .java files to house the custom handlers for incoming SMS'. But, in the end nothing happens with some of the versions. Some versions give me other errors about the code used. Even the Google example on GitHub does not work, after fixing many errors it gives, It gives an error I can't find the answer to fix, "error: package R does not exist setContentView(R.layout.activity_main);"

Could someone please show me an example of a current working Android Studio (JAVA) 'how-to' that can receive SMS messages?

Thank You

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文