草庐IT

BroadCastReceiver

全部标签

android - 如何通过 PendingIntent 发送数据到广播?

我正在尝试通过PendingIntent发送一些额外的数据,例如:MyMessagemessage;//...Intentintent;SmsManagersms=SmsManager.getDefault();intent=newIntent(Constants.SENT_PLAIN);intent.putExtra(Constants.EXTRA_RAW_ID,message.getId());//puttinglongid(not-1L)PendingIntentsentPI=PendingIntent.getBroadcast(activity,0,intent,0);inte

android - 如何通过 PendingIntent 发送数据到广播?

我正在尝试通过PendingIntent发送一些额外的数据,例如:MyMessagemessage;//...Intentintent;SmsManagersms=SmsManager.getDefault();intent=newIntent(Constants.SENT_PLAIN);intent.putExtra(Constants.EXTRA_RAW_ID,message.getId());//puttinglongid(not-1L)PendingIntentsentPI=PendingIntent.getBroadcast(activity,0,intent,0);inte

Android : Check phone number present in Contact List ?(从电话中检索电话号码)

我制作了一个BroadcastReceiver来接收调用我的人的电话号码如何查看收到的电话号码是否在我的联系人列表中?您是否有提示知道此电话号码是否存在于联系人列表中而未加载联系人列表?我不想要更多信息,只要这个电话号码存在即可。如果不可能,我必须加载联系人列表,如何在BroadcastReceiver上进行?当我尝试执行getContentResolver时,它不起作用,因为我在BroadcastReceiver而不是在Activity...感谢您的帮助 最佳答案 publicbooleancontactExists(Contex

Android : Check phone number present in Contact List ?(从电话中检索电话号码)

我制作了一个BroadcastReceiver来接收调用我的人的电话号码如何查看收到的电话号码是否在我的联系人列表中?您是否有提示知道此电话号码是否存在于联系人列表中而未加载联系人列表?我不想要更多信息,只要这个电话号码存在即可。如果不可能,我必须加载联系人列表,如何在BroadcastReceiver上进行?当我尝试执行getContentResolver时,它不起作用,因为我在BroadcastReceiver而不是在Activity...感谢您的帮助 最佳答案 publicbooleancontactExists(Contex

android - 在 Android MVP 中将 BroadcastReceiver 放在哪里?

我有一个接收网络连接事件的BroadcastReceiver实现。它在AndroidManifest.xml中声明,当网络事件发生时由Android自动调用。广播接收者:publicclassConnectivityChangeReceiverextendsBroadcastReceiver{@OverridepublicvoidonReceive(Contextcontext,Intentintent){Log.v(TAG,"action:"+intent.getAction());Log.v(TAG,"component:"+intent.getComponent());}}And

android - 在 Android MVP 中将 BroadcastReceiver 放在哪里?

我有一个接收网络连接事件的BroadcastReceiver实现。它在AndroidManifest.xml中声明,当网络事件发生时由Android自动调用。广播接收者:publicclassConnectivityChangeReceiverextendsBroadcastReceiver{@OverridepublicvoidonReceive(Contextcontext,Intentintent){Log.v(TAG,"action:"+intent.getAction());Log.v(TAG,"component:"+intent.getComponent());}}And

android - 如何将 "goAsync"用于广播接收器?

背景从Honeycomb(API11)开始,Android具有允许广播接收器以异步方式运行的功能,在假定它可以终止其进程之前提供大约10秒,使用称为“goAsync”的方法:ThiscanbecalledbyanapplicationinonReceive(Context,Intent)toallowittokeepthebroadcastactiveafterreturningfromthatfunction.Thisdoesnotchangetheexpectationofbeingrelativelyresponsivetothebroadcast(finishingitwith

android - 如何将 "goAsync"用于广播接收器?

背景从Honeycomb(API11)开始,Android具有允许广播接收器以异步方式运行的功能,在假定它可以终止其进程之前提供大约10秒,使用称为“goAsync”的方法:ThiscanbecalledbyanapplicationinonReceive(Context,Intent)toallowittokeepthebroadcastactiveafterreturningfromthatfunction.Thisdoesnotchangetheexpectationofbeingrelativelyresponsivetothebroadcast(finishingitwith

android - 在广播接收器/或服务中获取 GPS 位置以广播接收器数据传输

我是安卓新手。我想在广播接收器中获取GPS位置,但它显示错误。我的代码是:publicvoidonReceive(Contextcontext,Intentintent){LocationManagerlocManager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);//errorsingetSystemServicemethodLocationListenerlocListener=newMyLocationListener();locManager.requestLocationUpdates(Locati

android - 在广播接收器/或服务中获取 GPS 位置以广播接收器数据传输

我是安卓新手。我想在广播接收器中获取GPS位置,但它显示错误。我的代码是:publicvoidonReceive(Contextcontext,Intentintent){LocationManagerlocManager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);//errorsingetSystemServicemethodLocationListenerlocListener=newMyLocationListener();locManager.requestLocationUpdates(Locati