Is it possible to add a service to an app being launched by packagemanager? I am using the following code to launch an app
Intent p;
PackageManager manager = getPackageManager();
try{
p = manager.getLaunchIntentForPackage("com.wificonnection.booster92_2017-09-07");
if(p == null)
throw new PackageManager.NameNotFoundException();
p.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(p);
}catch(PackageManager.NameNotFoundException e){
}
I have a speechrecognition service also and I would like the speechrecognition service to run in the background of the launched app so I can close the app and change the view by voice command. Is this possible? If so how would I implement this?
The code I am working with is from this project https://github.com/hypeapps/black-mirror
Also I am using Androidthings for this project.
In an AndroidThings project, your app is the only app ever running.
So yes you can running a background service and do whatever you want. It will not be interrupted as you are the only Application (and Activity) running on that device.
So follow best practices of service binding https://developer.android.com/guide/components/services and you will be fine