broadcastreceiver

Broadcast receiver registered in manifest not getting called in Android Oreo

夙愿已清 提交于 2019-11-27 15:38:05
I have registered following receiver which is not getting called in Android Oreo but works on lower version devices. <receiver android:name=".common.receiver.ConsultReceiver" android:exported="false"> <intent-filter> <action android:name="APP_STARTED" /> <action android:name="APP_STARTED_FROM_ORGANIC" /> </intent-filter> </receiver> Any help would be appreciated? In general, you cannot use an implicit Intent (e.g., one with just an action string) for a broadcast on Android 8.0+ . Your <receiver> is not exported. This suggests one of three things: You are using this with a PendingIntent , such

Android : Implement Broadcast Receiver for ClipboardManager

你说的曾经没有我的故事 提交于 2019-11-27 15:24:04
问题 I want to implement a listener which will listen if some copied any thing from any application. I heard about ClipboardManager.OnPrimaryClipChangedListener() which will listen copy action, but this is not a Receiver (As I understand). I got a sample application, logic behind this application is, start service from system boot and run a service which will listen Copy action, but I think this will drain the battery. Am I right? So how can I implement a Broadcast receiver which can listen Copy

How can one detect an Android application launching?

可紊 提交于 2019-11-27 15:01:03
问题 Is it possible to detect when an app is executed (i.e., when the user clicks on the app's icon)? I attempted to register an intent of type Intent.ACTION_MAIN using a category of of type Intent.CATEGORY_LAUNCHER hoping this would let me know whenever an app is launched. The problem is, my broadcast receiver is never getting called. Is this an illegal intent/category combination for which to register? Is there some method I can use to determine when an application launch occurs? 回答1: The

BroadcastReceiver SMS_Received not working on new devices

若如初见. 提交于 2019-11-27 14:46:51
After going through several resources and questions, I still face a problem with detecting an incoming SMS message. The code below shows the basics: Broadcast receiver class that displays toast onReceive public class IncomingSms extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { Toast.makeText(context, "something received", Toast.LENGTH_SHORT).show(); } } Simple Manifest with registering receiver and permissions <application <receiver android:name=".IncomingSms" android:permission="android.permission.BROADCAST_SMS" android:exported="true"> <intent-filter

SharedPreferences in BroadcastReceiver seems to not update?

旧时模样 提交于 2019-11-27 14:45:33
I have a Activity which updates a string in the SharedPreferences. SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences.Editor editor = settings.edit(); editor.putString("username", username); editor.commit(); I then start a service: startService(new Intent(this, MyService.class)); The service creates a reference to Alarm which extends BroadcastReceiver: Alarm alarm = null; public void onCreate() { alarm = new Alarm(); } @Override public int onStartCommand(Intent intent, int flags, int startId) { alarm.SetAlarm(this); } In SetAlarm I do all the

BroadcastReceiver onReceive triggered when registered

落爺英雄遲暮 提交于 2019-11-27 14:41:28
I have a broadcast receiver which is being triggered the moment it's registered (and subsequently retriggered with onPause / onResume), surely this is the wrong behaviour? Have I missed something here? class FooActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); broadcastReceiver = new FooBroadcastReceiver(); intentFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION); } @Override protected void onResume() { super.onResume(); registerReceiver(connectivityReceiver, intentFilter

Why proguard processes AndroidManifest.xml

早过忘川 提交于 2019-11-27 14:27:34
I see some unexplained Proguard behaviour. AFAIK proguard does not pay attention to android manifest. Also, in my proguard.cfg I have no mention of BroadcastReceiver related classes. So I assume that those should be stripped out. However I see something strange in bin/proguard.txt: # view AndroidManifest.xml #generated:784 -keep class com.fiksu.asotracking.InstallTracking { <init>(...); } and that class (descendand of BroadcastReceiver) does not get stripped. Reason does not say anything meaningful to me: [proguard] com.fiksu.asotracking.InstallTracking [proguard] is kept by a directive in the

BroadcastReceiver not receiving download complete action

给你一囗甜甜゛ 提交于 2019-11-27 14:23:09
I am trying to capture download complete events, but my BroadcastReceiver is not receiving them. Here is the receiver: public class DownloadListenerService extends BroadcastReceiver { @Override public void onReceive(final Context context, Intent intent) { System.out.println("got here"); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences.Editor editor = settings.edit(); String action = intent.getAction(); if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) { String downloadPath = intent.getStringExtra(DownloadManager.COLUMN_URI);

how to run application in background in android?

旧城冷巷雨未停 提交于 2019-11-27 14:16:44
问题 Hi, I want to make an Android application that continues to run in background and when user accesses any folder, picture, or any other file it notifies using toasts that he accesses this file(filename). 回答1: The other people answering your question are focused on the "background" part, and a Service would indeed accomplish this. Users have fairly loudly stated that they despise constantly-running services like the one you are proposing. when user access any folder or picture or any file it

how to catch the system broadcast BOOT_COMPLETED, my program just doesn't work?

萝らか妹 提交于 2019-11-27 14:13:56
I writed a small program to catch the system broadcast BOOT_COMPLETED , but it just doesn't work: package com.alex.app.testsysreboot; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; public class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.i("my_tag", "system reboot completed......."); } } manifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.alex.app.testsysreboot"