草庐IT

broadcastReceiver

全部标签

java - 致命异常 : android. app.RemoteServiceException : can't deliver broadcast at android. os.Handler.dispatchMessage

我在我的android应用程序上使用广播消息(从io.socket我将广播消息发送到我的Activity页面)。在三星SM-G950F和SM-A520F的某些设备上出现错误“FatalException:android.app.RemoteServiceException:can'tdeliverbroadcast”。我在Fabriccrashlytics上遇到了这个错误,我也无法重现这个问题。这是我从Fabric获得的日志,FatalException:android.app.RemoteServiceException:can'tdeliverbroadcastatandroid.

java - 致命异常 : android. app.RemoteServiceException : can't deliver broadcast at android. os.Handler.dispatchMessage

我在我的android应用程序上使用广播消息(从io.socket我将广播消息发送到我的Activity页面)。在三星SM-G950F和SM-A520F的某些设备上出现错误“FatalException:android.app.RemoteServiceException:can'tdeliverbroadcast”。我在Fabriccrashlytics上遇到了这个错误,我也无法重现这个问题。这是我从Fabric获得的日志,FatalException:android.app.RemoteServiceException:can'tdeliverbroadcastatandroid.

从服务到 Activity 的 Android 广播

我正在尝试将广播从服务发送到Activity。我可以验证广播是从服务内部发送的,但Activity没有接收到任何内容。这里是相关的服务代码:Intenti=newIntent(NEW_MESSAGE);i.putExtra(FriendInfo.USERNAME,StringUtils.parseBareAddress(message.getFrom()));i.putExtra(FriendInfo.MESSAGE,message.getBody());i.putExtra("who","1");sendBroadcast(i);以及Activity类中的接收端:publicclas

从服务到 Activity 的 Android 广播

我正在尝试将广播从服务发送到Activity。我可以验证广播是从服务内部发送的,但Activity没有接收到任何内容。这里是相关的服务代码:Intenti=newIntent(NEW_MESSAGE);i.putExtra(FriendInfo.USERNAME,StringUtils.parseBareAddress(message.getFrom()));i.putExtra(FriendInfo.MESSAGE,message.getBody());i.putExtra("who","1");sendBroadcast(i);以及Activity类中的接收端:publicclas

Android:检测 GPS 何时打开/关闭(或当没有应用程序不再使用它时)

我使用的是Android2.3.7,我正在尝试编写一个BroadcastReceiver,它会在用户打开/关闭GPS时被调用(即:通过点击选项中的“使用GPS卫星”。到目前为止,我所做的是:1)创建了以下广播接收器:publicclassGPSStatusBroadcastReceiverextendsBroadcastReceiver{@OverridepublicvoidonReceive(Contextarg0,Intentarg1){Toast.makeText(arg0,"Broadcastreceived!",Toast.LENGTH_SHORT).show();}}2)将

Android:检测 GPS 何时打开/关闭(或当没有应用程序不再使用它时)

我使用的是Android2.3.7,我正在尝试编写一个BroadcastReceiver,它会在用户打开/关闭GPS时被调用(即:通过点击选项中的“使用GPS卫星”。到目前为止,我所做的是:1)创建了以下广播接收器:publicclassGPSStatusBroadcastReceiverextendsBroadcastReceiver{@OverridepublicvoidonReceive(Contextarg0,Intentarg1){Toast.makeText(arg0,"Broadcastreceived!",Toast.LENGTH_SHORT).show();}}2)将

android - 以编程方式使用 Sim1 或 Sim2 发送短信的选项

我有一部带有2张SIM卡的Android手机,我想使用Sim1或Sim2发送短信。默认情况下,消息是从sim1发送的。但我想从sim2发送短信。是否可以设置使用Sim1或Sim2发送短信?如果有使用Sim1或Sim2发送短信的设置选项,那就太好了。这对于双SIM卡Android手机很有用。我创建了短信应用程序android我已经能够顺利地短信应用程序,但默认短信由SIM1发送。但我想通过设置通过sim1或sim2发送短信以编程方式发送短信? 最佳答案 如果您可以将此代码用于API级别22+。privatevoidsendDirect

android - 以编程方式使用 Sim1 或 Sim2 发送短信的选项

我有一部带有2张SIM卡的Android手机,我想使用Sim1或Sim2发送短信。默认情况下,消息是从sim1发送的。但我想从sim2发送短信。是否可以设置使用Sim1或Sim2发送短信?如果有使用Sim1或Sim2发送短信的设置选项,那就太好了。这对于双SIM卡Android手机很有用。我创建了短信应用程序android我已经能够顺利地短信应用程序,但默认短信由SIM1发送。但我想通过设置通过sim1或sim2发送短信以编程方式发送短信? 最佳答案 如果您可以将此代码用于API级别22+。privatevoidsendDirect

android - 使用 BroadcastReceiver 创建通知

我尝试使用此代码创建通知:privatevoidsetNotificationAlarm(Contextcontext){Intentintent=newIntent(getApplicationContext(),MyNotification.class);PendingIntentpendingIntent=PendingIntent.getBroadcast(this,0,intent,PendingIntent.FLAG_CANCEL_CURRENT);AlarmManageram=(AlarmManager)getSystemService(Context.ALARM_SER

android - 使用 BroadcastReceiver 创建通知

我尝试使用此代码创建通知:privatevoidsetNotificationAlarm(Contextcontext){Intentintent=newIntent(getApplicationContext(),MyNotification.class);PendingIntentpendingIntent=PendingIntent.getBroadcast(this,0,intent,PendingIntent.FLAG_CANCEL_CURRENT);AlarmManageram=(AlarmManager)getSystemService(Context.ALARM_SER