android-8.0-oreo

How to turn on/off wifi hotspot programmatically in Android 8.0 (Oreo)

匆匆过客 提交于 2019-11-27 01:45:42
I know how to turn on/off wifi hot spot using reflection in android using below method. private static boolean changeWifiHotspotState(Context context,boolean enable) { try { WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); Method method = manager.getClass().getDeclaredMethod("setWifiApEnabled", WifiConfiguration.class, Boolean.TYPE); method.setAccessible(true); WifiConfiguration configuration = enable ? getWifiApConfiguration(manager) : null; boolean isSuccess = (Boolean) method.invoke(manager, configuration, enable); return isSuccess; } catch (Exception e) {

NotificationChannel issue in Android O

别说谁变了你拦得住时间么 提交于 2019-11-27 01:27:55
问题 I am getting a toast saying "Developer warning for package com.google.android.apps.messaging" when sending an MMS using Android Messages ver 2.3.063. In logs 08-12 16:57:52.368 7661 7682 W Notification: Use of stream types is deprecated for operations other than volume control 08-12 16:57:52.368 7661 7682 W Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case 08-12 16:57:52.369 1604 3146 E

Launcher Icon is not Shown in Oreo 8.0/8.1

梦想的初衷 提交于 2019-11-27 01:13:32
问题 Explanation: I have a working app in google play market. Everything works fine in android versions from 4.0-7.0. Case: When the client downloaded it on his Android 8.0 (Oreo) a launcher icon did not seem to show instead android's default launcher icon is showing!! Question: Anyone who has encountered such issue? I need any hints to solve it since it seems weird because I have all 4 typed .png icons in mipmap folder. 回答1: Yes, I also faced the same issue in Android Oreo. 1) Add your images by

How To Properly Update A Widget In Android 8.0 - Oreo - API 26

跟風遠走 提交于 2019-11-27 00:53:31
问题 Let's say I have a widget for an app that has targetSDKVersion set to 26. This widget takes between 100ms and 10s to update. Most of the time under 1s. Before Android O, if onUpdate() was called on my AppWidgetProvider, I could launch a background service to update this widget. However, Android O returns an IllegalStateException if you attempt that behavior. The obvious solution of starting a foreground service seems like an extreme measure for something that will be done in under 10s 99% of

How to run a background service in Oreo for longer period?

夙愿已清 提交于 2019-11-26 23:31:28
问题 Android Oreo has imposed many restrictions on running background service. Services now don't behave like normal in Oreo as they used to before. But what if I have to run a service in background for long periods of time. I am developing an application to launch the flashlight when user shakes the phone. To achieve this I will have to put the Sensor listener code inside a service. How do I prevent android system to not kill the service. PS: I don't want to start a foreground service with a

Custom notification sound , android Oreo?

非 Y 不嫁゛ 提交于 2019-11-26 23:10:32
问题 I want to set a custom notification sound from a raw mp3 or wav file in my app. Below is my code private void sendMyNotification(String message) { Intent intent; if (sharedPreferences.getBoolean(SPConstants.IS_LOGGED_IN, false)) { intent = new Intent(this, ActivityNotification.class); } else { intent = new Intent(this, ActivitySplash.class); } intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);

Continually Running Background Service

我只是一个虾纸丫 提交于 2019-11-26 22:46:30
问题 I'm targeting sdk version 27 with a minimum version of 19 and trying to get a service that runs continuously in the background. I tried different service start options but it still got killed with the app. I tried using a BroadcastReceiver to start the service when it got killed but that gave me an error saying that the app was in the background and couldn't start a service so I tried using the JobScheduler and that gave me the same error. How is this supposed to be done? For example, if I

How to end an incoming call programmatically on Android 8.0 Oreo

旧时模样 提交于 2019-11-26 22:24:41
问题 Up to Android 7.1 it was possible to end an incoming call by using the ITelephony.endCall() method and giving your app the permissions android.permission.CALL_PHONE and android.permission.READ_PHONE_STATE . When doing the same on Android 8.0 Oreo (API 26) , i get this error 12-09 18:11:25.195 16833-16833/li.doerf.leavemealone E/TelephonyServiceCallHangup: Missing permission MODIFY_PHONE_STATE, cannot hangup call Since MODIFY_PHONE_STATE is a protected permission, my app cannot get it. Is

On Android 8.1 API 27 notification does not display

 ̄綄美尐妖づ 提交于 2019-11-26 22:14:58
I get Toast on Android 8.1 API 27: Developer warning for package "my_package_name" Failed to post notification on ... Logcat includes next strings: Notification: Use of stream types is deprecated for operations other than volume control W/Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case E/NotificationService: No Channel found for pkg=my_package_name The full information in the Toast and in Logcat can help in the localization this problem. If you get this error should be paid attention to 2 items and

Android, method.invoke crashes in SDK 26, Oreo?

孤者浪人 提交于 2019-11-26 22:00:22
问题 This is my first post on StackOverflow . I have used the reflection in my boosting app like below. It works well in sdk<26 but in sdk 26 I get the java.lang.reflect.InvocationTargetException exception. How can I bring it back to work in android 8? My code is like: Method pkgMethod = getPackageManager().getClass().getMethod("getPackageSizeInfo", String.class, IPackageStatsObserver.class); pkgMethod.invoke(getPackageManager(), pkg.packageName, new IPackageStatsObserver.Stub() { @Override public