Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8720491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:03:14+00:00 2026-06-13T07:03:14+00:00

In my application when I send a request to any friend using this code..

  • 0

In my application when I send a request to any friend using this code..

try {               
                roster.createEntry(idExtension, nickname, null);
                roster.setSubscriptionMode(Roster.SubscriptionMode.manual);
                Presence subscribe = new Presence(Presence.Type.subscribe);
                subscribe.setTo(idExtension);               
                connection.sendPacket(subscribe);


                return true;
            } catch (XMPPException e) {
                System.err.println("Error in adding friend");
                return false;
            }

then the subscription says “NONE” in both the friends rosters.

But it should be “TO” and “FROM”.

But if For the same process I use this code –

try {               
                roster.createEntry(idExtension, nickname, null);
                roster.setSubscriptionMode(Roster.SubscriptionMode.manual);
                Presence subscribed = new Presence(Presence.Type.subscribed);
                subscribed.setTo(idExtension);              
                connection.sendPacket(subscribed);


                return true;
            } catch (XMPPException e) {
                System.err.println("Error in adding friend");
                return false;
            }

Then it gives me right result which i should get in the previous case.

Please tell me why I am not getting the same in SUBSCRIBE mode.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:03:16+00:00Added an answer on June 13, 2026 at 7:03 am

    I guess you are not getting the meaning of type in Presence.

    subscribe — The sender wishes to subscribe to the recipient’s
    presence.

    subscribed — The sender has allowed the recipient to
    receive their presence.

    So when you send the first one you request a user to let you subscribe to his presence events and until he has not allowed you to do so the subscription type is none.

    In second case you allowed the user to subscribe to your presence, that is you give him permission to listen to your presence, and thus you get the subscription type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to write application who send email using outlook and i found this
I am using the follwing code to send SOAP request. String str = new
Scenario: User A send application request to user B User B accepts request after
On my MVC spring application I send a form to a page using post
i want to send request to Google analytics in non web based application(Windows based
I have this simple html piece of code, whenever I click on any of
I've got a problem trying to send a request using QNetworkAccessManager from a QObject
Is there any known way to send a new SOAP request from one servlet
If I use Ajax to send request and this request take long time .....
I am using new facebook sdk 3.0 to send app request and some data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.