incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aurelien MERCIER (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CB-923) SplashScreen doesn't hide while getting push notification
Date Fri, 15 Jun 2012 20:59:42 GMT

    [ https://issues.apache.org/jira/browse/CB-923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295920#comment-13295920
] 

Aurelien MERCIER edited comment on CB-923 at 6/15/12 8:59 PM:
--------------------------------------------------------------

Sure, here is the story: we can send direct messages from our application. When receiving
a push, when we click on it it will launch our app with an argument, the name of the community.
Then we can open the right community directly in the inbox page with the content message.


Concerning the implementation, we followed the google instructions detailed here: https://developers.google.com/android/c2dm/
and we had to implement the following method to process a push:
{code}
private void processPushNotification(Context context, Intent intent) {
        String hostname = intent.getStringExtra(Constants.HOSTNAME_PARAMETER_NAME);
        if (shouldShowNotification(hostname)) {
            NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
            int icon = R.drawable.icon;
            String message = intent.getStringExtra(Constants.MESSAGE_PARAMETER_NAME);
            Notification notification = new Notification(icon, message, System.currentTimeMillis());
            notification.flags = Notification.FLAG_AUTO_CANCEL;
            notification.defaults = Notification.DEFAULT_ALL;

            String community = intent.getStringExtra(Constants.COMMUNITY_PARAMETER_NAME);
            int unreadCount = Integer.parseInt(intent.getStringExtra(Constants.UNREAD_COUNT_PARAMETER_NAME));

            String contentText = unreadCount > 1 ? String.format("%d unread items", unreadCount)
: message;
            Intent notificationIntent = new Intent(context, JiveMobileActivity.class);
            Bundle bundle = Helper.buildBundleFromNotificationIntent(intent);
            notificationIntent.putExtra(Constants.NOTIFICATION_BUNDLE, bundle);
            notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
            notification.setLatestEventInfo(context, community, contentText, contentIntent);
            notificationManager.notify(hostname, Constants.JIVE_MOBILE_ACTIVITY_NOTIFICATION_ID,
notification);
        }
    }
{code}
JiveMobileActivity is the main class extending DroidGap.

Thanks,

                
      was (Author: quanta):
    Sure, here is the story: we can send direct messages from our application. When receiving
a push, when we click on it it will launch our app with an argument, the name of the community.
Then we can open the right community directly in the inbox page with the content message.


Concerning the implementation, we followed the google instructions detailed here: https://developers.google.com/android/c2dm/
and we had to implement the following method to process a push:

private void processPushNotification(Context context, Intent intent) {
        String hostname = intent.getStringExtra(Constants.HOSTNAME_PARAMETER_NAME);
        if (shouldShowNotification(hostname)) {
            NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
            int icon = R.drawable.icon;
            String message = intent.getStringExtra(Constants.MESSAGE_PARAMETER_NAME);
            Notification notification = new Notification(icon, message, System.currentTimeMillis());
            notification.flags = Notification.FLAG_AUTO_CANCEL;
            notification.defaults = Notification.DEFAULT_ALL;

            String community = intent.getStringExtra(Constants.COMMUNITY_PARAMETER_NAME);
            int unreadCount = Integer.parseInt(intent.getStringExtra(Constants.UNREAD_COUNT_PARAMETER_NAME));

            String contentText = unreadCount > 1 ? String.format("%d unread items", unreadCount)
: message;
            Intent notificationIntent = new Intent(context, JiveMobileActivity.class);
            Bundle bundle = Helper.buildBundleFromNotificationIntent(intent);
            notificationIntent.putExtra(Constants.NOTIFICATION_BUNDLE, bundle);
            notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
            notification.setLatestEventInfo(context, community, contentText, contentIntent);
            notificationManager.notify(hostname, Constants.JIVE_MOBILE_ACTIVITY_NOTIFICATION_ID,
notification);
        }
    }

JiveMobileActivity is the main class extending DroidGap.

Thanks,

                  
> SplashScreen doesn't hide while getting push notification
> ---------------------------------------------------------
>
>                 Key: CB-923
>                 URL: https://issues.apache.org/jira/browse/CB-923
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 1.7.0
>            Reporter: Aurelien MERCIER
>            Assignee: Joe Bowser
>
> After rebuilding cordova 1.7.0 and having put some log around spashscreen, I saw that
hide function doesn't work when receiving a push notification that will launch our app(same
with the timeout). I saw that you will refactor the code outside droid gap, if it becomes
a plugin it should solved the problem since it will be a new intent? Right now putting the
splashDialog static volatile solve the problem on most droid phones except the one with ICS
4.0.3...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message