#Best way to implement notifications without losing changes after native:install

1 messages ยท Page 1 of 1 (latest)

stiff tartan
#

Would really appeciate some support in this topic, cause i cannot wrap my head about it.

empty root
#

Thats a good one buddy, i have the same issuq with some cam and microphone settings i need to enable for my voip video app.

I was thinking about creating some sort of nativePHPChild folder, and make adjustment etc in that place. Hook all these changes into the main project.

But i am a complete zero when it comes down to IOS and Andriod mobile stuff. So i still need to find a way to make it less of a burden ๐Ÿ˜„

stiff tartan
sleek prairie
#

What permissions do you need to add? As of a couple days ago native:install no longer updates your config

stiff tartan
# sleek prairie What permissions do you need to add? As of a couple days ago native:install no l...

Iโ€™ve made multiple changes inside the nativephp/android folder while integrating Firebase push notifications and getting the build working. These include:

local.properties โ†’ added sdk.dir for Android SDK.

app/src/main/AndroidManifest.xml โ†’ added <service> for SofaFirebaseService and updated permissions/config.

app/src/main/java/al/sofa/app/ui/MainActivity.kt โ†’ initialized FirebaseMessaging and adjusted activity config.

app/src/main/java/al/sofa/app/ui/SofaFirebaseService.kt โ†’ new service class for handling FCM messages.

Gradle files โ†’ applied com.google.gms.google-services plugin and Firebase dependencies.

Other minor adjustments (notification channel setup, portrait orientation lock, etc.).

The problem: when I run php artisan native:install, these edits get wiped/reset because somehow they are not not commitable.
You mentioned that native:install no longer touches configs, but on my side it still overwrites. Did I follow the best way to add these changes, or is there a recommended approach for keeping them persistent?

sleek prairie
#

To be honest you are going well outside the intended use for the app, while we do not disallow you doing that there is absolutely no support for how you are going about things. I'm familiar with Sofa, but I added FCM to an app yesterday for Android/iOS all within the scope of the package without any issues.

When I mentioned configs dont get overwritten I specifically meant config/nativephp.php - this should not be touched when doing a native:install --force (as long as you are on the latest version), anything inside of nativephp/{android,ios} will absolutely get changed though.

The package has all of the code required for an app, we move that out of vendor so that we can make updates to permissions and other configurations etc, the install version is meant to move those files from vendor into the project/nativephp dir. The --force flag is used to essentially rm -rf the nativephp dir because some items get cached during builds etc.

So what you are doing, while admirable, simply goes against the way the product was designed to be used, a sort of voided warranty.

stiff tartan
#

Thanks a lot for the answer! Appreciate it

sleek prairie
#

there are several steps, which is out of our control completely. Are you trying ios or android first?

sleek prairie
#

android is much simpler, are you using livewire

stiff tartan
#

at least for the moment

sleek prairie
#

ok, so what does the permissions array in config/nativephp.php look like

#

and what version of the package are you on

stiff tartan
#

I added INTERNET and POST_NOTIFICATIONS for Android

sleek prairie
#

no, in config/nativephp.php

#

scroll to the bottom

#

look at the permissions array

stiff tartan
#

well there is no array permissions on config/nativephp.php

#

1.6.5

#

the version

stiff tartan
#

Well i guess I have done smth really wrong and I'm stuck at this thing. I'm new to Laravel and coding in general but i'll find a way. Just wanted to know if there's a repo that has done this already so I can check it. Thanks anyways Shane, appreciate it sir

sleek prairie
#

Iโ€™ll get something together for ya

sleek prairie
#

this is a bit old @stiff tartan - but the core logic is still the same, I think getting the token properly is perhaps the only issue: https://youtu.be/ujHnqaVAmcs?si=MBiWxSCzICi2jIpg

https://nativephp.com/mobile

๐Ÿš€ Learn How to Add Push Notifications to Your NativePHP Android App with Laravel!
In this video, I walk you through setting up push notifications in a NativePHP Android app using Laravel. Whether you're building a modern mobile app powered by PHP or just exploring NativePHP, this step-by-step tutorial will help y...

โ–ถ Play video
stiff tartan
sleek prairie
#

@stiff tartan I added a new command for android for now native:tail, while the emulator is running, log out whatever you need in the event listener and have that command running, if things are wired up right you will see what you need