broadcastreceiver

Broadcast Receiver and Internet connection

一曲冷凌霜 提交于 2019-12-18 05:21:15
问题 How do I use broadcast receiver to check if there isn't Internet connection? And after that: 1.If there is connection = do nothing 2.There isn't connection = open new activity I hope you understand what I'm asking about. Here is my webview app code: WebView mWebView; String URL = "http://url.com"; ProgressBar loadingProgressBar,loadingTitle; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

How to detected if application is closed

[亡魂溺海] 提交于 2019-12-18 05:16:10
问题 I have an app that receives from the Broadcastreceiver to fetch new data from the web(json), when my app is running while it fetches; everything runs well, when the app is closed it crashes "Your app stopped working". Even the following good to check if my app is in the foreground doesn't work. i want it so if the app is closed, not running, to call an intent to open the app for it not to crash, so how do I check if application is closed? My code; public class UpdateReceiver extends

Android NFC tag received with broadcastreceiver

别来无恙 提交于 2019-12-18 04:55:10
问题 I'm trying to catch NFC tag in broadcast receiver so I wrote a simple BR that prints "asd" in the onReceive(). In the manifest xml it's desribed like that: and I receive only this and no print at all.... 01-31 16:37:18.980: ERROR/MediaPlayer(990): setAudioStream called in state 8 01-31 16:37:18.980: ERROR/MediaPlayer(990): error (-38, 0) 01-31 16:37:18.980: ERROR/MediaPlayer(990): start called in state 0 01-31 16:37:18.980: ERROR/MediaPlayer(990): error (-38, 0) 01-31 16:37:18.988: ERROR

Android Application object life cycle

三世轮回 提交于 2019-12-18 04:45:04
问题 I can't find the Application's object (extend Application) life cycle. For example, what happens if I have a broadcast receiver which is called through Alarm. Will methods in Application being called? Or is everything independent from the Application? If I have a datahelper instantiated in the Application and I call it from broadcast receiver, will it available? Which is the Application object life cycle, when it is destroyed? when is it called when using Alarms? What happens when the

set 2 proximity alerts with the same broadcast

纵饮孤独 提交于 2019-12-18 04:23:36
问题 I create a proximity alert in this way private void setProximityAlert(float radius, double lat, double lng, String place) { long expiration = -1; LocationManager locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Intent intent = new Intent(TREASURE_PROXIMITY_ALERT); intent.putExtra("lat", lat); intent.putExtra("lng", lng); intent.putExtra("place", place); PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), -1, intent, 0); locManager

When android fires ACTION_BATTERY_LOW

妖精的绣舞 提交于 2019-12-18 04:12:59
问题 In my application, I want to do something when the battery is low. When battery is low android fires ACTION_BATTERY_LOW and when the battery again reaches to its good health it fires intent ACTION_BATTERY_OKAY . So, I have three questions regarding this: 1.At what battery percentage android actually fires ACTION_BATTERY_LOW ? 2.Does it fire that same event repeatedly if the battery gets even lower? 3.Can we configure the battery percentage at which android will fire ACTION_BATTERY_LOW intent?

Android throw DeadObjectException with LOG: Transaction failed on small parcel; remote process probably died

陌路散爱 提交于 2019-12-18 04:11:43
问题 07-22 04:38:07.933 1579 3338 E JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 352) 07-22 04:38:07.933 1579 3338 W BroadcastQueue: Can't deliver broadcast to com.android.systemui (pid 2160). Crashing it. 07-22 04:38:07.934 1579 3338 W BroadcastQueue: Failure sending broadcast Intent { act=android.intent.action.TIME_TICK flg=0x50000014 (has extras) } 07-22 04:38:07.934 1579 3338 W BroadcastQueue: android.os.DeadObjectException: Transaction failed on small parcel; remote process

Android throw DeadObjectException with LOG: Transaction failed on small parcel; remote process probably died

我们两清 提交于 2019-12-18 04:10:30
问题 07-22 04:38:07.933 1579 3338 E JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 352) 07-22 04:38:07.933 1579 3338 W BroadcastQueue: Can't deliver broadcast to com.android.systemui (pid 2160). Crashing it. 07-22 04:38:07.934 1579 3338 W BroadcastQueue: Failure sending broadcast Intent { act=android.intent.action.TIME_TICK flg=0x50000014 (has extras) } 07-22 04:38:07.934 1579 3338 W BroadcastQueue: android.os.DeadObjectException: Transaction failed on small parcel; remote process

What is the integer value that gives a broadcast receiver highest priority?

元气小坏坏 提交于 2019-12-18 03:57:26
问题 What is the integer value the gives a broadcast receiver the highest priority? <intent-filter android:priority="1"> <action android:name="android.provider.Telephony.SMS_RECEIVED" /> </intent-filter> 回答1: Well, according to the documentation "The value must be an integer, such as "100". Higher numbers have a higher priority." So I'm guessing that any integer value is valid. And the highest priority possible would be the maximum integer that android allows, which is (2^31 - 1). EDIT The

Android Broadcast from Service To Activity

穿精又带淫゛_ 提交于 2019-12-18 03:56:12
问题 I am trying to send a Broadcast from a service out to an Activity. I can verify the broadcast is sent from within the service, but the Activity doesn't pick up anything. Here is the relevant service code: Intent i = new Intent(NEW_MESSAGE); i.putExtra(FriendInfo.USERNAME, StringUtils.parseBareAddress(message.getFrom())); i.putExtra(FriendInfo.MESSAGE, message.getBody()); i.putExtra("who", "1"); sendBroadcast(i); And the receiving end in the activity class: public class newMessage extends