service

How to make Angular mock service tree-shakeable

主宰稳场 提交于 2020-05-17 05:42:10
问题 Context In an Angular 9 project, I am working with two environments: production & mock . In the Core Module, I check for mock environment. If build is made with mock configuration I inject mocked services that return mocked data, so no external http requests are made. If build is made with prod configuration, real services are injected. I do it like this: core.module.ts @NgModule({ declarations: [], providers: [], imports: [BrowserModule, HttpClientModule], exports: [], }) export class

Backgroundservice is running, but not working (FileObserver)

♀尐吖头ヾ 提交于 2020-05-15 21:46:05
问题 I want to run a Backgroundservice (FileObserver) that will look for any filechanges in the system (CREATE, DELETE, MOVE, ...). When I start my application it works a few seconds and logs everything fine. For example at taking a picture by the camera it logs that. After a few seconds the service is still listed in Settings => Developer Options => Running Services but does not work and log anything anymore. Android Version: 7.0 Device: Samsung Galaxy S7 Edge I copied the code from Niza Siwale's

Foreground service notification always shown for at least 5 seconds

跟風遠走 提交于 2020-05-15 08:52:27
问题 I noticed some very strange behavior when testing foreground notifications on Android 9. Situation : I have some foreground services where I don't know how long they'll need to run for, be it 1 second or a whole minute. Finally, when the service is done, it will call stopForeground(true) . This used to work fine on all Android 8, 9 and 10 devices, where stopForeground(true) , even if called immediately, always reliably removed the notification. Problem : Testing on a Fairphone 3 (and I hope

Chinese Android Devices Killing Background Service

丶灬走出姿态 提交于 2020-05-14 09:06:18
问题 I am trying to run a background service in an android application. I have tried the standard way of doing it and a lot of other tweaks. The problem is that when the application is closed from recent apps, the service gets killed. This only happens in Chinese Android devices like Oppo, Vivo, Xiomi, etc. It works fine on all other brands. I have tried the following solutions. Over-riding the OnStartCommand() of activity to return START_STICKY . This still not re-starts activity after the

Change identity of a TFS build agent

喜夏-厌秋 提交于 2020-05-12 11:47:07
问题 We have a TFS build agent that runs integration tests. Some of these tests make calls to web services on the Internet. Our network uses a proxy to talk to the Internet. Since the build agent runs under the identity on Network Service and the settings of Network Service are not configured to use the proxy, the tests fail. How do I do one of the following? Change the identity of the build agent to a domain account Configure Network Service to use the proxy 回答1: To change the identity of the

Check if Foreground service is running in Android OREO

有些话、适合烂在心里 提交于 2020-05-12 04:56:39
问题 I want to check whether my service is running in or not, I was using below code which was working fine till nougat but not working in OREO private boolean isMyServiceRunning(Class<?> serviceClass, Context context) { ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { Log.d(TAG, "isMyServiceRunning: " + service.service.getClassName()); if (serviceClass

Check if Foreground service is running in Android OREO

牧云@^-^@ 提交于 2020-05-12 04:55:47
问题 I want to check whether my service is running in or not, I was using below code which was working fine till nougat but not working in OREO private boolean isMyServiceRunning(Class<?> serviceClass, Context context) { ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { Log.d(TAG, "isMyServiceRunning: " + service.service.getClassName()); if (serviceClass

Implement Bluetooth Connection into Service or Application Class without losing connection into a Device

﹥>﹥吖頭↗ 提交于 2020-05-07 19:59:14
问题 i need some help, can you explain to me how can i implement the Bluetooth Connection from my Application into my Mini Thermal Printer Device. The scenario is like this. I already connect my application into device but when the Activity destroyed, the connection also disconnected. Yes, i am aware that when the activity destroyed all the task within the activity is affected. The device has it's own SDK. and that what i am using now. That's why, i really need your help to get over on this

Implement Bluetooth Connection into Service or Application Class without losing connection into a Device

流过昼夜 提交于 2020-05-07 19:55:10
问题 i need some help, can you explain to me how can i implement the Bluetooth Connection from my Application into my Mini Thermal Printer Device. The scenario is like this. I already connect my application into device but when the Activity destroyed, the connection also disconnected. Yes, i am aware that when the activity destroyed all the task within the activity is affected. The device has it's own SDK. and that what i am using now. That's why, i really need your help to get over on this

Unable to start receiver : Not allowed to start service Intent ; App is in background

廉价感情. 提交于 2020-04-30 08:46:28
问题 So I made an app that upon a button click sets up a repeating task using an Alarm Manager. In on create: Intent alarmIntent = new Intent(this, AlarmReceiver.class); servicePendingIntent = PendingIntent.getBroadcast(this, 0, alarmIntent, 0); On the button click: alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE); firingCal= Calendar.getInstance(); firingCal.setTimeInMillis(System.currentTimeMillis()); firingCal.set(Calendar.HOUR_OF_DAY, 1); // At the hour you want to fire the