After I launch a service like in the code below, I need to get access to the methods and variables in this service class.
ComponentName comp = startService(new Intent(this, ClipboardService.class));
I can’t access the methods and variables through the comp variable. How do I set up a variable so I can gain access to the contents of the ClipboardService.class in this case? Thanks.
bindSerivce() is probably the proper way of doing this, but I found my own cheap way of doing what I needed to do while still using startService(). I moved the methods/variables in question into the activity that launches the service. I access the methods I need in this activity instead where I will first stop the service, create a new intent and relaunch the service and sending the updated variables through intent.putExtra(). onStartCommand() in service then extracts the variables. This seems to work well enough for what I’m doing.