android-service

Access denied finding property “camera.hal1.packagelist”

纵然是瞬间 提交于 2020-08-21 05:48:42
问题 While using camera in service mobile screen is getting un-touchable(locked by transparent window ) and only below error is occuring Access denied finding property "camera.hal1.packagelist" what will be the reason and its solution? Please help.. 回答1: I was working with the OpenCV tutorial code for camera app on android. I encountered the same error, and after looking at the answers I indeed missed one permission. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Access denied finding property “camera.hal1.packagelist”

我们两清 提交于 2020-08-21 05:48:31
问题 While using camera in service mobile screen is getting un-touchable(locked by transparent window ) and only below error is occuring Access denied finding property "camera.hal1.packagelist" what will be the reason and its solution? Please help.. 回答1: I was working with the OpenCV tutorial code for camera app on android. I encountered the same error, and after looking at the answers I indeed missed one permission. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Access denied finding property “camera.hal1.packagelist”

一世执手 提交于 2020-08-21 05:48:26
问题 While using camera in service mobile screen is getting un-touchable(locked by transparent window ) and only below error is occuring Access denied finding property "camera.hal1.packagelist" what will be the reason and its solution? Please help.. 回答1: I was working with the OpenCV tutorial code for camera app on android. I encountered the same error, and after looking at the answers I indeed missed one permission. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Service Intent Must Be Explict

一笑奈何 提交于 2020-07-22 05:47:10
问题 I am trying to launch a service with a predefined action but i get the following error: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.radioafrica.music.action.TOGGLE_PLAYBACK } at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1745) at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1774) at android.app.ContextImpl.startService(ContextImpl.java:1758) at android.content.ContextWrapper.startService(ContextWrapper.java:515) at

Starting a Service throws an IllegalAccessException

心不动则不痛 提交于 2020-07-16 05:30:34
问题 I have a Service which takes in an audio file and plays it with MediaPlayer . This is how I call my Service : private void playAudio(String url) throws Exception { Intent music = new Intent(this,MusicService.class); music.putExtra("paths", path); startService(music); } This is my Service class: class MusicService extends Service implements OnCompletionListener { MediaPlayer mediaPlayer; String musicFile; @Override public void onCreate() { mediaPlayer = new MediaPlayer(); mediaPlayer

How to stop Android service when app is closed

雨燕双飞 提交于 2020-07-04 06:22:14
问题 I'm trying to keep service running continously until user close app. I'm using startService() method from onCreate() method of my main activity and stopService() in onDestroy() method. Now I have problem, because it seems that my main activity dies and is re-created when I rotate device or when I turn off screen. How can I stop my service only when user stops app manually? 回答1: Set the below attribute in your service tag in the manifest file, <service android:name="service" android

How to stop Android service when app is closed

和自甴很熟 提交于 2020-07-04 06:22:10
问题 I'm trying to keep service running continously until user close app. I'm using startService() method from onCreate() method of my main activity and stopService() in onDestroy() method. Now I have problem, because it seems that my main activity dies and is re-created when I rotate device or when I turn off screen. How can I stop my service only when user stops app manually? 回答1: Set the below attribute in your service tag in the manifest file, <service android:name="service" android

Can we avoid stopForeground to stop Service

送分小仙女□ 提交于 2020-06-29 06:43:23
问题 I have a Service which I use ExoPlayer to play music in it. I am displaying a notification for my app as it is a Foreground Service and I keep updating Notification in onPlayerStateChanged callback method of ExoPlayer : @Override public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { ... showNotification(state, sample); } private void showNotification(PlaybackStateCompat state, Sample sample) { NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "Id

How to read data and listen to changes from Room database in a Service?

时光怂恿深爱的人放手 提交于 2020-06-12 03:00:13
问题 i am storing user information in a local room database. In activities and fragments I use AndroidViewModel and LiveData to listen to changes made to the database and update the UI. Now I want to analyze all of the past user data to give recommendations for future decisions. My recommendations change on every change to the database made by the user so I need to update my reommendations frequently while doing the same calculations over and over again. I was thinking about starting a service on