android-service

Android : Not able to sync data between applications above Oreo + devices

删除回忆录丶 提交于 2020-01-01 19:22:37
问题 I am stuck on sync real time data between 2 app only in Oreo+ devices, Like if different user login to the app then it should be immediately effect in other app and It should also change in other app.(e.g. Facebook and Facebook Messenger. If you logout from Facebook, it will automatically logout from FB Messenger or If you log into Facebook then it will automatically logged into FB Messenger and vice versa) I created broadcast receiver in both app and if login changes from one app then send

Starting a service on android platform

拥有回忆 提交于 2020-01-01 15:23:27
问题 I am starting a service using startService(Intent intent) method. When i call this function it reaches the onCreate of service but it is unable to call onStartCommand . Here is my code-- @Override public void onReceive(Context context, Intent intent) { // Send a text notification to the screen. Log.e("mudit", "Action: " + intent.getAction()); try { ConnectivityManager connManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = connManager

Using Service, TimerTask and BroadcastReceiver to check for various updates

旧街凉风 提交于 2020-01-01 12:36:07
问题 I'm trying to create a simple program that does the following: A service (NewsService) started by my activity (UpdateServiceActivity) checks for news. If news are found (NewsService) sends a broadcast to a receiver (NewsReceiver). Upon receiving the broadcast the receiver (NewsReceiver) should notify the activity (UpdateServiceActivity) that there are news. Upon notification, the activity (UpdateServiceActivity) gets the news and handles them. So far I'm just working on a simple example. Here

How to make a BLE connection that is connected using service to use across the activities without stopping the service or disconnecting ble?

非 Y 不嫁゛ 提交于 2020-01-01 05:39:07
问题 I have 3 components. Activity1 has button for connecting and disconnecting the BLE Connection Activity2 Needs to Get the data from the BLE Device. Service All the connection logic (like getRemoteDevice(),connectGatt etc.,) belongs to service. Activity1 is connecting to BLE Device by binding the service. Intent gattServiceIntent = new Intent(mContext,BleService.class);//In Activity1 context bindService(gattServiceIntent, mServiceConnection,BIND_AUTO_CREATE); and makes connection to ble device

Notification RemoteView on click listener

三世轮回 提交于 2020-01-01 00:28:09
问题 So, after a lot of head scratching, I am at my wit's end. I have a media player RemoteViews in my notification and I would like to be able to access the play, pause, previous and next buttons. I know that setOnClickPendingIntent() will be used to communicate from the notification. However, I am left wondering how that will work. Is it possible to let the service handle the clicks? I have tried this, but in vain. I was trying to let me service handle the pause and resume of the player: rm =

Getting I/art: Explicit concurrent mark sweep GC freed

橙三吉。 提交于 2019-12-31 10:39:11
问题 I'm starting a service => background service, And starting a check for files in "new Thread", In the log i'm getting the following, the service/app gets paused . Log : I/art: Explicit concurrent mark sweep GC freed 25935(1686KB) AllocSpace objects, 13(903KB) LOS objects, 39% free, 13MB/22MB, paused 649us total 43.569ms It's just a scan for files in MyData in SDcard, which contain a bunch of pics ( about 20 pics ) . **Scan = Getting the pics names and saving them to String . 回答1: All this

BoundService + LiveData + ViewModel best practice in new Android recommended architecture

亡梦爱人 提交于 2019-12-31 08:43:17
问题 I been struggling a lot thinking about where to place Android Services in the new Android recommended Architecture. I came up with many possible solutions, but I cannot make up my mind about which one is the best approach. I did a lot of research, and I couldn't find any useful guideline nor tutorial. The only hint I found about where to place the Service in my app architecture is this one, from @JoseAlcerreca Medium post Ideally, ViewModels shouldn’t know anything about Android. This

How to check new android 6.0 Permissions from service

时间秒杀一切 提交于 2019-12-31 03:47:08
问题 I've an Android 6.0 Application with an unbound android service connecting to Google API for receiving Fused API Location Provider Updates. For this i need the ACCESS_FINE_LOCATION Permission. Everthing was working fine untill the Update to Marshmallow. Now I need to implement the new Permission Model for my App. I've read that it is not possible to check android 6.0 Permissions directly from within a service. All of my Location Update Receiver and Google APi Client connect part is handled by

Is it better to use AsyncTask or Service to upload a file in background?

痞子三分冷 提交于 2019-12-30 18:56:12
问题 I have a requirement where a user is able to upload a video to Amazon S3. I have achieved this using the java high-level api in amazon sdk. During the upload process if the user clicks the home button the upload must continue in the background. What would be a better approach :? *1 Using AsyncTask: I have tried using AsyncTask and it works fine. But if the uploading process continues for long interval at the background, the OS kills the app to free memory. Is there any way that i can handle

Toast in a self running service

末鹿安然 提交于 2019-12-30 14:07:13
问题 I have an android activity which runs a remote service and then quits. The service itself, polls on a device node, and checks for changes, I want to use toast to alert the user, but I didn't mange to get it to work. the Toast is not showing, and after a while, Android shouts that my app is not responding. BTW, I don't want to start the activity again and display the toast from there, I just want it to pop on the current screen shown to the user. Here is the service code: public class