• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NotificationCompat only shows white screen on Lollipop

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to show notification using NotificationCompat but i only get white screen,this is my code.

 
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A few follow up questions if I may:
  • Are you trying this in the Android emulator or on a actual physical device?  If on a physical device then which one(s)?
  • What is the result if you try this using the Android emulator, but different versions such as Android 4.4.x, Android 6.0.x and Android 7.0.x?
  • Which version of Android are you trying this on?  I know that you said Lollipop, however there are a few different versions e.g. 5.0.1, 5.0.2 and so on.
  • Are you able to post the APK somewhere so that other people can try it out on their system(s)?
  • If so then are there any unique steps that one would need to preform to duplicate that behavior/result?
  •  
    dev goku
    Ranch Hand
    Posts: 31
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I'm running this on a ZTE device, version Android 5.1.1,after analysing the phone settings i get to know that i have to change some Notification settings, Now i get notification on Notification bar with a white screen but not Headup notification..

    Are you able to post the APK somewhere so that other people can try it out on their system(s)?



    This is the only activity in the app..
     
    Pete Letkeman
    Bartender
    Posts: 1868
    81
    Android IntelliJ IDE MySQL Database Chrome Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    What happens if you take your app as is and run it in an emulator with the same hardware settings (RAM, screen size etc) and the same Android version?

    What happens if you take your app as is and run it in an emulator  which is running a different version of Android?
     
    dev goku
    Ranch Hand
    Posts: 31
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Same thing happens.
     
    Pete Letkeman
    Bartender
    Posts: 1868
    81
    Android IntelliJ IDE MySQL Database Chrome Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Interesting, but not too helpful.

    I copied your code. Put it into a new separate project running Android 5.1.1 on a Google Nexus 4 device and it works for me.
    This would lead me to believe that there is nothing wrong with your code.

    I suspect that you are not looking at the notifications bar and swiping down as shown in the screen shot.
    Yes you get a blank screen, but then again you have not provided any content for that screen yet.
    android.jpg
    [Thumbnail for android.jpg]
    Android Notification Test
     
    dev goku
    Ranch Hand
    Posts: 31
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Yes I got like in the picture, can I get the notification without moving to activity?
     
    Pete Letkeman
    Bartender
    Posts: 1868
    81
    Android IntelliJ IDE MySQL Database Chrome Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    dev goku wrote:Yes I got like in the picture, can I get the notification without moving to activity?


    Yes, but only after you do some work. I believe that you would have to create an Android service
    https://developer.android.com/guide/components/services.html
    In that service you would have to create an event listener to trigger the notification to appear.
    The service could be as simple as a timed service to happen at lets say 3 pm or it could accept data from a REST web service and anything in between.
    The service is installed when the app is installed and I believe that there are controls in Android to enable/disable notifications for any app, even the Google supplied ones.
     
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    The white screen in called preview screen which android displays based on your theme until drawables and other resources are ready to be loaded in your activity.
    first apply custom theme style to your intial activity(Activity which starts first)
    like this

    android:theme="@style/Theme.MyAppTheme"

    and custom style is

    <style name="Theme" parent="android:style/Theme" />
    <style name="Theme.MyAppTheme" parent="Theme">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowBackground">"COLOR YOU WANT TO PLACE WITH WHITE SCREEN"</item>
    </style>
     
    Consider Paul's rocket mass heater.
    reply
      Bookmark Topic Watch Topic
    • New Topic