android-8.0-oreo

Strange app icon duplication in pinned shortcut (Android O)

橙三吉。 提交于 2019-12-07 05:37:15
问题 I'm creating a pinned shortcut of my app launcher icon for Android O device (either emulator or physical device) and found strange behaviour. My code looks like this: @TargetApi(Build.VERSION_CODES.O) private void createPinnedShortcut(Context context) { ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class); if (shortcutManager != null) { if (shortcutManager.isRequestPinShortcutSupported()) { Intent intent= MainActivity.getLaunchIntent(this); intent.setAction(Intent

How to change notification sound dynamically in Android O

霸气de小男生 提交于 2019-12-07 05:11:08
问题 Recently I use notification channel to support android O. But the problem is I cannot change the sound Uri dynamically. Our app have notification sound setting which user can change app notification sound as they want. But as you know, Android now do not allow developer to update notification channel before user reinstall app. There I consider several possible solutions which is not looks good. User ringtone manager to play ringtone instead of setSound. But when user disable notification in

Android MediaPlayer won't play music on API 26+

丶灬走出姿态 提交于 2019-12-07 04:51:26
问题 I have an app that streams music for the user, this code works fine ok on devices running Android up to API 25, when i test in a device running API 26 or greater the Music wont play and wont show an error message either, attached is my log when using API 28 device. What i have tried: MediaPlayer.setAudioStreamType(int streamtype) Deprecated so i implemented AudioAttributes for API above 26 Different types of mp3 files, but they all play the same in api 25 and below, when i try on device or

How to detect a Notification Channel is blocked by user in Android 8.0

独自空忆成欢 提交于 2019-12-07 03:50:32
问题 Is there any callback my application receives when user blocks a Notification Channel created by my application OR it can be detected later ? 回答1: No, there is no such listener provided by the APIs. You will have to check each time before you make a notification. From the developer document To find out if a user blocked a notification channel, you can call getImportance(). If the notification channel is blocked, getImportance() returns IMPORTANCE_NONE. 回答2: Starting from Android P, there is a

Is android.intent.action.DOWNLOAD_COMPLETE an explicit broadcast?

旧巷老猫 提交于 2019-12-07 03:24:03
问题 My app (targetSdk=25) has a broadcast receiver defined in the manifest as follows: <receiver android:name="my.package.DownloadManagerReceiver" android:exported="true"> <intent-filter> <action android:name="android.intent.action.DOWNLOAD_COMPLETE" /> </intent-filter> </receiver> My DownloadManagerReceiver is notified whenever Android's DownloadManager finishes downloading a file, so I can do some processing on the file that was downloaded. I'm working on migrating my app's targetSdk to 27

Intent to open the Notification Channel settings from my app

房东的猫 提交于 2019-12-07 03:19:25
问题 What's the Intent that I need to send to open the settings of a Notification Channel that I've previously created in my app? I need it to link from my settings activity. 回答1: To open the settings for a single channel, you can use ACTION_CHANNEL_NOTIFICATION_SETTINGS: Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS) .putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName()) .putExtra(Settings.EXTRA_CHANNEL_ID, yourChannelId); startActivity(intent); Using ACTION

How register Broadcast Receiver for media button in Oreo?

白昼怎懂夜的黑 提交于 2019-12-07 03:16:28
问题 I have a problem with the new Android version, that is 8.0 (Oreo). I have to register a broadcast and I do this with this code: // android.intent.action.MEDIA_BUTTON IntentFilter filter = new IntentFilter(Intent.ACTION_MEDIA_BUTTON); r = new MediaButtonIntentReceiver(); // this line sets receiver priority filter.setPriority(999); registerReceiver(r, filter); This works on older Android version but on Android 8 this doesn't work because it is necessary register explicit broadcast but I don't

How to overlay a layout on lock screen when in devices running Oreo and Pie

懵懂的女人 提交于 2019-12-07 01:52:21
问题 In my application i'm trying to overlay a layout with a service here when i'm running service it successfully executes and display the layout on lock screen when target devices is lower than oreo but when i'm trying to overlay the same from versions later than oreo it's not working however when i change the flag to Type_Application_Overlay as suggested in other answers it just display layout when screen is unlocked but i want to show it over lock screen i tried searching a lot but didn't find

Lifetime of BroadcastReceiver with regard to Android O changes

≯℡__Kan透↙ 提交于 2019-12-06 23:19:09
问题 If I declare a BroadcastReceiver via the mainfest file for a system broadcast (let's say for example ACTION_POWER_DISCONNECTED ) the the system will call it every time the specific broadcast is send so the lifetime of the BroadcastReceiver is unrestricted. But there are also broadcasts which can not be registered via the manifest file. For these broadcasts we have to call context.registerReceiver with a corresponding IntentFilter . Let's say I create a BroadcastReceiver for BOOT_COMPLETED and

Font in XML with Android O

僤鯓⒐⒋嵵緔 提交于 2019-12-06 22:33:49
问题 Android O give font directory with new android-studio version 3.0 but when in drop font-file in font directory and run project it give me a error in font file in font directory. Error:Execution failed for task ':app:mergeDebugResources'. /home/ttuser4/Downloads/fontPractice/app/src/main/res/font/Dancing_Script.ttf: Error: The file name must end with .xml 回答1: I also got the similar issue. To fix that i followed the below steps. Updated Android Studio to latest canary build. Change