android-8.0-oreo

Can't get default account in OREO

本秂侑毒 提交于 2019-12-02 01:19:00
In Android Oreo, AccountManager.getAccountsByType("com.google"); returns null . Its, working fine in below Android 8 versions. Below is my code: private static Account getAccount(AccountManager accManager) { Account[] accounts = accManager.getAccountsByType("com.google"); Account account; if (accounts.length > 0) { account = accounts[0]; } else { account = null; } return account; } Thanks in advance. As per Android's update, from Oreo onwards we can not use AccountManager.getAccountsByType to get the list of google accounts configured on user's device, as they have updated the Google SignIn

Android Notification Channel sounds stop working when using sound URIs that reference resource ids

ぐ巨炮叔叔 提交于 2019-12-01 23:09:45
问题 We have created notification channels for devices running on Oreo and above, that use a custom notification sound that is located in our /res/raw folder. Recently, when users upgraded our app, the notification sound just stopped working and the notification only vibrates the device. We have confirmed that uninstall/reinstall or clearing app data resolves the issue. However, in order to get notification sounds to work for everyone again without having to reinstall, we need to essentially

Android Oreo: Keep started background service alive without setting it foreground (but with a notification)?

穿精又带淫゛_ 提交于 2019-12-01 18:27:26
问题 I am working on a media app. I wonder how I can keep some old behavior my app has prior to Oreo, for example, have the notification and the service (for playback) hang in there even if the service is no longer set to foreground. We call startService(MediaPlaybackService.class) to start the service when playback starts, then create a notification and call startForeground() with it on the service. So far so good - if user exits the app, user will still have media play in the background and can

Android Oreo: Keep started background service alive without setting it foreground (but with a notification)?

☆樱花仙子☆ 提交于 2019-12-01 18:07:14
I am working on a media app. I wonder how I can keep some old behavior my app has prior to Oreo, for example, have the notification and the service (for playback) hang in there even if the service is no longer set to foreground. We call startService(MediaPlaybackService.class) to start the service when playback starts, then create a notification and call startForeground() with it on the service. So far so good - if user exits the app, user will still have media play in the background and can control the playback from the notification. When user pauses playback, we call stopForeground(false) to

How to find out the Notification channel Id from RemoteMessage

我们两清 提交于 2019-12-01 15:14:01
I registered notification channel in Android app following GoogleSamples https://github.com/googlesamples/android-NotificationChannels However how can I get notification channel Id from RemoteMessage, so I can set it to NotificationBuilder. public class FirebaseMessagingService extends com.google.firebase.messaging.FirebaseMessagingService { @Override public void onMessageReceived(RemoteMessage remoteMessage) { //int id = remoteMessage.getNotificationChannel(); // -something like this I could not find } I found this value in RemoteMessage object value[3]="notification_channel_system", so I can

FCM Notifications not getting called in background for Oreo

[亡魂溺海] 提交于 2019-12-01 13:58:00
I am using FCM notifications for chat when user is not connected to xmpp. There are 2 modes of Notifications in FCM 1. Notifications Message 2. Data Messages I an using Data messages as Notification messages won't come if my app is cleared from recents This approach is working fine for all the version except Oreo. For Oreo, I only get notifications if the app is not connected to xmpp and in foreground. My onMessageReceived method is getting called. But the same is not happening when the app is killed or removed from recents ONLY for Oreo. Edit: I tried on One Plus 3 device. Any help is

How to use StorageStatsManager.queryStatsForPackage on Android O?

社会主义新天地 提交于 2019-12-01 11:33:51
Background Before Android O, in order to get an app size, you had to have a special permission for it, and use a hidden API. The problem Such a solution won't work anymore, but instead, Google provides an official API that's less granular: queryStatsForPackage , which returns StorageStats object. However, I can't find any information of how to use it. As opposed to the hidden API, which only required the package name of the app, this one also requires "String volumeUuid" and "UserHandle user". The questions How do I provide those parameters? What do they mean? Is each of the volumeUuid refer

Permanent services on android oreo

柔情痞子 提交于 2019-12-01 09:52:36
Android 8's battery consumption improvements are nice to the user but I am a bit afraid if my service will work as expected. First of all: Thank you for any suggestions but I cannot just schedule my service. I want to make a OK Google -like keyword listener running in the background all the time. It will be based on the open source pocketsphinx-android library. I know that this will consume much battery power and I will inform the user about this. Can we create a permanent background service on android 8+ ? I need to target android 8 in gradle because I was expecting some bugs with older

Foreground service not receiving location updates in Doze mode in Android O

╄→尐↘猪︶ㄣ 提交于 2019-12-01 08:21:18
I have a foreground service that needs to get a single location update. It is started by a specific broadcast, and upon starting it simply does a request on our backend. When it receives another broadcast, it requests a location update (once), does another backend request and then stops itself. Edit: to clarify, the service itself does the location updates and backend requests. It is independent from the main app in that regard. This works well on Lollipop and Marshmallow, both when the phone is awake or in Doze mode. But for some reason, on Android O the service never gets location updates

Different notification sound not working in Oreo

若如初见. 提交于 2019-12-01 07:06:31
问题 I am facing some Notification related issue in Oreo Version only. I follow this link and successfully got custom sound after uninstall/install the app as he has suggested. Now problem is that I want to use two custom sound in my app, For that, I have code like: private void sendNotification(NotificationBean notificationBean) { String textTitle = notificationBean.getTitle(); String alert = notificationBean.getMessage().getAlert(); int orderId = notificationBean.getMessage().getOrderId();