android-8.0-oreo

Broadcast receiver not working in android oreo

…衆ロ難τιáo~ 提交于 2019-11-28 08:31:21
My Broadcast receiver is not working on oreo but its working below oreo it's working fine, I searched a lot regarding this but could not find the suitable solution. Does anyone face the same problem, here is my code regarding my service in which broadcast has been implemented. Kindly suggests me that how I can make in working in oreo. Here is the class public int onStartCommand(Intent intent, int flags, int startId) { mContext = this; mAppPreferences = new AppPreferences(mContext); if (intent.getExtras() != null) { data = (String) intent.getExtras().get("showPopUp"); phoneNumber= (String)

Broadcast Receiver on Android Oreo

北慕城南 提交于 2019-11-28 07:50:12
问题 I have a network change receiver class and it extends from broadcast Receiver, but I’m not pretty sure that it’s working in android Oreo, does Oreo support broadcast receiver, and if it doesn’t support, what’s the other way to do it 回答1: It's not supported in Oreo as manifest tag, you must have to register it at an Service/ Activity with context.registerReceiver(). Or you use the WorkManager to schedule something for specific network conditions. 回答2: Oreo supports Broadcast Receivers but with

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

白昼怎懂夜的黑 提交于 2019-11-28 01:18:57
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 notification. How do I prevent android system to not kill the service. To summarize the comments: Use a

Android Crash on Android 8.0 Oreo: SecurityException: Permission Denial: null asks to run as user 450 but is calling from user 0

北战南征 提交于 2019-11-28 01:03:44
问题 I upgrade my phone to Android Oreo. When I'm running my app on this device. My app crashes. While it's running well on Android 7 and lower devices. This is the log: E/AndroidRuntime: FATAL EXCEPTION: main Process: com.test.test, PID: 28271 java.lang.SecurityException: Permission Denial: null asks to run as user 450 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL or android.permission.INTERACT_ACROSS_USERS at android.os.Parcel.readException(Parcel.java

java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation

吃可爱长大的小学妹 提交于 2019-11-27 21:25:05
问题 I am facing the problem while retrieving the contacts from the contact book in Android 8.0 Oreo java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation I am trying to get the contact in my activity from the phone contact book and it works perfect for Lollipop, Marshmallow, Nougat, etc but it will gives me the error for Oreo like this please help me. My code is here below. Demo Code :- private void loadContacts() { contactAsync = new ContactLoaderAsync();

Custom JobIntentService onHandleWork not called

谁说胖子不能爱 提交于 2019-11-27 21:08:04
问题 I recently was updating an app that I work on to handle notifications from push using a JobIntentService instead of a regular IntentService because it seems like the correct way to handle this on pre-Lollipop devices as well as post. I am enqueueing work as such: enqueueWork(context, MyJobServiceExtension.class, JOB_ID, work); This is the manifest declaration: <service android:name="com.example.MyJobServiceExtension" android:permission="android.permission.BIND_JOB_SERVICE" android:exported=

Firebase: How to set default notification channel in Android app?

戏子无情 提交于 2019-11-27 20:37:01
How to set default notification channel for notification messages that come when an app is in the background? By default, these messages use "Miscellaneous" channel. Maksim Ostrovidov As you can see here in the official docs , you need to add the following metadata element in your AndroidManifest.xml within the application component: <meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="@string/default_notification_channel_id"/> This default channel will be used when notification message has no specified channel, or if the channel provided has

Continually Running Background Service

南笙酒味 提交于 2019-11-27 19:51:05
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 were making a pedometer app, how could I keep that running in the background? In oreo release Android

Runtime exception Android O with boot_completed

拟墨画扇 提交于 2019-11-27 19:41:57
I'm trying to start an IntentService within my BOOT_COMPLETED receiver, but in Android O (API 26) I get: java.lang.RuntimeException: java.lang.IllegalStateException: Not allowed to start service Intent { act=intent.action.update cmp=packageName.services.OwnService }: app is in background (Message is in one line, but this way it's easier readable) How can I do this the correct way? Here are some options that I outlined in a blog post : Workaround #1: startForegroundService() Your BroadcastReceiver that receives the ACTION_BOOT_COMPLETED broadcast could call startForegroundService() instead of

Why is Android O failing with “does not belong to this FragmentManager!”

我的梦境 提交于 2019-11-27 19:21:12
I have migrated my application to Android O in Android Studio 3 Running on an Android O emulator all my dialogFragments now fail with :- java.lang.IllegalStateException: Fragment MyDialogFragment{43ccf50 #2 MyDialogFragment} declared target fragment SettingsFragment{ceed549 #0 id=0x7f0f0142 android:switcher:2131689794:0} that does not belong to this FragmentManager! at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1316) at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1624) at android.support.v4.app.FragmentManagerImpl