Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Regular Contributor
Posts: 66
Registered: ‎09-06-2011
My Device: 9930
My Carrier: 9930

passing data from one app to another

Hi,

           I have two blackberry applications i want to pass data from one application to other. can any one please provide me with some code snippet or any solution.

Developer
Posts: 16,612
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: passing data from one app to another

use http://www.blackberry.com/developers/docs/7.0.0api/net/rim/device/api/system/ApplicationManager.html...
to send,
http://www.blackberry.com/developers/docs/7.0.0api/net/rim/device/api/system/Application.html#addGlo...
to receive.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Regular Contributor
Posts: 66
Registered: ‎09-06-2011
My Device: 9930
My Carrier: 9930

Re: passing data from one app to another

Using postGlobalEvent data is posting succesfully but it is not received by eventOccoured method. do i need to launch data receiver application to get data pass to eventOccoured. also when i launnch some other app on device. it is observed that guid parameter of eventOccoured method receiving some long value. so pls help on this also posting the snippet for receiinf and posing data.

 

postGlobalEvent():

boolean post = false;

//String  Long =  "0xfb92ffc871a7a7c0L";        
            post = ApplicationManager.getApplicationManager().postGlobalEvent(0xfb92ffc871a7a7c0L);
            System.out.println(post);

 

eventOccoured():

 

 public void eventOccurred(long guid, int data0, int data1, Object obj0, Object obj1)
     {
         try
         {
            // long Long = "mypackage.ReceiveEvent";
         if(guid == 0xfb92ffc871a7a7c0L)
         {  
             System.out.println("event received");
             System.out.println("********************************"+obj0+"***************************");

Developer
Posts: 709
Registered: ‎09-10-2009
My Device: 8520, 8900, 9000, 9300, 9650, 9700, 9780, 9800, 9810, 9900, 9930
My Carrier: Verizon

Re: passing data from one app to another

If the app that is receiving the data has not been started, how would you expect to have eventOccoured fired. :smileyhappy: Oh, and yes, the first thing to do is to check the guid just to make sure that event is for the receiving app.

Regular Contributor
Posts: 66
Registered: ‎09-06-2011
My Device: 9930
My Carrier: 9930

Re: passing data from one app to another

thnks for reply,

                              is there any way so that i can pass the data without launching the app. and second thing is how do i check the guid whther it is for receiving app.

Developer
Posts: 709
Registered: ‎09-10-2009
My Device: 8520, 8900, 9000, 9300, 9650, 9700, 9780, 9800, 9810, 9900, 9930
My Carrier: Verizon

Re: passing data from one app to another


mandardeshmukh wrote:

thnks for reply,

                              is there any way so that i can pass the data without launching the app. and second thing is how do i check the guid whther it is for receiving app.


No. 

 

Check document for postGlobalEvent and you will understand.