• Resolved iccke

    (@iccke)


    Hi,

    I made the android app based on the description, it works, it loads the page. However, when I want to save in the push notification settings, nothing happens. In android studio I get this message in the log:

    “Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘getSubscription’)”

    “Uncaught (in promise) FirebaseError: Messaging: This browser doesn’t support the API’s required to use the Firebase SDK”

    “This browser does not support PUSHAPI Firebase messaging!!!”,

    If I open the page in the chrome browser, this setting works there, and the push notify also appears, but not in the webview app.

    What did i wrong?

    Thank you

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter iccke

    (@iccke)

    Sry, i forgot this message: “Uncaught ReferenceError: PNFPB_from_Java_androidapp is not defined”, source: (1)

    Plugin Author Murali

    (@murali-indiacitys)

    I have verified push notification from this pnfpb plugin in my android app which was created using webview of my site, it is working as expected. I have attached screenshots, please ignore those warningS which are generated from website inside webview not from app. I have attached below 3 screenshots for your reference, tokens ending with !!webview are related to mobile app subscription tokens
    (as shown in second screenshot below). I have also checked by displaying firebase results multicast id array for webview mobile app result, it showed success as shown in third screenshot showing success for one webview token ( i have only one webview token and another one is website token) . if you need more details on integrating this plugin with android app, please contact me in support email id specified inside plugin dashboard or in my github account.

    Thread Starter iccke

    (@iccke)

    Hi,

    I wrote my problem to the support e-mail address, thanks for the help.

    Plugin Author Murali

    (@murali-indiacitys)

    I got your email, I am working on this problem, it will take 2 days to complete. Last year Firebase api scripts are modified as modular scripts (es6 javascripts , not in vanilla pure javascripts) due to this I have modified firebase subscription scripts of this plugin in es6 format (modular approach) and this type of scripts won’t support window.postmessage like in vanilla pure javascripts. I will create new extra scripts for webview process and I will implement the changes within 2 days.

    Plugin Author Murali

    (@murali-indiacitys)

    New release will be on 13-02-2024 which will include following changes,

    Bug fix for webview mobile app: Fixed problems related to android/ios mobile app push notification subscription option update to database, saving front end subscription options in webview app.
    Bug fix for Firebase httpv1 version: Fixed problem in admin settings on uploading service account json file to enable firebase httpv1 version api independent of other firebase settings.
    Bug fix for BuddyBoss users: Updated logic to send notifications for activity comments only to liked users for particular activity.
    Bug fix for BuddyBoss users: Updated logic in group forum activities to send notifications only for subscribed users for particular forum.
    Bug fix for onesignal users: Updated logic to control onesignal push notifications based on admin options enabled for various push notifications in plugin admin page.

    Plugin Author Murali

    (@murali-indiacitys)

    1.78 version released today, please verify android app/mobile app, logic is updated to control subscription options from front end settings like in desktop website version

    Thread Starter iccke

    (@iccke)

    Hi,

    I updated the plugin but the problem still exists. And there was a database error in the query monitor, I don’t know if this is relevant.

    Plugin Author Murali

    (@murali-indiacitys)

    I have tried in my mobile app using latest 1.78 version of plugin , it is working as expected, frontend subscription settings in mobile app is working and it is passing subscription values to wordpress site using api and it is updated in wordpress database from mobile app. I have attached below 3 screenshots for your reference

    1. First screenshot is from mobile app frontend settings it is successfully saved
    2. Second screenshot shows debug info from android studio while debugging the app, app is getting subscription value and it is passed using api to update in wordpress database
    3. Device token list showing webview app token with subscription values updated from mobile app

    Please uninstall the app and install it fresh or clear your cache in website or clear content delivery network cache if any, mobile app sometimes it will cache old data, so please clear your app storage and refresh it. In your website, go to view source html and verify this javascript is present in your website view source this file is updated in this release specially for webview mobile app to get token, to get subscription values to control frontend push notification subscriptions, to get group subscriptions, and for shortcode subscriptions /wp-content/plugins/push-notification-for-post-and-buddypress/public/js/pnfpb_pushscript_pwa.js?ver=1.78.1″ id=”pnfpb-mobile-app-interface-script-js”></script>

    screenshot from mobile app showing frontend settings it is successfully saved

    Screenshot showing debug info from android studio while debugging the app, app is getting subscription value and it is passed using api to update in wordpress database

    Device token list showing webview app token with subscription values updated from mobile app

    Thread Starter iccke

    (@iccke)

    Hi,

    I’ve tried everything. I reinstalled the plugin, deleted the cache, rebuilt the app, reinstalled it, but the error is the same as before, the subscription is not saved in the mobile app (one time push working)
    I checked the code, version 1.78.1 is visible on the website.

    Debug info from android studio:

    No changes in the android app code? Because the picture you uploaded has one line more than in the original file.

    Thank you!

    Plugin Author Murali

    (@murali-indiacitys)

    In your android console screenshot, the webview js file which is included in enqueue in php code is not present, it still takes old code. /public/js/pnfpb_pushscript_pwa.js file name will be shown in the android studio console messages (please check my above android studio screenshot in my previous reply), I have also included console message in that script whenever frontend subscription function is accessed it will display frontend_subscription_menu_webview (console log(‘frontend_subscription_menu_webview’), if you see in my screenshot ,android studio console it displays same text in android studio console messages but in your android screenshot it did not present. Please note frontend subscription setting will work only for buddypress plugin

    After checking your site, i found buddypress plugin is not present in your site, are you using any other plugin because i have included frontend subscription option control only for buddypress plugin not for any other plugins. Which plugin are you using for community?

    Or i can test by changing my android webview app code with your site url , and i will test it from here but i need test login id (as subscriber) from your site to check frontend subscriptions, once my testing is over then we will check in device token list whether it is getting subscription.

    The extra line which i include in android code is to display frontend subscription options received from website, it is only for testing purpose, to check whether app is receiving correct subscription option (LOG.D command is to display the variable in android studio debug console), no need to worry about that line in android code.

    $filename = '/public/js/pnfpb_pushscript_pwa.js';
    			wp_enqueue_script( 'pnfpb-mobile-app-interface-script', plugins_url( $filename, __FILE__ ),array('jquery','wp-i18n'),'1.78.1',true);
    Thread Starter iccke

    (@iccke)

    Hi,

    The buddypress plugin is installed and activated.

    Test login: pizoman / tesztacc

    Thank you!

    Plugin Author Murali

    (@murali-indiacitys)

    Could you please let me where i can find push notification subscription settings in your site?, usually it is like this as shown below screenshot but i did not find buddypress profile settings in your site like the below screen , i think you are using different plugin ultimate member plugin for profile in your site? This plugin push notification subscription settings are designed for buddypress plugin’s profile settings like below

    Thread Starter iccke

    (@iccke)

    Hi,

    You were right! The ultimate member plugin messed things up, I turned it off and everything works, the subscription is working from the application, and the push notification is working too.
    Thank you very much again for dealing with my problem. ??

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘In android webview app push notification not working’ is closed to new replies.