×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Super Contributor
    Join Date
    Nov 2010
    Posts
    1,228

    Cool In my toast notification I want to redireect to a URl with button/clickevent handler

    In my toast notification I want to redireect to a url or link with button/click event handler

    Add the event handler for the button. The button demonstrates navigating to Page 2, passing a parameter to indicate it navigated from MainPage.

    private void buttonNavigate_Click(object sender, RoutedEventArgs e)
    {
    this.NavigationService.Navigate(new Uri("/Page2.xaml?NavigatedFrom=Main Page", UriKind.Relative));

    }


    I mean when a toast notification is displayed and the my app is not Running I see a notification


    IC622598.png

    when I click on the notification on the top

    I want to re direct to a particular link in the browser or internet explorer


    How ?

  2. #2
    Super Contributor
    Join Date
    Nov 2010
    Posts
    1,228

    Cool I want to show my toast notificationmessage in two lines when App is not running

    I want to show my toast notification message in two lines when App is not running




    For example see my attached screeshot some of my message got trimmed and not shown in the toast notification or msg when the app is not running as below.


    error scrshot.jpg


    Please solve my query..

  3. #3
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    548

    Re: In my toast notification I want to redireect to a URl with button/clickevent hand

    The system Toast notifications can only link to within your app, not to any external app.

    An idea would be to use the URI to open a page within your app that uses the WebBrowser control to display the webpage?

    eg. "/ShowWebpage.xaml?url=http://somewhere.com/page-name"
    Last edited by theothernt; 2013-08-08 at 14:14.

  4. #4
    Super Contributor
    Join Date
    Nov 2010
    Posts
    1,228

    Re: In my toast notification I want to redireect to a URl with button/clickevent hand

    I have used ur code at MainPage.xaml.cs as



    private void buttonNavigate_Click(object sender, RoutedEventArgs e)
    {
    this.NavigationService.Navigate(new Uri("/ShowWebpage.xaml?url=http://www.yahoo.com/", UriKind.Relative));
    }


    and SendToast.aspx.cs

    as


    "<wp:Toast>" +
    "<wp:Text1>" + TextBoxTitle.Text.ToString() + "</wp:Text1>" + "\r" +

    "<wp:Text2>" + TextBoxSubTitle.Text.ToString() + "</wp:Text2>" +
    "<wp:Param>/ShowWebpage.xaml?url=http://www.yahoo.com</wp:Param>" +

    "</wp:Toast> " +


    It is just showing the message but not redirecting to the given url

  5. #5
    Super Contributor
    Join Date
    Nov 2010
    Posts
    1,228

    Re: In my toast notification I want to redireect to a URl with button/clickevent hand

    Creating a push client to receive toast notifications

    In this section, we create an app that runs on a Windows Phone that creates a push notification channel and handles toast notification events.
    Important noteImportant Note:

    For simplicity, we copy and paste the toast notification URI to our web page that sends the notification. Normally, this URI is passed to a web service you have created for your app.



    Based on the above statement I want to pass my URI to my webapage that sends the notification.

    I want to pass my URI to a web sevice I have craeted for my App.

    i.e a webpage/ website / a web link etc.
    Last edited by GTO_India; 2013-08-09 at 10:56.

  6. #6
    Super Contributor
    Join Date
    Nov 2010
    Posts
    1,228

    Cool How to show my total toast message in 2 to 3 lines etc when teh App is not running.

    I want to show my toast notification message in two lines when App is not running




    For example see my attached screeshot some of my message got trimmed and not shown in the toast notification or msg when the app is not running as below.


    I want to show the total msg at the top only when the App is not running.



    error scrshot.jpg

  7. #7
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    548

    Re: How to show my total toast message in 2 to 3 lines etc when teh App is not runni

    I don't think there is a way to show two lines in text in a toast, you have to keep the Title (Text1) and Content (Text2) very short

  8. #8
    Super Contributor
    Join Date
    Nov 2010
    Posts
    1,228

    Re: How to show my total toast message in 2 to 3 lines etc when teh App is not runni

    then what about redirecting to a url or webpage?

  9. #9
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    548

    Re: How to show my total toast message in 2 to 3 lines etc when teh App is not runni

    Quote Originally Posted by GTO_India View Post
    then what about redirecting to a url or webpage?
    As mentioned before, the only way to do that would be...

    1. Your app displays the webpage using the WebBrower control
    2. When your app loads, use the WebBrowserTask() to open the link in Internet Explorer

  10. #10
    Super Contributor
    Join Date
    Nov 2010
    Posts
    1,228

    Re: How to show my total toast message in 2 to 3 lines etc when teh App is not runni

    Can you be littel brief with example code as iam not clearly getting you.

  11. #11
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    548

    Re: How to show my total toast message in 2 to 3 lines etc when teh App is not runni

    Quote Originally Posted by GTO_India View Post
    Can you be littel brief with example code as iam not clearly getting you.
    Sure, the official documentation covers the first part - when a toast notification is tap on by the user, your app is launched a) on a particular page and b) with parameters from the URI you have to extract...

    http://msdn.microsoft.com/en-us/libr...Toastsinwpos71

    Once you have those parameters (ie. the URL of the webpage you want to visit), then either display the webpage using the WebBrowser control...

    http://msdn.microsoft.com/en-us/libr...v=vs.105).aspx

    Or use the WebBrowserTask which will move the user from your app to Internet Explorer...

    http://msdn.microsoft.com/en-us/libr...v=vs.105).aspx

  12. #12
    Super Contributor
    Join Date
    Nov 2010
    Posts
    1,228

    Re: How to show my total toast message in 2 to 3 lines etc when teh App is not runni

    Thank you very much for the information.

    Iam trying to implement them in my application of notification now.

  13. #13
    Super Contributor
    Join Date
    Nov 2010
    Posts
    1,228

    Re: How to show my total toast message in 2 to 3 lines etc when teh App is not runni

    notifications webbrowser.jpg



    As the above Iam seeing the keynotfoundexception error


    please confirm the code in XAML where and How to write for webbrowswer tasks etc.



    I have written in MainPage.xaml.cs

    protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
    {
    base.OnNavigatedTo(e);

    //ToDo: make sure not to open again the browser when returning to the app
    WebBrowserTask webBrowserTask = new WebBrowserTask();
    webBrowserTask.Uri = new Uri(this.NavigationContext.QueryString["urlValue"], UriKind.Absolute);
    webBrowserTask.Show();

    }


    And in SendToast.aspx as

    string toastMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
    "<wp:Notification xmlns:wp=\"WPNotification\">" +
    "<wp:Toast>" +
    "<wp:Text1>" + TextBoxTitle.Text.ToString() + "</Notification 1:Text1>" +
    "<wp:Text2>" + TextBoxSubTitle.Text.ToString() + "</Notification 2:Text2>" +
    "<wp:Param>/MyPushHandlingPage.xaml?urlValue=http://developer.nokia.com</wp:Param>" +
    "</wp:Toast> " +
    "</wp:Notification>";



    Anything to be written in MianPage.xaml too?


    How and where to define or declare urlValue ?

  14. #14
    Super Contributor
    Join Date
    Nov 2010
    Posts
    1,228

    Re: How to show my total toast message in 2 to 3 lines etc when teh App is not runni

    If I give in MainPage.xaml as


    webBrowserTask.Uri = new Uri("http://developer.nokia.com"], UriKind.Absolute);


    The webpage is opening now but in notificationclient app the URI
    is not given in the output like aerleir in order to send and recieve notifications.



    so thet we can send toast with the folowoing parameters
    URI

    TextTitle

    TextSubTitle

  15. #15
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    548

    Re: How to show my total toast message in 2 to 3 lines etc when teh App is not runni

    Quote Originally Posted by GTO_India View Post
    notifications webbrowser.jpg
    protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
    Can you print out (set a breakpoint) all the values inside NavigationContext?

    You may need to encode the Uri/Url first... http://msdn.microsoft.com/en-us/libr...=VS.95%29.aspx

Similar Threads

  1. [moved] Toast Message in Windows Phone
    By somnathbanik in forum Windows Phone General
    Replies: 5
    Last Post: 2013-10-07, 13:36
  2. How to create event handler for button in Java ME
    By abhishekpal in forum Mobile Java General
    Replies: 3
    Last Post: 2013-05-30, 14:33
  3. Button click handler
    By phpgenerator in forum Symbian User Interface
    Replies: 4
    Last Post: 2011-01-19, 11:00
  4. Qt N8/mobile version of Android Toast?
    By franklovecchio in forum Qt
    Replies: 0
    Last Post: 2010-12-03, 22:20
  5. Replies: 6
    Last Post: 2004-05-13, 06:39

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×