• Hi,

    I am using custom push notification to send web and android app both but in web after clicking on notification custom link url is working but in app custom url link not working. Showing predefined value(google.in) all time.
    KIndly check this.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Murali

    (@murali-indiacitys)

    I will implement this change for one time/On demand push notification in next release.

    In current version, For scheduled one time push notification click_url is passed in data array, so that it can be parsed in webview code like below example (Java android code)

    String pnfpb_click_url = remoteMessage.getData().get("click_url");

    Until the implementation, please schedule your custom push notification to next minute using schedule option in admin settings of PNFPB Plugin ->go to one time push tab page, fill required details, Select date (today’s date), select time next minute or so and click on schedule now button, it will be sent to webview at appropriate time selected with click url in data (as shown in above android code).

    I will implement same for on demand custom push notification soon(non-scheduling) in next release this week soon.

    Thread Starter mondaltapas567

    (@mondaltapas567)

    Also I tried with scheduled one time push notification but still url not passing whereas title and body working

    Plugin Author Murali

    (@murali-indiacitys)

    I have attached screenshot showing from android studio showing click url, please use logic to get it from data array (click_url) like i mentioned above in my previous reply,. screenshot showing click url is variable display in android code using Log.d as shown below, use code like below get click_url from data array (it will be inside data array), refer below screenshot, sample code is available in github repo https://github.com/muraliwebworld/android-app-to-integrate-push-notification-wordpress-plugin

    String pnfpb_click_url = remoteMessage.getData().get("click_url");

    • This reply was modified 11 months, 1 week ago by Murali.
    Thread Starter mondaltapas567

    (@mondaltapas567)

    hi sir@murali-indiacitys ,

    actually when i giving input on custom url section then only url is passing through firebase which default selected from drop down list. I want only custom url not predefined

    Thread Starter mondaltapas567

    (@mondaltapas567)

    passing only home link

    Plugin Author Murali

    (@murali-indiacitys)

    iam looking into it, I will fix this problem soon in 1 or 2 days in next release. If you type your url ending with forward slash like https://www.website.com/pageone/ it is working. I will fix the problem on or before Monday

    Plugin Author Murali

    (@murali-indiacitys)

    Hi

    1.87 version is released with the fix to click url for custom one time push notification, it is also tested using webview android code, push notification click url from this PNFPB plugin is working. When external urls are used like for example bing.com is passed, it is working in mobile app after clicking on push notification, it is redirecting to external url within webview. In your android code(below mentioned code is in Java), please verify following things, if you app is written in other than Java, please create equivalent code like below mentioned for background state and for foreground state of app

    When app is in background/in off state then if you click on notification, click url needs to be received using intent by checking for key click_url

    @Override
        protected void onCreate(Bundle savedInstanceState) {
    
            super.onCreate(savedInstanceState);
            Bundle extras = getIntent().getExtras();
    
            if(extras != null){
                if(extras.containsKey("click_url"))
                {
                    intentUrl = extras.getString("click_url");
                }
            }
    
            mywebView.loadUrl(intentUrl);

    When app is in foreground then in class public class MyFirebaseMessagingService extends FirebaseMessagingService use code like below to get click_url remoteMessage.getData().get(“click_url”);

    Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
                String notificationTitle = remoteMessage.getNotification().getTitle();
                Uri notificationImage = remoteMessage.getNotification().getImageUrl();
                String notificationBody = remoteMessage.getNotification().getBody();
                String pnfpb_click_url = remoteMessage.getData().get("click_url");

    Following are release details of 1.87 version of PNFPB plugin

    1.87 version Apr 21 2024

    • Updated logic to have click url in one time custom push notification and for all push notifications using httpv1 Firebase api version under data array for webview.
    • Fixed problem on selecting page url from drop down list for one time push notification click url in admin settings one time push notification tab.
    • Regenerated pot file for text domain to have latest text strings.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘In android app Link url not working from custom notification’ is closed to new replies.