android-service

Service not binding

梦想的初衷 提交于 2021-02-10 20:33:36
问题 I have an android device with an integrated barcode scanner. I'm setting up the service as follows: public class BarcodeService extends Service { private final LocalBinder binder = new LocalBinder(); public class LocalBinder extends Binder { public BarcodeService getService() { return BarcodeService.this; } } @Override public IBinder onBind(Intent arg0) { return binder; } @Override public void onCreate() { super.onCreate(); HandlerThread thread = new HandlerThread("ServiceStartArguments");

service killed when app cloes just in huawei device

匆匆过客 提交于 2021-02-10 14:14:42
问题 I make service to Toast a text always but just in huawei device service killed when i kill app. I don't know why? My service is: @Override public int onStartCommand(Intent intent, int flags, int startId) { onTaskRemoved(intent); new CountDownTimer(99999999L,5000 ) { @Override public void onTick(long arg0) { Toast.makeText(getApplicationContext(), "hihihi", Toast.LENGTH_LONG).show(); } @Override public void onFinish() { } }.start(); return START_STICKY; } @Override public IBinder onBind(Intent

Android: Binding to a remote service

只谈情不闲聊 提交于 2021-02-08 14:13:05
问题 I'm building a remote service and a client application targetted at API 24 executing on a Nexus 6P device. I have a remote service that automatically starts at boot. Here are the code fragments: Remote Service Manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="a.b.c"> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher"

Android: Binding to a remote service

不问归期 提交于 2021-02-08 14:10:08
问题 I'm building a remote service and a client application targetted at API 24 executing on a Nexus 6P device. I have a remote service that automatically starts at boot. Here are the code fragments: Remote Service Manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="a.b.c"> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher"

Android: Binding to a remote service

二次信任 提交于 2021-02-08 14:08:24
问题 I'm building a remote service and a client application targetted at API 24 executing on a Nexus 6P device. I have a remote service that automatically starts at boot. Here are the code fragments: Remote Service Manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="a.b.c"> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher"

Proper way to start and stop DayDream service from activity

寵の児 提交于 2021-02-08 08:55:23
问题 I am developing an application which should display a daydream in special circumstances, I searched everywhere to find a proper way to start my daydream service through my MainActivity class with no luck, Currently i am using following code to start daydream and actually it works, but i need a better solution which provides me a way to stop the daydream. public void startDayDream(){ final Intent intent = new Intent(Intent.ACTION_MAIN); try { // Somnabulator is undocumented--may be removed in

Intent-filter for service start

China☆狼群 提交于 2021-01-28 18:52:52
问题 I want to start a service, the service is basically a videoview on windowmanager. I want to start this videoview service even from other applications. this is my code intent-filter, Don't know where I went wrong. <service android:name=".VideoWindow"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:mimeType="video/*" /> <data android

How to bind CallScreeningService?

微笑、不失礼 提交于 2021-01-27 06:27:13
问题 I want to get the Call Details and block the calls(if necessary). As the TelecomManager endCall method is deprecated and as per the documentation it is suggesting to use the CallScreeningService. https://developer.android.com/reference/android/telecom/CallScreeningService.html As mentioned in the Android documentation, I am trying to bind the CallScreeningService with my application. I have created a class public class CallUtil extends CallScreeningService { private Call.Details mDetails;

What is causing this IllegalArgumentException: Service not Registered?

不问归期 提交于 2021-01-27 06:26:20
问题 Whenever I either rotate the phone or press the Home button the application crashes and I get the following exception: 11-25 22:17:23.855: E/AndroidRuntime(5033): FATAL EXCEPTION: main 11-25 22:17:23.855: E/AndroidRuntime(5033): java.lang.RuntimeException: Unable to stop activity {com.liteapps.handin_3/com.liteapps.handin_3.MainActivity}: java.lang.IllegalArgumentException: Service not registered: com.liteapps.handin_3.MainActivity$2@42116cf0 11-25 22:17:23.855: E/AndroidRuntime(5033): at

Touch event.getAction does not work under service class in android studio

笑着哭i 提交于 2021-01-12 06:30:32
问题 I developed an App to collect touch events under the foreground service class. The app has a main activity to input user's information (e.g., name and age). Then a foreground service starts to collect touch events, and a notification is launched to inform the user that the service is running. This is the main activity code public class MainActivity extends AppCompatActivity implements View.OnClickListener { @Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent; switch