Push Notifications - phonegap build

4
Hi all, while trying to build an android app with push notifications I ran into an issue and after searching around quite a while I found this post where this happened before: https://community.mendix.com/link/questions/93535 Does anyone know, if there is another way for properly building an App with push notifications?  regards, Fabian Edit, just for clarification. I did all the steps for a custom build. Download ‘build on your own’ package and unzip Create Firebase Account Download google-services.json I skipped the google-services-plist as the doc says this is optional add to src folder – here it is unclear where exactly the google-services must be added, but I tried all of these and some more: /src, /config, /src/config > npm install > npm run package upload generated zip from /dist folder The build process on phonegap fails, saying that google-services.json was not found. When checking the generated zip I see, that it is not there, even if it appears in the /build folder. This problem can be handled by manually zipping the build folder. In the next step there’s an error from phonegap for the missing .gradle file. This can be manually commented out, but I have no idea what’s the consequence – i don’t assume this one is added just for fun there. Finally, I got a build done on Phonegap with a lot of manual interaction and I don’t know if it’s really fully working in the end. Also I assume the next person doing this will run into the same problems again and waste a lot of time on this. -- Error1: Error - The following splash screen or icon file does not exist: config/google-services.json second error: Error - The following splash screen or icon file does not exist: config/build-extras.gradle   This is the content of the zip file generated by npm run package while the build folder actually contains this
asked
4 answers
1

Hi Fabian, I've been building apps with push support locally using the advanced flow as described here:

https://github.com/mendix/hybrid-app-template

answered
1

Just viewing the presentation of Mendix 8, Jan promised that native apps, as opposed to hybrid apps, do implement push notifications using the native UI's messaging. It sounds like that is the best way to go.

answered
1

Hi Fabian,

You're not going to like this, but Wilfried is right. Yes it is a bit more work the first time around, but once you get used to the npm commands, I find it is actually way faster to do it this way. Quick step list should be something like this:

  1. Download zip from Cloud Portal
  2. Unzip
  3. Powershell to directory
  4. ‘npm install’
  5. Make changes to your hybrid configuration (add plugins if needed, setup SSO if needed, etc) (use the new push notifications how to to get the correct files from FireBase)
  6. ‘npm run package’ to create a phonegap.zip for the production environment (you can use ‘npm run package – --env.target=test for your test env for example)

 

Once you have done this, any subsequent build for this app should just be ‘npm install’ to download all the dependencies and you can make your changes, and create the zip with ‘npm run package’ again. Easy as that :)

Full documentation on Push Notifications

answered
0

Hi Fabian,

 

Are you sure your files are actually in your config folder. You can delete your build and contents of the dist folder, to make sure you don't conflict the folders. This is my folder content of my phonegap package:

 

root:

/Config (with the Push files)

the build-extras.gradle gave me an error as well, so I had to comment it in config.xml.mustache:

            {{#permissions.push}}
                <resource-file src="google-services.json" target="app/google-services.json" />
              <!--   <resource-file src="build-extras.gradle" target="build-extras.gradle" /> -->
            {{/permissions.push}}

//edit: I just saw your edited post.. You shouldn't get an issue on those files anymore after this right?

//edit2: According to the hybrid template release notes, this should be fixed btw, but the URL in the config.xml.mustache is slightly different:

https://docs.mendix.com/releasenotes/mobile/hybrid-app

answered