android-service

Will we leak the android service connection if the client's process is killed by android?

别等时光非礼了梦想. 提交于 2020-01-04 01:57:07
问题 Condition: I have a client activity "X" of a remote service (with AIDL) that calls the bindService() in the onCreate() and unbindService() in the onDestroy() . Assume that this activity has been started but not in the foreground ( onStop() has happened). It is said that when android system needs more memory elsewhere it might kill the process of another activity with less priority (possibly "X"). If, says, the android system decides to kill "X"'s process, according to the activity-lifecycle

Launch an activity of an application from a different application on Android

ⅰ亾dé卋堺 提交于 2020-01-03 19:42:14
问题 I need to launch an activity (not the main activity) of an application from an application I have made. The activity I want to launch is proprietary, hence, I cannot make any changes to its code(or manifest). For example: I want to launch somebody's Facebook profile from my own application. A normal intent to facebook from my app would open the 'newsfeed'(which I don't want). I want to know how to access any other activity. Thanks in advance! The little code I have: String PACKAGE="com

Activity and JobIntentService Lifecycle

我怕爱的太早我们不能终老 提交于 2020-01-03 19:08:34
问题 I am running a JobIntentService to perform a task in background. The reason for using JobIntentService is that so that the user can minimize the screen while the operation is happening and even if the Android OS destroys the activity the JobIntentService will still keep running and if the user comes back he can be updated with the results. But I have a case in which suppose the user himself closes the app then I want to stop the JobIntentService also. Is there any way to notify the

Android: startActivityForResult not calling onActivityResult

纵饮孤独 提交于 2020-01-03 18:55:29
问题 My Setup A Service running in its own process, CentralService An activity that calls startActivityForResult(), MainActivity The activity that is being started for result, ReturnResultActivity What I'm trying to do Start ReturnResultActivity and have it bind to the service (register its handler) Let whatever other activities want to run run When it receives a message from the service: Unbind from the Service finish() setResult() Have the MainActivity's onActivityResult() method called Using

Android: App with services keeps showing up in Overview Screen after calling finish() and System.exit(0)

一个人想着一个人 提交于 2020-01-03 05:07:42
问题 The App has several running services in the background. They run before and I want them to continue running even after the App closes. After I call from Activity : finish(); System.exit(0); The App removes from foreground, but in the Overview Screen (long menu btn press) the App still appears. And it's always with same behaviour: First click on the App to open: The Overview Screen closes and nothing happens. Second click on the App to open: The Overview Screen closes and the App come back to

Sending data to a bound service

岁酱吖の 提交于 2020-01-03 04:48:15
问题 I have a service that is started. In addition, other components can bind to the service. When a component binds to the service, it has new parameters it needs to deliver to the service. Is it possible to force onBind to be called each time a caller needs to bind (so as to deliver new data through intent)? And if so, is the additional overhead of calling onBind each time significant? BTW, this is a local service where I extend Binder instead of using Messenger. 回答1: Few points to consider: 1)

Binding and starting a service when application starts

*爱你&永不变心* 提交于 2020-01-03 03:04:11
问题 I have a service in Android that encapsulates a framework that has a start method. The service boils down to something like this, many things omitted: public class MyService extends Service { private IBinder thisBinder; public MyService(){ thisBinder = new LocalBinder(); } @Override public IBinder onBind(Intent intent) { return thisBinder; } public void start(Map<String, Object> options) { getDriverManager().start(options); } } I also have a bridging class that makes calls to the service:

Multiple AudioTrack Instances (and Threads) in a Single Service?

匆匆过客 提交于 2020-01-03 02:51:07
问题 I have a streaming music application that can play two streams simultaneously by using two separate services utilizing one AudioTrack each, on their own threads. Now I'd like to able to play more than two streams, and I guess having more services is not the way to go. Is it possible to have a single service having dynamically instantiated AudioTracks? How can I implement separate threads for each of the AudioTrack instances? How will I access the dynamically instantiated AudioTracks? 来源:

Using Intents as a form of message passing

六月ゝ 毕业季﹏ 提交于 2020-01-02 21:54:09
问题 Are there any drawbacks to using intents as a form of message passing between two apps that I control? I have two apks which will always exist on the device together. And, I'd like to use explicit intents to pass messages back and forth as opposed to creating and managing two separate services. Using explicit intents just seems like an easier to manage approach than services. 回答1: Communication between applications can expose certain rich, but if you really need to do this way, you can only

AlarmManager Stops after removing app from recents apps

廉价感情. 提交于 2020-01-02 20:44:20
问题 I am new to this part of android, and here I aim to use alarm manager to run a code snippet every 2 minute which will poll a server (using the website's api) and based on the returned JSON generate notification. After a looking up the web I thought one of the best option in my case will be using intent service and android. Manifest of Services and Recievers <service android:name=".NotifyService" android:enabled="true" android:exported="false" > </service> <receiver android:name=".TheReceiver"