Android Question Firebase Cloud Messaging & Manifest - IMPORTANT!

Discussion in 'Android Questions' started by Marcos Alves, Mar 4, 2019.

  1. Marcos Alves

    Marcos Alves Active Member Licensed User

    In SDK 28 (Android 9) a very important permission MUST TO BE ADDED to the Manifest. Up to SDK 27 there is no impact if you don't use this permission BUT starting at SDK 28 the Firebase Cloud Messaging WILL NOT WORK and will raise an error.
    To avoid this error it's only required to add the follow permission to manifest using B4A manifest editor:

    More details can be read at Android Migration Notes:

    As suggested by @JohnCody , You will get the follow error on SDK 28 and Android 9 if you don't use the permission in manifest (when the app in in ForeGround and a Firebase message arrives)

    java.lang.RuntimeException: Unable to start service com.comten.nexphone.firebasemessaging@f3fffa5 with Intent { cmp=com.comten.nexphone/.firebasemessaging (has extras) }: java.lang.RuntimeException: java.lang.SecurityException: Permission Denial: startForeground from pid=12936, uid=10085 requires android.permission.FOREGROUND_SERVICE
    Last edited: Mar 4, 2019
    fredo likes this.
  2. JohnC

    JohnC Well-Known Member Licensed User

    It would be helpful to include the text of the error message you mentioned in your post - this way if someone else gets that error, they can find your post when they do a keyword search in this forum using the error text as the query.
    fredo and Marcos Alves like this.
  3. Marcos Alves

    Marcos Alves Active Member Licensed User

    I'm doing this ...
  4. Erel

    Erel Administrator Staff Member Licensed User

    I moved this thread to the questions forum as it is confusing.

    The error happened because you set targetSdkVersion to 28. The recommended value for now is 26. Once you set it to the recommended value it will work.
    Marcos Alves likes this.
  5. Marcos Alves

    Marcos Alves Active Member Licensed User

    Hello @Erel ,

    ok, I know that if we use SDK 26 it will work, BUT will work also with SDK 28 and this line on manifest. By the way, is there any other known issue or limitation with SDK 28 and B4A? I'm questioning because due the requirement to change and test the apks to 64 bits (because the native libraries those we use), we have a limited time to identify and eventually fix any error (that's why the sooner we start to use SDK 28, more time we will have to develop new native libs when required and fix the errors)
  6. DonManfred

    DonManfred Expert Licensed User

    No need to wait for any "fix" or somewhat!

    Check all libraries you are using. NOW.

    If they do use native .so Files: Check if there is a 64bit .so file too.
    - If yes, you are save.
    - If not then you need to get an Update of this lib which contains a 64 bit .so file too.

    If they do not use any native .so file then
    - you are save; it is 64bit ready already.
    Peter Simpson likes this.
  7. Marcos Alves

    Marcos Alves Active Member Licensed User

    Yes @DonManfred , we use some .so libs for:

    - SIP and telephony
    - Compress (ffmpeg)
    - Video (VLC Wrapper)

    are some of them... so we are already testing on Android 9 and SDK 28...
    DonManfred likes this.
  8. Erel

    Erel Administrator Staff Member Licensed User

    1. The terms are important. There is no such thing as SDK 28.
    2. There is no relation between the 64 bit requirement (which almost all apps meet) and setting targetSdkVersion to 28.
    The issues or limitations are not related to B4A. There are new requirements that you should meet. As I wrote they are quite simple to meet and everything will be explained. You will have more than enough time to meet these requirements.
    Marcos Alves and Peter Simpson like this.
  9. Marcos Alves

    Marcos Alves Active Member Licensed User

    Hello @Erel . I understand that the limitations and changes are related to the Google decision which is implementing all the new security restrictions and upgrade requirements in the new Android version (V9 - Pie). The 64 bit requirement has a "side" relation with sdk 28... see:

    1. Starting at November-2019, all apps must to be 64 bits compliant
    2. Also the new apps will need to use SDK 28... no SDK downgrade will be allowed

    Some of .so native libs recompiled to support 64 bits could eventually don't work with SDK 28... and that's why we are testing together SDK 28 AND 64 bits libs... about the time requirement, due its complexity I estimated that for some libs (SIP lib based on pjsip for example), we could spend 60-90 days to get a new stable version and more 30 days in beta testing with users... that's why we are worried about time.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice