android-broadcast

How to pass value from activity to broadcastreceiver?

China☆狼群 提交于 2019-12-12 01:08:27
问题 I am developing one application using broadcastreceiver i have problem with receive value in broadcast receiver from activity,please tell me how to send value from activity to broadcast receiver and how to receive value in broadcast receiver from activity ,i am trying like below code but its not working my code in activity side Intent intent = new Intent("my.action.string"); //intent.setAction("IncomCallBroadCast"); intent.putExtra("contact",phNo); sendBroadcast(intent); in broadcastreceiver

Update active Activity UI with BroadcastReceiver

白昼怎懂夜的黑 提交于 2019-12-12 00:59:56
问题 I have implemented recurring alarms using the following example However, once an alarm "goes off"/is recieved I want to update my ListView in the active Activity. I only have one activity with a ListView . How do I execute my update UI method in the main activity class once an alarm is received? How do you call this from onReceive() in the AlarmReceiver ( extends BroadcastReceiver ) class 回答1: The easiest way is to make your AlarmReceiver an inner class of your activity. This way it will have

Android CheckboxPreference doesn't work with Broadcast Reciever

六眼飞鱼酱① 提交于 2019-12-12 00:42:32
问题 I'm trying to disable Wifi when not connect to any network after a min. But getting some problems. When i run the app. It start working and try to disable wifi that's not connect to any network. It's mean I can't stop it. I have a Preference Activity with CheckBoxPreference . It's the setting to turn on/off this feature. I want to only work when user checked the checkbox. If uncheck, stop working. But right now, It's working anytime out of control. CheckBox is doesn't work for turn on/off

Android Widget Update service, multiple onclick listeners

♀尐吖头ヾ 提交于 2019-12-11 21:05:58
问题 I have the following widget service which updates a text view when I click on my one button. UpdateWidgetService: ipublic class UpdateWidgetService extends Service { private static final String LOG = "widgetService"; private static final String MyOnClick1 = "myOnClickTag1"; private static final String MyOnClick2 = "myOnClickTag2"; private static final String MyOnClick3 = "myOnClickTag3"; static LocationClient mLocationClient; @Override public void onStart(Intent intent, int startId) { Log.i

onReceive() method not opening application while device is in sleep mode..?

房东的猫 提交于 2019-12-11 18:56:10
问题 Hi friends i have a problem... Actually i use this code to open my application in certain time..the app is working fine but when the device is in sleep mode not working..?? public class MyBroadCastReceiver extends BroadcastReceiver { @Override public void onReceive(Context ctx, Intent intent) { Intent intent = new Intent(ctx, ActivityMain.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); ctx.startActivity(intent); } } ActivityMain.java

Broadcast not received from Chrome Custom Tab menu item click

為{幸葍}努か 提交于 2019-12-11 14:44:18
问题 I am doing the following within a Fragment (condensed for convenience): intentBuilder = new CustomTabsIntent.Builder(); String label = "Test"; PendingIntent pendingIntent = createPendingIntent(ActionBroadcastReceiver.ACTION_TEST); intentBuilder.addMenuItem(label, pendingIntent); CustomTabActivityHelper.openCustomTab( getActivity(), intentBuilder.build(), mUri, null); private PendingIntent createPendingIntent(int actionSourceId) { Intent actionIntent = new Intent(getActivity()

Android Date Changed Broadcast Receiver

混江龙づ霸主 提交于 2019-12-11 13:25:16
问题 I have a broadcast receiver that receives event when user manually changes Date . But I am unable to find what was the previous date he changed. Example- If date was 5-June-2014 and he changed it to 01-June-2014. I want to know the previous date that is 5-june-2014. Please help 回答1: You could register ACTION_TIME_TICK and record the current date every minute. 回答2: The intent to specify Date Changed is android.intent.action.DATE_CHANGED Set a listener to this intent by referring tutorial http:

Kitkat Behaviour: SMS Broadcast Receiver not working after fresh installation and if app is not launched

妖精的绣舞 提交于 2019-12-11 12:41:50
问题 I have an Android app that listens to SMS messages. This is in the manifest: <receiver android:name=".SMSListner" > <intent-filter> <action android:name="android.provider.Telephony.SMS_RECEIVED" /> </intent-filter> </receiver> The broadcast receivers works fine if the app is installed and opened(For all android versions). In case, below kitkat version, if app is install and is not open, still it receives the SMS in OnRecieve method In case of KitKat, it is not working till the time

Android Sip incoming Call using Service with Broadcast Receiver

 ̄綄美尐妖づ 提交于 2019-12-11 12:22:36
问题 Hai Every one Actually am trying to create an application which supports for making a audio call over the internet with SIP based,here am using native sip,and i was facing the problem with the incoming call,i have done the registration part with service,but while doing the incoming call i can not able to answer the call kindly please help me Service file package example.com.myapplication; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent

android.net.conn.CONNECTIVITY_CHANGE broadcast receiver not fires in JellyBean for VPN connection and disconnection

大城市里の小女人 提交于 2019-12-11 10:49:41
问题 This is manifest part <receiver android:name="my.com.app.ConnectivityModifiedReceiver" android:label="NetworkConnection" > <intent-filter> <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> </intent-filter> </receiver> This is java code public class my.com.app.ConnectivityModifiedReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { context.sendBroadcast(new Intent("ConnectivityModified")); } } The ConnectivityModifiedReceiver will