broadcastreceiver

Update ul response of broadcast receiver of wifi in android

喜你入骨 提交于 2019-12-13 01:40:27
问题 I want to update the UI on the response of broadcast receiver.I have to class one is MainActivity and another one is CustomReceiver. MainActivity.java package com.example.broadcasttest; import java.net.URLEncoder; import java.util.ArrayList; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter

Android: CalledFromWrongThreadException thrown when broadcast intent is handled

大兔子大兔子 提交于 2019-12-13 01:33:05
问题 Here is the basic life cycle of my application. It targets SDK version 8 by now, since I am still running Android 2.3.3 on my device. The application starts, onResume() is called The method show() is called to display cached data. A background service gets started which downloads and stores data. It uses AsyncTask instances to accomplish its work. One of the tasks stores downloaded data in a SQLite database. A broadcast intent is sent in onPostExecute() when the storing task has finished. The

Android - BroadcastReceiver's onReceive crashing from Intent?

久未见 提交于 2019-12-13 01:12:33
问题 So I'm trying to start a new activity from my onReceive function in a `BroadcastReceiver, yet I seem to be crashing. Without further adieu here is the code: public void onReceive(Context context, Intent intent) { //... other stuff that's not relevant Intent j = new Intent(context, myClass.class); context.startActivity(j); //If I comment the above two lines out and replace with a Toast, the toast shows up } Thoughts? Edit - did some more testing, and I can start this activity from other places

Result Back from Broadcast Receiver

半世苍凉 提交于 2019-12-13 00:45:16
问题 I am sending a broadCast from App A to app B, app B has a BroadCastReceiver to handle intent. Now I do some operation in onReceive in App B's BroadcastReceiver and then I want to get result back to App A, so that I can have a callback, and continue operations if result is positive. Below some code. inside App B: public class TripBackupReceiver extends BroadcastReceiver { @Override public void onReceive(Context arg0, Intent arg1) { System.out.println("broadcast Received"); // send result back

Pass a string from an Android Java activity to a broadcast receiver

我的梦境 提交于 2019-12-12 21:02:04
问题 I have spent the last couple of hours looking through other questions on this topic and none that I found were able to give me any answers. What is the best way to pass a string from an activity to a broadcast receiver in the background? Here is my main activity public class AppActivity extends DroidGap { SmsReceiver mSmsReceiver = new SmsReceiver(); public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ScrollView scroll; scroll = new ScrollView(this); Bundle

Getting DTMF signals when receiving a call on Android

社会主义新天地 提交于 2019-12-12 19:15:36
问题 Is there any way to receive and identify DTMF signals when you get a phonecall? I found these two functions (extractNetworkPortion & extractPostDialPortion), but I can't seem to get DTMF signal send by phonecalls. Also, what is the shortest delay you can have for sending DTMF signals when calling someone? 回答1: Unfortunately this is not possible in standard Android platform (as of the latest version, 3.1) 回答2: It is not in SDK but you can make it. Look at this project : http://code.google.com

GeoFence using PendingIntent.getBroadcast() not working

六眼飞鱼酱① 提交于 2019-12-12 19:13:18
问题 I am trying get a Geofence trigger to a BroadcastReceiver and the BroadcastReceiver has the code to read the data from the intent and act on the data sent in intent. My BroadCastReceiver is GeoLocationBroadCastReceiver . I am invoking this code when my activity is opened and the app is in background. public PendingIntent getPendingIntent(Context context){ Intent i = new Intent(context, GeoLocationBroadCastReceiver.class); return PendingIntent.getBroadcast(context, 0, i, PendingIntent.FLAG

onNewIntent not called on restart

天大地大妈咪最大 提交于 2019-12-12 18:09:46
问题 I have an alarm clock app, that is using Alarm Manager and a Broadcast Receiver. The app is one single activity and 4 fragments. When an alarm goes off the onReceive method sends an intent to the main activity, the main activity receives this intent in the method onNewIntent and then moves to the correct fragment. Everything works fine, except when an alarm goes off after the app has been closed. Once I destroy the app, the alarm still goes off and the intent from the broadcast receiver fires

INSTALL_REFERRER not received before application launched

送分小仙女□ 提交于 2019-12-12 15:10:53
问题 I want to catch INSTALL_REFERRER intent at my own receiver. I implemented receiver public class InstallReferrerReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.d("Broadcast", "RECEIVED!"); } } and add at Manifest <receiver android:name=".receiver.InstallReferrerReceiver" android:exported="true"> <intent-filter> <action android:name="com.android.vending.INSTALL_REFERRER"/> </intent-filter> </receiver> When i want to test receiver, i

Why the Broadcast receiver does not work after killing Android app?

南楼画角 提交于 2019-12-12 13:44:34
问题 I am using a broadcast receiver in my app to record calls. Everything works fine in Android 5.0 emulator device. If I kill the app, it automatically starts recording calls. But the same app when I installed on my device running Android 6.0, it works until the app is running. When I kill the app the recording is not started, the broadcast receiver is not triggered. 回答1: String manufacturer = "xiaomi"; if(manufacturer.equalsIgnoreCase(android.os.Build.MANUFACTURER)) { //this will open auto