How can I create a background service that functions are accessible from a concurrent application in android?










0















I'm looking to start a service when a button is pressed in my application.



This service however, will need to be running in the background and maintain a SQLiteConnection object without closing/restarting.



I'll need to access functions in the service, these functions will query a database that is kept on a server over the network using liteSync.



What I've tried;



<service
android:name=".NetworkStuff.Server"
android:enabled="true"
android:exported="true"
android:stopWithTask="false"></service>


I've tried creating and starting a service, however when i switch activities the Service object is destroyed.
I've tried using other methods of maintaining an SQLiteConnection object to no avail such as the following code.



public class MyApplication extends Application{
private SQLiteConnection data;

public SQLiteConnection getData()
return data;


public void setData(SQLiteConnection data)
this.data = data;



The only way I've correctly been able to use the SQLiteConnection object is by doing everything in one activity (insert,select,update,delete).
So from that I looked into running a concurrent application (that will never close) that contains all the above query functions, then a client application would call these functions without needing to even see the SQLiteConnection object.
From that I was lead to a background service that does exactly that.



All the examples I've seen and tried don't seem to run outside of my application (I can't see them in "Running Services" through android settings)



How to call methods of a Service from activity?



https://github.com/MysticMagic/ServiceAndSqlite



How can i initiate a service class that will handle the previously mentioned without having to close/restart it that I can access from an application?



--In reply to comment--



I'm fine with communicating with the database, but yes i'd like a continuously running service that will communicate with a database hosted on a server.
A bit more info;
io.liteglue.SQLiteConnection;
I'm using a library called litesync with that all I need is a SQliteConnection object to be maintained by a continuously running service. This service will need to perform statements (just run a function like the one below)



public ArrayList<String> getData(String statement) 
ArrayList<String> results = new ArrayList<>();

try
SQLiteStatement mystatement;

try
mystatement = mydbc.prepareStatement(statement);
catch (SQLException ex)

return results;


while (mystatement.step())
results.add(mystatement.getColumnTextNativeString(0));


mystatement.dispose();


catch (SQLException ex)

return results;


return results;



The main objective here is to use that same SQLiteConnection object (which holds the address to the server's database)



I'm already able to run all the functions I need however it disconnects randomly and stops updating on the main part. Therefore I'm looking for a single continuous background service that will handle all calls to the SQLiteConnection object that is never closed and acts all in one class.










share|improve this question
























  • Could you please elaborate on what kind of concept you are trying to achieve - is it a continuously running service that communicates with a local database (that is SQLite file) or it communicates with a server? I'm somewhat confused here.

    – The Dreams Wind
    Nov 15 '18 at 6:18















0















I'm looking to start a service when a button is pressed in my application.



This service however, will need to be running in the background and maintain a SQLiteConnection object without closing/restarting.



I'll need to access functions in the service, these functions will query a database that is kept on a server over the network using liteSync.



What I've tried;



<service
android:name=".NetworkStuff.Server"
android:enabled="true"
android:exported="true"
android:stopWithTask="false"></service>


I've tried creating and starting a service, however when i switch activities the Service object is destroyed.
I've tried using other methods of maintaining an SQLiteConnection object to no avail such as the following code.



public class MyApplication extends Application{
private SQLiteConnection data;

public SQLiteConnection getData()
return data;


public void setData(SQLiteConnection data)
this.data = data;



The only way I've correctly been able to use the SQLiteConnection object is by doing everything in one activity (insert,select,update,delete).
So from that I looked into running a concurrent application (that will never close) that contains all the above query functions, then a client application would call these functions without needing to even see the SQLiteConnection object.
From that I was lead to a background service that does exactly that.



All the examples I've seen and tried don't seem to run outside of my application (I can't see them in "Running Services" through android settings)



How to call methods of a Service from activity?



https://github.com/MysticMagic/ServiceAndSqlite



How can i initiate a service class that will handle the previously mentioned without having to close/restart it that I can access from an application?



--In reply to comment--



I'm fine with communicating with the database, but yes i'd like a continuously running service that will communicate with a database hosted on a server.
A bit more info;
io.liteglue.SQLiteConnection;
I'm using a library called litesync with that all I need is a SQliteConnection object to be maintained by a continuously running service. This service will need to perform statements (just run a function like the one below)



public ArrayList<String> getData(String statement) 
ArrayList<String> results = new ArrayList<>();

try
SQLiteStatement mystatement;

try
mystatement = mydbc.prepareStatement(statement);
catch (SQLException ex)

return results;


while (mystatement.step())
results.add(mystatement.getColumnTextNativeString(0));


mystatement.dispose();


catch (SQLException ex)

return results;


return results;



The main objective here is to use that same SQLiteConnection object (which holds the address to the server's database)



I'm already able to run all the functions I need however it disconnects randomly and stops updating on the main part. Therefore I'm looking for a single continuous background service that will handle all calls to the SQLiteConnection object that is never closed and acts all in one class.










share|improve this question
























  • Could you please elaborate on what kind of concept you are trying to achieve - is it a continuously running service that communicates with a local database (that is SQLite file) or it communicates with a server? I'm somewhat confused here.

    – The Dreams Wind
    Nov 15 '18 at 6:18













0












0








0








I'm looking to start a service when a button is pressed in my application.



This service however, will need to be running in the background and maintain a SQLiteConnection object without closing/restarting.



I'll need to access functions in the service, these functions will query a database that is kept on a server over the network using liteSync.



What I've tried;



<service
android:name=".NetworkStuff.Server"
android:enabled="true"
android:exported="true"
android:stopWithTask="false"></service>


I've tried creating and starting a service, however when i switch activities the Service object is destroyed.
I've tried using other methods of maintaining an SQLiteConnection object to no avail such as the following code.



public class MyApplication extends Application{
private SQLiteConnection data;

public SQLiteConnection getData()
return data;


public void setData(SQLiteConnection data)
this.data = data;



The only way I've correctly been able to use the SQLiteConnection object is by doing everything in one activity (insert,select,update,delete).
So from that I looked into running a concurrent application (that will never close) that contains all the above query functions, then a client application would call these functions without needing to even see the SQLiteConnection object.
From that I was lead to a background service that does exactly that.



All the examples I've seen and tried don't seem to run outside of my application (I can't see them in "Running Services" through android settings)



How to call methods of a Service from activity?



https://github.com/MysticMagic/ServiceAndSqlite



How can i initiate a service class that will handle the previously mentioned without having to close/restart it that I can access from an application?



--In reply to comment--



I'm fine with communicating with the database, but yes i'd like a continuously running service that will communicate with a database hosted on a server.
A bit more info;
io.liteglue.SQLiteConnection;
I'm using a library called litesync with that all I need is a SQliteConnection object to be maintained by a continuously running service. This service will need to perform statements (just run a function like the one below)



public ArrayList<String> getData(String statement) 
ArrayList<String> results = new ArrayList<>();

try
SQLiteStatement mystatement;

try
mystatement = mydbc.prepareStatement(statement);
catch (SQLException ex)

return results;


while (mystatement.step())
results.add(mystatement.getColumnTextNativeString(0));


mystatement.dispose();


catch (SQLException ex)

return results;


return results;



The main objective here is to use that same SQLiteConnection object (which holds the address to the server's database)



I'm already able to run all the functions I need however it disconnects randomly and stops updating on the main part. Therefore I'm looking for a single continuous background service that will handle all calls to the SQLiteConnection object that is never closed and acts all in one class.










share|improve this question
















I'm looking to start a service when a button is pressed in my application.



This service however, will need to be running in the background and maintain a SQLiteConnection object without closing/restarting.



I'll need to access functions in the service, these functions will query a database that is kept on a server over the network using liteSync.



What I've tried;



<service
android:name=".NetworkStuff.Server"
android:enabled="true"
android:exported="true"
android:stopWithTask="false"></service>


I've tried creating and starting a service, however when i switch activities the Service object is destroyed.
I've tried using other methods of maintaining an SQLiteConnection object to no avail such as the following code.



public class MyApplication extends Application{
private SQLiteConnection data;

public SQLiteConnection getData()
return data;


public void setData(SQLiteConnection data)
this.data = data;



The only way I've correctly been able to use the SQLiteConnection object is by doing everything in one activity (insert,select,update,delete).
So from that I looked into running a concurrent application (that will never close) that contains all the above query functions, then a client application would call these functions without needing to even see the SQLiteConnection object.
From that I was lead to a background service that does exactly that.



All the examples I've seen and tried don't seem to run outside of my application (I can't see them in "Running Services" through android settings)



How to call methods of a Service from activity?



https://github.com/MysticMagic/ServiceAndSqlite



How can i initiate a service class that will handle the previously mentioned without having to close/restart it that I can access from an application?



--In reply to comment--



I'm fine with communicating with the database, but yes i'd like a continuously running service that will communicate with a database hosted on a server.
A bit more info;
io.liteglue.SQLiteConnection;
I'm using a library called litesync with that all I need is a SQliteConnection object to be maintained by a continuously running service. This service will need to perform statements (just run a function like the one below)



public ArrayList<String> getData(String statement) 
ArrayList<String> results = new ArrayList<>();

try
SQLiteStatement mystatement;

try
mystatement = mydbc.prepareStatement(statement);
catch (SQLException ex)

return results;


while (mystatement.step())
results.add(mystatement.getColumnTextNativeString(0));


mystatement.dispose();


catch (SQLException ex)

return results;


return results;



The main objective here is to use that same SQLiteConnection object (which holds the address to the server's database)



I'm already able to run all the functions I need however it disconnects randomly and stops updating on the main part. Therefore I'm looking for a single continuous background service that will handle all calls to the SQLiteConnection object that is never closed and acts all in one class.







android sqlite android-service






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 6:30







Jube

















asked Nov 15 '18 at 5:51









JubeJube

84212




84212












  • Could you please elaborate on what kind of concept you are trying to achieve - is it a continuously running service that communicates with a local database (that is SQLite file) or it communicates with a server? I'm somewhat confused here.

    – The Dreams Wind
    Nov 15 '18 at 6:18

















  • Could you please elaborate on what kind of concept you are trying to achieve - is it a continuously running service that communicates with a local database (that is SQLite file) or it communicates with a server? I'm somewhat confused here.

    – The Dreams Wind
    Nov 15 '18 at 6:18
















Could you please elaborate on what kind of concept you are trying to achieve - is it a continuously running service that communicates with a local database (that is SQLite file) or it communicates with a server? I'm somewhat confused here.

– The Dreams Wind
Nov 15 '18 at 6:18





Could you please elaborate on what kind of concept you are trying to achieve - is it a continuously running service that communicates with a local database (that is SQLite file) or it communicates with a server? I'm somewhat confused here.

– The Dreams Wind
Nov 15 '18 at 6:18












1 Answer
1






active

oldest

votes


















1














You have to create an IntentService (that has its own Thread) that lives in a Separated Process (I think this step could be optional, but I suggest to let it live in its own Process) and then use the "AIDL inter-process-communication technique" to communicate between Activities/Apps and this Service. It's impossible to write all the code here, but I'll give you few hints:



  • create the IntentService

  • create an AIDL file that expones all methods you will want to use from this Service

  • starting from Android 6 all "permanent" Services should display a notification while running, so you have to make that Service in foreground

  • do a "startService()"/"startForegroundService()" and then a "bindService()"

  • binding a Service will give you an Interface (based on that AIDL file) with which you can normally execute exposed Service's methods as they exists in the same "client" App

  • when the client App is closed don't forget to "unbindService()"

Debugging (using breakpoints from Android Studio) a Separated Process could be hard, so I suggest to do all the work in the same process and then switch to Separated only when you have all work done.






share|improve this answer























  • Thank you this is great info, just a question before I get started though, what do you mean it's "impossible to write all the code here"? You mean yourself giving examples or just I won't be able to use "AIDL inter-process-communication technique" for all the functions I mentioned? If it's the former that's fine your hints are awesome

    – Jube
    Nov 15 '18 at 7:57






  • 1





    I mean: write a complete example here. There are a lot of things to write (How to create IntentServices, how to put it in a Separated Process, how to...etc...)

    – emandt
    Nov 15 '18 at 8:06











  • I was looking through the differences between Service and IntentService and it seems IntentService only performs tasks and then closes, however I'm looking to have this constantly opened until the application is closed. Wouldnt it make more sense to create an AsyncTask for a Service class that stays open to perform these activities?

    – Jube
    Nov 16 '18 at 1:39











  • Nope, IntentService is the same of Service but it has its own Thread. A Service runs in the same Thread of all Activities. You can put a "while(!isTerminated)...do work here..." inside the "onHandleIntent()" method and in this way the IntentService never ends until "isTerminated" is True. I've done may IntentServices that never ends and stay in the Notification Bar as an icon.

    – emandt
    Nov 16 '18 at 7:21












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53313209%2fhow-can-i-create-a-background-service-that-functions-are-accessible-from-a-concu%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














You have to create an IntentService (that has its own Thread) that lives in a Separated Process (I think this step could be optional, but I suggest to let it live in its own Process) and then use the "AIDL inter-process-communication technique" to communicate between Activities/Apps and this Service. It's impossible to write all the code here, but I'll give you few hints:



  • create the IntentService

  • create an AIDL file that expones all methods you will want to use from this Service

  • starting from Android 6 all "permanent" Services should display a notification while running, so you have to make that Service in foreground

  • do a "startService()"/"startForegroundService()" and then a "bindService()"

  • binding a Service will give you an Interface (based on that AIDL file) with which you can normally execute exposed Service's methods as they exists in the same "client" App

  • when the client App is closed don't forget to "unbindService()"

Debugging (using breakpoints from Android Studio) a Separated Process could be hard, so I suggest to do all the work in the same process and then switch to Separated only when you have all work done.






share|improve this answer























  • Thank you this is great info, just a question before I get started though, what do you mean it's "impossible to write all the code here"? You mean yourself giving examples or just I won't be able to use "AIDL inter-process-communication technique" for all the functions I mentioned? If it's the former that's fine your hints are awesome

    – Jube
    Nov 15 '18 at 7:57






  • 1





    I mean: write a complete example here. There are a lot of things to write (How to create IntentServices, how to put it in a Separated Process, how to...etc...)

    – emandt
    Nov 15 '18 at 8:06











  • I was looking through the differences between Service and IntentService and it seems IntentService only performs tasks and then closes, however I'm looking to have this constantly opened until the application is closed. Wouldnt it make more sense to create an AsyncTask for a Service class that stays open to perform these activities?

    – Jube
    Nov 16 '18 at 1:39











  • Nope, IntentService is the same of Service but it has its own Thread. A Service runs in the same Thread of all Activities. You can put a "while(!isTerminated)...do work here..." inside the "onHandleIntent()" method and in this way the IntentService never ends until "isTerminated" is True. I've done may IntentServices that never ends and stay in the Notification Bar as an icon.

    – emandt
    Nov 16 '18 at 7:21
















1














You have to create an IntentService (that has its own Thread) that lives in a Separated Process (I think this step could be optional, but I suggest to let it live in its own Process) and then use the "AIDL inter-process-communication technique" to communicate between Activities/Apps and this Service. It's impossible to write all the code here, but I'll give you few hints:



  • create the IntentService

  • create an AIDL file that expones all methods you will want to use from this Service

  • starting from Android 6 all "permanent" Services should display a notification while running, so you have to make that Service in foreground

  • do a "startService()"/"startForegroundService()" and then a "bindService()"

  • binding a Service will give you an Interface (based on that AIDL file) with which you can normally execute exposed Service's methods as they exists in the same "client" App

  • when the client App is closed don't forget to "unbindService()"

Debugging (using breakpoints from Android Studio) a Separated Process could be hard, so I suggest to do all the work in the same process and then switch to Separated only when you have all work done.






share|improve this answer























  • Thank you this is great info, just a question before I get started though, what do you mean it's "impossible to write all the code here"? You mean yourself giving examples or just I won't be able to use "AIDL inter-process-communication technique" for all the functions I mentioned? If it's the former that's fine your hints are awesome

    – Jube
    Nov 15 '18 at 7:57






  • 1





    I mean: write a complete example here. There are a lot of things to write (How to create IntentServices, how to put it in a Separated Process, how to...etc...)

    – emandt
    Nov 15 '18 at 8:06











  • I was looking through the differences between Service and IntentService and it seems IntentService only performs tasks and then closes, however I'm looking to have this constantly opened until the application is closed. Wouldnt it make more sense to create an AsyncTask for a Service class that stays open to perform these activities?

    – Jube
    Nov 16 '18 at 1:39











  • Nope, IntentService is the same of Service but it has its own Thread. A Service runs in the same Thread of all Activities. You can put a "while(!isTerminated)...do work here..." inside the "onHandleIntent()" method and in this way the IntentService never ends until "isTerminated" is True. I've done may IntentServices that never ends and stay in the Notification Bar as an icon.

    – emandt
    Nov 16 '18 at 7:21














1












1








1







You have to create an IntentService (that has its own Thread) that lives in a Separated Process (I think this step could be optional, but I suggest to let it live in its own Process) and then use the "AIDL inter-process-communication technique" to communicate between Activities/Apps and this Service. It's impossible to write all the code here, but I'll give you few hints:



  • create the IntentService

  • create an AIDL file that expones all methods you will want to use from this Service

  • starting from Android 6 all "permanent" Services should display a notification while running, so you have to make that Service in foreground

  • do a "startService()"/"startForegroundService()" and then a "bindService()"

  • binding a Service will give you an Interface (based on that AIDL file) with which you can normally execute exposed Service's methods as they exists in the same "client" App

  • when the client App is closed don't forget to "unbindService()"

Debugging (using breakpoints from Android Studio) a Separated Process could be hard, so I suggest to do all the work in the same process and then switch to Separated only when you have all work done.






share|improve this answer













You have to create an IntentService (that has its own Thread) that lives in a Separated Process (I think this step could be optional, but I suggest to let it live in its own Process) and then use the "AIDL inter-process-communication technique" to communicate between Activities/Apps and this Service. It's impossible to write all the code here, but I'll give you few hints:



  • create the IntentService

  • create an AIDL file that expones all methods you will want to use from this Service

  • starting from Android 6 all "permanent" Services should display a notification while running, so you have to make that Service in foreground

  • do a "startService()"/"startForegroundService()" and then a "bindService()"

  • binding a Service will give you an Interface (based on that AIDL file) with which you can normally execute exposed Service's methods as they exists in the same "client" App

  • when the client App is closed don't forget to "unbindService()"

Debugging (using breakpoints from Android Studio) a Separated Process could be hard, so I suggest to do all the work in the same process and then switch to Separated only when you have all work done.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 15 '18 at 7:03









emandtemandt

1,117259




1,117259












  • Thank you this is great info, just a question before I get started though, what do you mean it's "impossible to write all the code here"? You mean yourself giving examples or just I won't be able to use "AIDL inter-process-communication technique" for all the functions I mentioned? If it's the former that's fine your hints are awesome

    – Jube
    Nov 15 '18 at 7:57






  • 1





    I mean: write a complete example here. There are a lot of things to write (How to create IntentServices, how to put it in a Separated Process, how to...etc...)

    – emandt
    Nov 15 '18 at 8:06











  • I was looking through the differences between Service and IntentService and it seems IntentService only performs tasks and then closes, however I'm looking to have this constantly opened until the application is closed. Wouldnt it make more sense to create an AsyncTask for a Service class that stays open to perform these activities?

    – Jube
    Nov 16 '18 at 1:39











  • Nope, IntentService is the same of Service but it has its own Thread. A Service runs in the same Thread of all Activities. You can put a "while(!isTerminated)...do work here..." inside the "onHandleIntent()" method and in this way the IntentService never ends until "isTerminated" is True. I've done may IntentServices that never ends and stay in the Notification Bar as an icon.

    – emandt
    Nov 16 '18 at 7:21


















  • Thank you this is great info, just a question before I get started though, what do you mean it's "impossible to write all the code here"? You mean yourself giving examples or just I won't be able to use "AIDL inter-process-communication technique" for all the functions I mentioned? If it's the former that's fine your hints are awesome

    – Jube
    Nov 15 '18 at 7:57






  • 1





    I mean: write a complete example here. There are a lot of things to write (How to create IntentServices, how to put it in a Separated Process, how to...etc...)

    – emandt
    Nov 15 '18 at 8:06











  • I was looking through the differences between Service and IntentService and it seems IntentService only performs tasks and then closes, however I'm looking to have this constantly opened until the application is closed. Wouldnt it make more sense to create an AsyncTask for a Service class that stays open to perform these activities?

    – Jube
    Nov 16 '18 at 1:39











  • Nope, IntentService is the same of Service but it has its own Thread. A Service runs in the same Thread of all Activities. You can put a "while(!isTerminated)...do work here..." inside the "onHandleIntent()" method and in this way the IntentService never ends until "isTerminated" is True. I've done may IntentServices that never ends and stay in the Notification Bar as an icon.

    – emandt
    Nov 16 '18 at 7:21

















Thank you this is great info, just a question before I get started though, what do you mean it's "impossible to write all the code here"? You mean yourself giving examples or just I won't be able to use "AIDL inter-process-communication technique" for all the functions I mentioned? If it's the former that's fine your hints are awesome

– Jube
Nov 15 '18 at 7:57





Thank you this is great info, just a question before I get started though, what do you mean it's "impossible to write all the code here"? You mean yourself giving examples or just I won't be able to use "AIDL inter-process-communication technique" for all the functions I mentioned? If it's the former that's fine your hints are awesome

– Jube
Nov 15 '18 at 7:57




1




1





I mean: write a complete example here. There are a lot of things to write (How to create IntentServices, how to put it in a Separated Process, how to...etc...)

– emandt
Nov 15 '18 at 8:06





I mean: write a complete example here. There are a lot of things to write (How to create IntentServices, how to put it in a Separated Process, how to...etc...)

– emandt
Nov 15 '18 at 8:06













I was looking through the differences between Service and IntentService and it seems IntentService only performs tasks and then closes, however I'm looking to have this constantly opened until the application is closed. Wouldnt it make more sense to create an AsyncTask for a Service class that stays open to perform these activities?

– Jube
Nov 16 '18 at 1:39





I was looking through the differences between Service and IntentService and it seems IntentService only performs tasks and then closes, however I'm looking to have this constantly opened until the application is closed. Wouldnt it make more sense to create an AsyncTask for a Service class that stays open to perform these activities?

– Jube
Nov 16 '18 at 1:39













Nope, IntentService is the same of Service but it has its own Thread. A Service runs in the same Thread of all Activities. You can put a "while(!isTerminated)...do work here..." inside the "onHandleIntent()" method and in this way the IntentService never ends until "isTerminated" is True. I've done may IntentServices that never ends and stay in the Notification Bar as an icon.

– emandt
Nov 16 '18 at 7:21






Nope, IntentService is the same of Service but it has its own Thread. A Service runs in the same Thread of all Activities. You can put a "while(!isTerminated)...do work here..." inside the "onHandleIntent()" method and in this way the IntentService never ends until "isTerminated" is True. I've done may IntentServices that never ends and stay in the Notification Bar as an icon.

– emandt
Nov 16 '18 at 7:21




















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53313209%2fhow-can-i-create-a-background-service-that-functions-are-accessible-from-a-concu%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo