com.backendless.messaging.PushBroadcastMask Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons Show documentation
Show all versions of commons Show documentation
Commons lib for both server and client Java/Android SDKs
The newest version!
/*
* ********************************************************************************************************************
*
* BACKENDLESS.COM CONFIDENTIAL
*
* ********************************************************************************************************************
*
* Copyright 2012 BACKENDLESS.COM. All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains the property of Backendless.com and its suppliers,
* if any. The intellectual and technical concepts contained herein are proprietary to Backendless.com and its
* suppliers and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret
* or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden
* unless prior written permission is obtained from Backendless.com.
*
* ********************************************************************************************************************
*/
package com.backendless.messaging;
import java.util.StringTokenizer;
public class PushBroadcastMask
{
public static final int IOS = 1;
public static final int ANDROID = 1 << 1;
public static final int WP = 1 << 2;
public static final int OSX = 1 << 3;
public static final int ALL = IOS | ANDROID | WP | OSX;
public static int toIntMask( String pushBroadcast )
{
if( pushBroadcast == null )
return 0;
pushBroadcast = pushBroadcast.toUpperCase();
StringTokenizer st = new StringTokenizer( pushBroadcast, "| " );
int maskedValue = 0;
while( st.hasMoreTokens() )
{
String token = st.nextToken();
if( "IOS".equals( token ) )
maskedValue |= IOS;
else if( "ANDROID".equals( token ) )
maskedValue |= ANDROID;
else if( "WP".equals( token ) )
maskedValue |= WP;
else if( "OSX".equals( token ) )
maskedValue |= OSX;
else if( "ALL".equals( token ) )
maskedValue |= ALL;
}
return maskedValue;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy