android-broadcast

Why my BroadcastReceiver stop receiving after a while

荒凉一梦 提交于 2019-12-13 02:24:07
问题 I have a IntentService that does a long work, it takes about 15 minutes to be done. It is a synchronization process to get new data from my server. When this service starts, I start a activity too, to display the progess. This activity creates a BroadcastReceiver , that intercepts messages sent from the service about the process progress. If I leave the app doing it job, after a while the SO switch off the screen. When I switch on the screen again, after about 15 minutes, the service has been

Android get browser's address

北战南征 提交于 2019-12-13 00:55:02
问题 Is there a way to get address from the browser that user is trying to open using some listener or something, and if the address is in the database and the address is banned, stop loading that address in the user's browser? 回答1: Android is a flavour of the Linux operating system and what you want to do is essentially create a firewall. To allow the creation of a firewall in Linux, Netfilter is provided: Netfilter is a set of hooks inside the Linux kernel that allows kernel modules to register

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

How to broadcast referral to android app intallation

久未见 提交于 2019-12-12 10:36:50
问题 Not Answered, Almost Same Question To Explain My Goal: I have an apk URL that could be in a market (eg: Google Play, Bazaar, etc) or could be a direct link to apk file. To Explain My Requirements I'll have to set referral link to broadcast it to app when installed on device. Now we all know that Google Play will broadcast referral (Campaign Attribution) to app, but our native market ( Bazaar ) won't do this. To Explain My Problem Is there anyway to broadcast referral information manually by

Local broadcast from Service not received by Activity

做~自己de王妃 提交于 2019-12-12 09:36:22
问题 I have an Activity in which I am registering a BroadcastReceiver locally as follows: public class SomeActivity extends Activity{ public static final String PERFORM_SOME_ACTION = "PERFORM_SOME_ACTION"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.some_activity_layout); ..... ..... IntentFilter filter = new IntentFilter(); filter.addAction(PERFORM_SOME_ACTION); receiver = new BroadcastReceiver() { @Override public

BroadcastReceiver for WALLPAPER_CHANGED calls onReceive() multiple times : Android

半世苍凉 提交于 2019-12-12 09:33:49
问题 I have a BroadcastReceiver and declared it like this: <receiver android:name="com.services.Receiver" android:enabled="true" android:exported="true" > <intent-filter android:priority="999" > <action android:name="android.intent.action.WALLPAPER_CHANGED" /> </intent-filter> </receiver> and the receiver is: @Override public void onReceive(final Context context, final Intent intent) { change_wallpepar.myPrefs = context.getSharedPreferences("myPrefs", Context.MODE_PRIVATE); new Handler()

Unable to receive SMS receive broadcast on Galaxy SIII running 4.1.1

霸气de小男生 提交于 2019-12-12 09:27:51
问题 I have this problem only on Samsung Galaxy SIII running Android 4.1.1. There is no problem on Samsung Galaxy Ace and Samsung Galaxy Y. The broadcast SMS received is not firing up, when SMS is received. No other SMS app is installed on the phone. I am using the following code to receive the SMS broadcast smsReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "Inside onReceive of smsReceiver"); Bundle bundle = intent.getExtras();

Wake lock required for BroadcastReceiver while phone sleeps?

穿精又带淫゛_ 提交于 2019-12-12 05:03:39
问题 Trying to write a Broadcast Receiver that processes incoming SMSs. Do I need to use a wake lock / partial wake lock, for this application to work, in spite of device going to sleep due to lack of foreground activity ? 回答1: I tend to extend a WakefulBroadcastReceiver to simplify things, so in a way yes. For example: public class MyBroadcastReceiver extends WakefulBroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { final ComponentName comp = new ComponentName

Service not starting at reboot

ⅰ亾dé卋堺 提交于 2019-12-12 02:32:36
问题 I'm trying start a service at the time of booting the device. I have searched many all over and followed the steps and it is still not working out. Once the mobile reboots it shows in the beginning that "application has stopped unexpectedly". I know it is from the receiver file, but couldn't figure out where particularly the problem is. Receiver.java import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class Receiver extends

How to begin a receiver function programmatically in android?

佐手、 提交于 2019-12-12 01:59:22
问题 I want to begin the receiver class by programmatically,I got some idea about how to start service programmatically and what is the difference between beginning service programmatically and receiver programmatically.Share your solutions and ideas. 回答1: If you add receiver in service and get data from your activity. I add Activity and Service class below. This is your main activity when you get receive data from service. public class YourActivity extends Activity { private MyReceiver receiver;