android-service

update fragment ui based off of Activity's Broadcast Receiver

我怕爱的太早我们不能终老 提交于 2020-01-16 01:18:32
问题 First let me say I have read through many of the questions related to fragments on SO. However, I can't seem to find a situation quite the same as mine. I have myActivity that is using the PageAdapter, each page being a fragment. I also have a service that receives updates about the network connections etc. The service triggers the receiver in myActivity. myActivity needs to update FragmentPage1 but because I am using a pageAdapter and creating my fragments at run time I cannot

Start a service automatically when app installed to device [duplicate]

被刻印的时光 ゝ 提交于 2020-01-16 00:27:05
问题 This question already has answers here : How to start a Service when .apk is Installed for the first time (10 answers) Closed 5 years ago . I want to start a service automatically when the app is installed. Service is working properly after a launch or after a device boot. So, is it possible to launch a service after installation of the app? 回答1: Google shows the correct answer as the first hit so ... have you done some research on this? How to start a Service when .apk is Installed for the

ActivityNotFoundException: Unable to find explicit activity class service

天大地大妈咪最大 提交于 2020-01-15 15:29:28
问题 This is how my MainActivity and RecorderService Java class files looks like. I'm adding the AndroidManifest file too. MainAcitivity.java protected void onCreate(Bundle savedInstanceState) { btnSendSOS.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { sendSMS(); Intent intent = new Intent(getBaseContext(), RecorderService.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); new CountDownTimer(5000, 1000) { @Override

Background Access to Microphone in Android

邮差的信 提交于 2020-01-14 19:05:20
问题 Is it possible to be constantly monitoring the microphone from a background application (service?) on an Android phone? Some idea of what I want to do: Listen constantly for an audible signal in the background. Upon receipt of 'interesting' audio signal, perform some network operation. The background application must be able to intelligently relinquish access to the microphone should a foreground application require it (unless it can be shared?) - e.g. to make a call. Is this possible? 回答1:

SMS send as a background Service using SmsManager

ぐ巨炮叔叔 提交于 2020-01-14 03:51:13
问题 I am trying to create an application in Android 2.2 which sends SMS to 6 different contacts the same msg automatically in background as a Service using android.telephony.SmsManager which supports both CDMA and GSM. I saw many threads which has a code snippet but they are using which are deprecated i.e. import android.telephony.gsm.SmsManager; so i just replaced it with import android.telephony.SmsManager and wrote the following code & it works SmsManager sms = SmsManager.getDefault(); sms

What is a JobService in Android

*爱你&永不变心* 提交于 2020-01-13 09:35:11
问题 I am inspecting the latest samples in Android-L developer SDK. There is a sample class in android-L/ui/views/Clipping/ClippingBasic called TestJobService . It extends from JobService, which in turn extends from Service . I see that JobService is a class in android.jar, but I cannot find any information on it in the dev guides, nor in the Android sourcecode www.androidxref.com. Has anybody seen this class or know what it's purpose is? 回答1: It's a new type of service, that is invoked for tasks

Memory and CPU per process ANDROID

好久不见. 提交于 2020-01-13 07:24:05
问题 I'm developing an android application where in it, I want to get the running process or app list. I kinda found a way to do using activitymanager. but what I don't know is on how to get the processor and memory used per that process. does any one know how I can achieve this goal. the code to get the running processes is, I get all the running app processes from the above code. please help me to get the values for each an every process in the list. thank you. 回答1: CPU load - you need to read

Is the Android service still alive even after the onDestroy() be called?

て烟熏妆下的殇ゞ 提交于 2020-01-12 14:26:46
问题 For studying the Android service, I wrote a test program that have three button "bind service", "unbind service" and "send echo" on the screen. When clicked, they use bindService() , unbindService() and a Messenger to communicate with the service. Here is the service codes: public class MessengerService extends Service { private final Messenger mMessenger = new Messenger(new TempHandler()); private class TempHandler extends Handler { @Override public void handleMessage(Message msg) { switch

Is the Android service still alive even after the onDestroy() be called?

蓝咒 提交于 2020-01-12 14:25:11
问题 For studying the Android service, I wrote a test program that have three button "bind service", "unbind service" and "send echo" on the screen. When clicked, they use bindService() , unbindService() and a Messenger to communicate with the service. Here is the service codes: public class MessengerService extends Service { private final Messenger mMessenger = new Messenger(new TempHandler()); private class TempHandler extends Handler { @Override public void handleMessage(Message msg) { switch

How to use NotificationCompat.Builder and startForeground?

廉价感情. 提交于 2020-01-12 14:07:51
问题 Short question: I'm trying to use the NotificationCompat.Builder class in order to create a notification that will be used for the service, but for some reason, i either don't see the notification, or can't cancel it when the service should be destroyed (or stopping from being in the foreground) . my code: @Override public int onStartCommand(final Intent intent, final int flags, final int startId) { final String action = intent == null ? null : intent.getAction(); Log.d("APP", "service action