broadcastreceiver

How to communicate with more than one USB Serial devices and Android

混江龙づ霸主 提交于 2019-12-06 08:47:56
问题 I am trying to make android code work which can communicate with multiple USB serial devices and android tablet. For this purpose I am using USB Serial Library by FELHR85 https://github.com/felHR85/UsbSerial. I am able to communicate with single USB device at a time. but, now when I try to connect and communicate with multiple USB serial device App is failing. I am using below code to test with multiple devices. public class UsbService extends Service { public static final String ACTION_USB

How to bring application from background to foreground via BroadcastReceiver

空扰寡人 提交于 2019-12-06 08:35:46
I have two classes which are MainActivity and MyBroadcastReceiver. BroadcastReceiver detects whether phone screen is on or off. My desire is to launch my application whenever screen lock is released. I mean that I want to bring my application to the front when phone lock releases. Here is my activity class: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); registerReceiver(); } private void registerReceiver(){ IntentFilter filter = new IntentFilter(Intent.ACTION

how to Get a list of applications being download?

心不动则不痛 提交于 2019-12-06 08:33:32
问题 In my application, I need to know if a particular app is being downloaded from the android market or not. How Do I achieve this functionality? Is it possible to get a list of all the downloads that are in progress?Does the android market broadcast any intents that can be caught? Note:Since my target application is on android 3.0+ devices therefore, I have no issues with using the DownloadManager class(which is 2.3 onwards). 回答1: I found an API that will accomplish what you want but you need

Getting notification endlessly from GCM Intent Service in android

[亡魂溺海] 提交于 2019-12-06 08:14:02
I have created a activity which got refreshes while a notification occurs but I am facing one problem which is that when a notification came it continues to send endless same notification. Earlier it was working fine but I made some changes and this had done. Please help me. I am attaching my code with it. Code for GCM IntentService class @Override protected void onHandleIntent(Intent intent) { Bundle extras = intent.getExtras(); String msgg = intent.getStringExtra("message"); final ResultReceiver receiver = intent.getParcelableExtra("receiver"); Bundle bundle = new Bundle(); if (!extras

Can BroadcastReceiver registered in AndroidManifest receive intents when application process is killed?

老子叫甜甜 提交于 2019-12-06 07:55:04
问题 I have an receiver which is registered in AndroidManifest , but it seems like it can't receive intents when application is killed, assume I have some misunderstanding in Android process life-cycle? Thanks for any help. 回答1: If the user goes into Settings and force-stops your application, on Android 3.1 and higher your BroadcastReceivers will no longer work. You are returned to the same state you are in when your app is first installed -- something must manually run a component (e.g., user

Broadcast receiver stop triggering when swipe clear the app

懵懂的女人 提交于 2019-12-06 07:36:33
Broadcast receiver stop triggering "onReceive(Context context, Intent intent)" method after clear(swipe) app from recent list , how to solve this issue ? Manifest code <receiver android:name="*.receiver.TestReceiver" android:enabled="true" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND" > <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <action android:name="com.google.android.c2dm.intent.REGISTER" /> <action android:name="android.intent.action.BOOT

Register a broadcast receiver from a service in a new thread

时间秒杀一切 提交于 2019-12-06 07:20:15
问题 I have a broadcastreciever which start a long operation (uploading process). In the code of a service started from the Activity class, I need to register this receiver in a new thread. I have checked this post Are Android's BroadcastReceivers started in a new thread? but I need a more concrete example about using Context.registerReceiver(BroadcastReceiver receiver, IntentFilter filter, String broadcastPermission, Handler scheduler) Actually I need to know how to create a new thread from a

Install apk after download with download manager and exit from app

依然范特西╮ 提交于 2019-12-06 06:31:38
问题 i have created an android app and from server if any new version had released it will automatically start downloading by using inbuilt 'download manager' . for auto install after finish the download i have created a broadcast receiver to inform that download has finished and completed and then i start to install it. it works fine during i stay in app and don't close it. but my problem is when i close the application . so after finishing the download i want to automatically install it. but i

Broadcast receiver not affecting shared preferences in Android 4.0 (probably 3.1+)

时间秒杀一切 提交于 2019-12-06 06:19:59
So I have indeed searched thoroughly for an answer to my question; normally I can find answers pretty easily to pretty much anything. Anyway, basically I have an alarm manager set up which eventually sets a broadcast receiver. Inside the receiver, it decides which intent has been received, removes a shared preference, and then sets a notification that starts the activity. The problem is that on my phones with 4.0 the shared preference item is not successfully deleted, but on any previous phones I've tried (2.2, 2.3) it works perfectly. I did end up finding the documentation of Android 3.1 and

Alarm Manager is not activating broadcast receiver?

社会主义新天地 提交于 2019-12-06 06:19:33
I am working on an application inwhich I am using AlarmManager for scheduling things. My Alarm is set. But this Alarm does not invoke BroadcastReceiver written to catch the event. I have searched a great deal but I have not found anything that solves the issue. I am posting my code, please have a look and see if I am missing something. AlarmManagerClass: public class ScheduleMessageManager { Context context; PendingIntent sender; AlarmManager am; public ScheduleMessageManager(Context context) { this.context = context; } public void addAlram(int scheduledMessageID, long scheduledTime) { //