Comments (3)
OK, working after changing:
compileSdkVersion 26 buildToolsVersion "26.0.0"
to:
compileSdkVersion 25 buildToolsVersion "25.0.0"
from android-samples.
@kargoolek This may be due to background service changes applied in android O. You cannot make service forground directly after issuing startService()
command. Use NotificationManager.startServiceInForeground()
to create foreground service. More on that here.
from android-samples.
Hello @kevalpatel2106. Thanks for great repo and a write up in Medium.
I just stumbled on the same issue and figured out that the true cause was very simple.
WindowManager.LayoutParams.TYPE_PHONE
is deprecated in SDKVersion 26 and up, that's why it's crashing for Oreo and up, and that's why lowering SDK build version works as well.
So, changing the LayoutParams initialization to this made it work for all environments with latest SDK.
final WindowManager.LayoutParams params;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//Add the view to the window.
params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
} else {
//Add the view to the window.
params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
}
Hope this helps somebody else!
from android-samples.
Related Issues (9)
- On clicking of button App is closed and there is not chat heads showing on screen
- App does not work HOT 2
- why chat head closes after some seconds ? HOT 2
- Why does the app randomly crash? HOT 3
- Won't work for Android TV
- error: cannot find symbol variable notify_me
- Can't import "Facebook Chat Heads"
- how to return to app when the floating bubble is clicked?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-samples.