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
Contributor
Posts: 24
Registered: ‎05-19-2011
My Device: Blackberry storm
My Carrier: verizon

urban airhsip for push notification not coming to foreground

Hi friends,

 

 

I am using urban airhsip for push notification. I am calling an autostartup for registeration of RIM push key.  the issue is it doesnt comes to foreground. but background process working fine. The code i am using is shown below.

 

I am using jde 6.0

 

Thanks in advance.

 

Regards,

Sathish

 

 

 

public static void main(String[] args) {
     UrbanAirshipMain nd = new UrbanAirshipMain();
    
        if( args.length > 0 && args[ 0 ].equals( "autostartup" ) )
     {
         // Register push application
         nd.registerPushApplication();
         // Create background process on device restart, no UI
         nd.enterEventDispatcher();
     }
        else
     {
         // Display the User Interface on foreground starts
         nd.showGUI();
     }
    }
/**
* Shows the user interface and instantiates the event dispatcher.
*/
    public void showGUI() {
     // So we can see the app.
     acceptsForeground = true;
     _uiApp.requestForeground();
    
     String model = DeviceInfo.getDeviceName();
        Util.debugPrint(URBAN_AIRSHIP_MAIN, "Model: " + model);
        
        // So we can receive alerts from the notification thread
        addGlobalEventListener(this);
        // Register our PIN with Urban Airship
Thread t0 = new Thread() {
public void run() {
if (UrbanAirshipStore.isPushEnabled().booleanValue()==true) {
// Register our Device PIN with Urban Airship (without Alias)
// UrbanAirshipAPI.urbanAirshipRegisterPIN();
// Register our Device PIN with Urban Airship (with Alias)
UrbanAirshipAPI.urbanAirshipRegisterPINWithAlias("My Device");
}
else {
// Un-Register our Device PIN with Urban Airship
UrbanAirshipAPI.urbanAirshipUnRegisterPIN();
}
}
};
t0.start();
_uiApp._hs = new UAHomeScreen();
UiApplication.getUiApplication().pushScreen(_uiApp._hs);
        // Prompt for app permissions
        promptPermissions();
// Enter event dispatcher
        enterEventDispatcher();


BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: urban airhsip for push notification not coming to foreground

You mean come to the foreground when you click on the icon?  Have you created an alternate entry point for this?  Where is _uiApp set?  

 

Set up an alternate entry point for an application

http://supportforums.blackberry.com/t5/Java-Development/Set-up-an-alternate-entry-point-for-an-appli...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Contributor
Posts: 24
Registered: ‎05-19-2011
My Device: Blackberry storm
My Carrier: verizon

Re: urban airhsip for push notification not coming to foreground

[ Edited ]

Yes sohm,

 

I created a alternate entry point according the your attached link already.

 

My full java code of main can be accessed in the following link

https://github.com/urbanairship/bb-push-sample-os5/blob/master/com/urbanairship/pushclient/UrbanAirs...

 

My problem is some time  it come to foreground process in normal  & some time it takes very long time to come to foreground process.  It makes the blackberry homescreen freeze.

 

I set project properties according urban airship blackberry_app_descriptor.xml and created the alternate point.

 

 

Regards,

Sathish

BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: urban airhsip for push notification not coming to foreground

I'm not familiar with urban airship.  What action triggers the delayed foregrounding of your application?  Clicking on the icon or does something else bring it up?

 

Have you stepped through or profiled the code to see what line is causing the delay?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker