android-service

How to invoke Speechrecognizer methods from service with no main thread or activity

眉间皱痕 提交于 2019-12-23 02:40:26
问题 I am aware that there are dozens of links on Stackoverflow and other sites about the SpeechRecognizer class and how to implement it. I have been through several of them and have searched for hours. Although there are examples of implementations in services, they don't seem to work for me. My application has an activity, however it is only used for user settings and does not run when my service runs, which is called separately from the system. Thus my service does not have any main application

Android Mosby MVI bind to service in presenter

半腔热情 提交于 2019-12-22 17:22:13
问题 I am creating a small app using Mosby. The app has a service which I want to bind to. I guess the correct place to do this is in the presenter. But I can't really figure out how to do it. What I want to archive is when the service is bound I want to call a method on it and push that value to the view, so that the state right now is correct. When the service sends updates on the event bus I want to push that to the view as well. I have found some example on the later part, but nothing about

Android Mosby MVI bind to service in presenter

徘徊边缘 提交于 2019-12-22 17:22:11
问题 I am creating a small app using Mosby. The app has a service which I want to bind to. I guess the correct place to do this is in the presenter. But I can't really figure out how to do it. What I want to archive is when the service is bound I want to call a method on it and push that value to the view, so that the state right now is correct. When the service sends updates on the event bus I want to push that to the view as well. I have found some example on the later part, but nothing about

Android Mosby MVI bind to service in presenter

这一生的挚爱 提交于 2019-12-22 17:22:04
问题 I am creating a small app using Mosby. The app has a service which I want to bind to. I guess the correct place to do this is in the presenter. But I can't really figure out how to do it. What I want to archive is when the service is bound I want to call a method on it and push that value to the view, so that the state right now is correct. When the service sends updates on the event bus I want to push that to the view as well. I have found some example on the later part, but nothing about

Center Text on Watch

时间秒杀一切 提交于 2019-12-22 12:23:09
问题 I've been trying multiple ways to center 3 lines of text on a watch and can't seem to figure it out. The new watch face services require you to paint to a canvas. I initialize the text offset by grabbing the length of text of each line and dividing by 2. mXDateOffset = mTextDateColorPaint.measureText("May 21, 2015") /2; mXTimeOffset = mTextTimeColorPaint.measureText("12:00:00")/2; mXBatteryOffset = mTextBatteryColorPaint.measureText("99%") /2 ; Then when I set the text and paint elements to

Start a live wallpaper service from activity

百般思念 提交于 2019-12-22 11:33:41
问题 public class ShortCurActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Button button = (Button)findViewById(R.id.b_start); if(button != null){ button.setOnClickListener(new View.OnClickListener() { public void onClick(View paramView) { Intent i = new Intent(ShortCurActivity.this, ServiceWallpaper.class); startService(i); } }); } } I just want to know if I can start a live wallpaper

Service v/s AsyncTask

北战南征 提交于 2019-12-22 08:39:02
问题 I am confused with respect to design of my app. I need to continuously poll a server to get new data from it. I am confused whether Async Task running at fixed interval or Service running is background is better option. The thread will run only when the app is running 回答1: You have already some answers to your question, but I think it worths a summary ... What you need When you want to run a peice of code that takes some time to complete you should always run it in a separate thread from the

Send data from Activity to Service

冷暖自知 提交于 2019-12-22 06:45:07
问题 How can I send data from the current Activity to a background Service class which is running at certain time? I tried to set into Intent.putExtras() but I am not getting it in Service class Code in Activity class which calls the Service . Intent mServiceIntent = new Intent(this, SchedulerEventService.class); mServiceIntent.putExtra("test", "Daily"); startService(mServiceIntent); Code in Service class. I treid to put in onBind() and onStartCommand() . None of these methods prints the value.

Stopping an Android Service from within a thread

梦想与她 提交于 2019-12-22 06:44:38
问题 I have a Service which starts a thread during onCreate() . The thread is monitoring hardware (IOIO) and will end once it is disconnected so essesentially is an infinite loop. Stopping the service from an Activity works fine and the thread also stops (ended in onDestory() ). My problem is that if the thread dies (say because of an exception) is it possible to stop the service that spawned it. I've tried using stopSelf() from within the thread code but the service does not stop. Thank you ps my

Lambda expression in Android Library Module not working

放肆的年华 提交于 2019-12-22 05:23:32
问题 I had an android app module which used jdk 8 and enabled Jack Options. Then I convert it to an Android Library module. And then I have to remove Jack Options from build gradle. And now the Lambda expression gives me below error when I try to build the AAR file. Error:(59, 25) error: cannot find symbol method metafactory(Lookup,String,MethodType,MethodType,MethodHandle,MethodType) The code giving this error is, Runnable r= () -> { appManager.startApp(definition,identifier); }; My Build Gradle