public class CorePushManager
extends java.lang.Object
CORE PUSHの通知サービスを管理するクラス。CorePushManager
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COREPUSH_APP_LAUNCH_ANALYTICS_API
起動数登録API
|
static java.lang.String |
COREPUSH_APP_USER_ID_KEY
CORE PUSHのSharedPreferenceのアプリユーザーID保存用のキー
|
static java.lang.String |
COREPUSH_CATEGORY_IDS_KEY
CORE PUSHのSharedPreferenceの1次元カテゴリID保存用のキー
|
static java.lang.String |
COREPUSH_FCM_TOKEN_KEY
FCMのSharedPreferenceのトークン保存用のキー
|
static java.lang.String |
COREPUSH_GCM_TOKEN_KEY
GCMのSharedPreferenceのトークン保存用のキー
|
static java.lang.String |
COREPUSH_MULTI_CATEGORY_IDS_KEY
CORE PUSHのSharedPreferenceの2次元カテゴリID保存用のキー
|
static java.lang.String |
COREPUSH_NOTIFICATION_HISTORY_API
通知履歴取得API
|
static java.lang.String |
COREPUSH_REGIST_TOKEN_API
デバイストークン登録・削除API
|
static java.lang.String |
COREPUSH_REGISTRATION_TOKEN_REQUEST_FAIL
トークン登録失敗時のブロードキャスト名
|
static java.lang.String |
COREPUSH_REGISTRATION_TOKEN_REQUEST_SUCCESS
トークン登録成功時のブロードキャスト名
|
static java.lang.String |
COREPUSH_SHARED_PREFERENCE_NAME
CORE PUSH関連の値が保存されているSharedPreference名
|
static java.lang.String |
COREPUSH_TOKEN_SENT_TO_SERVER
トークンのサーバー送信済みフラグ用のキー
|
static java.lang.String |
COREPUSH_UNREGISTRATION_TOKEN_REQUEST_FAIL
トークン削除失敗時のブロードキャスト名
|
static java.lang.String |
COREPUSH_UNREGISTRATION_TOKEN_REQUEST_SUCCESS
トークン削除成功時のブロードキャスト名
|
static java.lang.String |
GOOGLE_GCM_SHARED_PREFERENCE_NAME
GCMのトークンが保存されているSharedPreference名
|
static int |
NOTIFICATION_STYLE_DIALOG
通知スタイルのダイアログ表示の定数
|
static int |
NOTIFICATION_STYLE_DIALOG_AND_STATUS_BAR
通知スタイルのダイアログとステータスバー表示の定数
|
static int |
NOTIFICATION_STYLE_STATUS_BAR
通知スタイルのステータスバー表示の定数
|
Modifier and Type | Method and Description |
---|---|
void |
deleteNotificationChannel(java.lang.String channelId) |
java.lang.Class<?> |
getActivity()
通知から起動するアクティビティを取得します。
ApplicationManifest.xmlのapplication要素内に定義したcom.coreasp.corepush.notificationLaunchActivityのmeta-dataタグから値を取得します。
値を取得できない場合は、CoreAspManager#initilizeの初期化時にIllegalArgumentExceptionをスローします。
|
java.lang.String |
getAppUserId()
アプリ内のユーザーIDを取得します。
|
java.util.List<java.lang.String> |
getCategoryIds()
1次元のカテゴリIDを取得します。
|
java.lang.String |
getChannelDescription()
Get the Channel Description.
|
java.lang.String |
getChannelId()
Get the Channel Id.
|
java.lang.String |
getChannelName()
Get the Channel Name.
|
java.lang.String |
getConfigKey()
設定キーを取得します。
ApplicationManifest.xmlのapplication要素内に定義したcom.coreasp.corepush.configKeyのmeta-dataタグから値を取得します。
値を取得できない場合は、CoreAspManager#initilizeの初期化時にIllegalArgumentExceptionをスローします。
|
java.lang.String |
getDate(android.content.Intent intent)
通知センターから起動するActivityでIntentから日時を取得します。
|
int |
getIconAccentColor()
Anroid5.0以上で有効な通知アイコンのアクセント色を取得します。
ApplicationManifest.xmlのapplication要素内に定義したcom.coreasp.corepush.iconAccentColorタグから値を取得します。
取得できない場合は、-1を返します。
|
int |
getIconResourceId()
通知アイコンのリソースIDを取得します。
ApplicationManifest.xmlのapplication要素内に定義したcom.coreasp.corepush.iconResourceIdのmeta-dataタグから値を取得します。
値を取得できない場合は、CoreAspManager#initilizeの初期化時にIllegalArgumentExceptionをスローします。
|
static CorePushManager |
getInstance()
CorePushManagerのインスタンスを取得します。
CoreAspManager#initializeを事前に呼び出していない場合は、RuntimeExceptionをスローします。
|
java.lang.String |
getMessage(android.content.Intent intent)
通知センターから起動するActivityでIntentからメッセージを取得します。
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getMultiCategoryIds()
2次元のカテゴリIDを取得します。
|
int |
getNotificationStyle()
通知スタイルを取得します。
ApplicationManifest.xmlのapplication要素内に定義したcom.coreasp.corepush.notificationStyleタグから値を取得します。
値を取得できない場合は、NOTIFICATION_STYLE_STATUS_BARの定数値を表す0を返します。
|
java.lang.String |
getPushId(android.content.Intent intent)
通知センターから起動するActivityでIntentから通知IDを取得します。
|
java.lang.String |
getTitle(android.content.Intent intent)
通知センターから起動するActivityでIntentからタイトルを取得します。
|
java.lang.String |
getToken()
デバイストークンを取得します。
|
java.lang.String |
getUrl(android.content.Intent intent)
通知センターから起動するActivityでIntentからURLを取得します。
|
boolean |
isNotificationCollapsed()
通知の複数表示の設定値を取得します。ステータスバーに最新の1件を表示する場合はtrue、複数件表示する場合はfalseの値が返ります。
ApplicationManifest.xmlのapplication要素内に定義したcom.coreasp.corepush.notificationCollapsedタグから値を取得します。
値を取得できない場合は、trueを返します。
|
boolean |
isShowBadge()
Get the Show Badge state for Push Notification
Obtain the value from the meta-data tag of com.coreasp.corepush.notificationChannelDescription
defined in the application element of ApplicationManifest.xml.
|
boolean |
isTokenSentToServer()
デバイストークンがCORE ASPサーバに登録済みか判断します。
SharedPreferenceのCOREPUSH_TOKEN_SENT_TO_SERVERキーに保存された値を返します。
アプリを新規にインストールした直後は、PreferenceのCOREPUSH_TOKEN_SENT_TO_SERVERキーに値が保存されていないため、以前のCORE ASPサーバへの
デバイストークンの登録の有無に関わらずfalseの値が返ります。
|
void |
registerToken()
CORE ASPサーバにデバイストークン登録します。
デバイストークンは、デバイストークンの登録成功後にPreferenceにCOREPUSH_FCM_TOKEN_KEYキーで保存されます。
また、その際にSharedPreferenceのCOREPUSH_TOKEN_SENT_TO_SERVERキーにデバイストークンの登録済みフラグがtrueで保存されます。
デバイストークンの登録が成功した場合は、COREPUSH_REGISTRATION_TOKEN_REQUEST_SUCCESSのキーでブロードキャスを行います。
デバイストークンの登録が失敗した場合は、COREPUSH_REGISTRATION_TOKEN_REQUEST_FAILのキーでブロードキャスを行います。
|
void |
setAppUserId(java.lang.String appUserId)
アプリ内のユーザーIDを設定します。
設定したユーザーIDは SharedPreferenceのCOREPUSH_APP_USER_ID_KEYキーで保存されます。
|
void |
setCategoryIds(java.util.List<java.lang.String> categoryIds)
1次元のカテゴリIDを設定します。
設定した1次元のカテゴリIDは SharedPreferenceのCOREPUSH_CATEGORY_IDS_KEYキーで保存されます。
|
void |
setMultiCategoryIds(java.util.Map<java.lang.String,java.util.List<java.lang.String>> multiCategoryIds)
2次元のカテゴリIDを設定します。
設定した2次元のカテゴリIDは SharedPreferenceのCOREPUSH_MULTI_CATEGORY_IDS_KEYキーで保存されます。
|
void |
unregisterToken()
CORE ASPサーバからデバイストークン削除します。
デバイストークン削除成功後に SharedPreferenceのCOREPUSH_FCM_TOKEN_KEYキーに保存されたデバイストークンを削除します。
また、その際にSharedPreferenceのCOREPUSH_TOKEN_SENT_TO_SERVERキーにデバイストークンの登録済みフラグがfalseで保存されます。
デバイストークンの削除が成功した場合は、COREPUSH_UNREGISTRATION_TOKEN_REQUEST_SUCCESSのキーでブロードキャストを行います。
デバイストークンの削除が失敗した場合は、COREPUSH_UNREGISTRATION_TOKEN_REQUEST_FAILのキーでブロードキャストを行います。
|
public static final int NOTIFICATION_STYLE_STATUS_BAR
public static final int NOTIFICATION_STYLE_DIALOG
public static final int NOTIFICATION_STYLE_DIALOG_AND_STATUS_BAR
public static final java.lang.String COREPUSH_SHARED_PREFERENCE_NAME
public static final java.lang.String GOOGLE_GCM_SHARED_PREFERENCE_NAME
public static final java.lang.String COREPUSH_FCM_TOKEN_KEY
public static final java.lang.String COREPUSH_GCM_TOKEN_KEY
public static final java.lang.String COREPUSH_APP_USER_ID_KEY
public static final java.lang.String COREPUSH_CATEGORY_IDS_KEY
public static final java.lang.String COREPUSH_MULTI_CATEGORY_IDS_KEY
public static final java.lang.String COREPUSH_TOKEN_SENT_TO_SERVER
public static final java.lang.String COREPUSH_REGISTRATION_TOKEN_REQUEST_SUCCESS
public static final java.lang.String COREPUSH_REGISTRATION_TOKEN_REQUEST_FAIL
public static final java.lang.String COREPUSH_UNREGISTRATION_TOKEN_REQUEST_SUCCESS
public static final java.lang.String COREPUSH_UNREGISTRATION_TOKEN_REQUEST_FAIL
public static final java.lang.String COREPUSH_NOTIFICATION_HISTORY_API
public static final java.lang.String COREPUSH_APP_LAUNCH_ANALYTICS_API
public static final java.lang.String COREPUSH_REGIST_TOKEN_API
public static CorePushManager getInstance()
CorePushManagerのインスタンスを取得します。 CoreAspManager#initializeを事前に呼び出していない場合は、RuntimeExceptionをスローします。
public boolean isShowBadge()
Get the Show Badge state for Push Notification Obtain the value from the meta-data tag of com.coreasp.corepush.notificationChannelDescription defined in the application element of ApplicationManifest.xml. This field is optional.
public java.lang.String getChannelDescription()
Get the Channel Description. Obtain the value from the meta-data tag of com.coreasp.corepush.notificationChannelDescription defined in the application element of ApplicationManifest.xml. This field is optional.
public java.lang.String getChannelId()
Get the Channel Id. Obtain the value from the meta-data tag of com.coreasp.corepush.notificationChannelId defined in the application element of ApplicationManifest.xml. 値を取得できない場合は、CoreAspManager#initilizeの初期化時にIllegalArgumentExceptionをスローします。
public java.lang.String getChannelName()
Get the Channel Name. Obtain the value from the meta-data tag of com.coreasp.corepush.notificationChannelName defined in the application element of ApplicationManifest.xml. 値を取得できない場合は、CoreAspManager#initilizeの初期化時にIllegalArgumentExceptionをスローします。
public java.lang.String getConfigKey()
設定キーを取得します。 ApplicationManifest.xmlのapplication要素内に定義したcom.coreasp.corepush.configKeyのmeta-dataタグから値を取得します。 値を取得できない場合は、CoreAspManager#initilizeの初期化時にIllegalArgumentExceptionをスローします。
public void setAppUserId(java.lang.String appUserId)
アプリ内のユーザーIDを設定します。 設定したユーザーIDは SharedPreferenceのCOREPUSH_APP_USER_ID_KEYキーで保存されます。
appUserId
- アプリ内のユーザーIDpublic java.lang.String getAppUserId()
アプリ内のユーザーIDを取得します。
public void setCategoryIds(java.util.List<java.lang.String> categoryIds)
1次元のカテゴリIDを設定します。 設定した1次元のカテゴリIDは SharedPreferenceのCOREPUSH_CATEGORY_IDS_KEYキーで保存されます。
categoryIds
- 1次元のカテゴリIDのリストpublic java.util.List<java.lang.String> getCategoryIds()
1次元のカテゴリIDを取得します。
public void setMultiCategoryIds(java.util.Map<java.lang.String,java.util.List<java.lang.String>> multiCategoryIds)
2次元のカテゴリIDを設定します。 設定した2次元のカテゴリIDは SharedPreferenceのCOREPUSH_MULTI_CATEGORY_IDS_KEYキーで保存されます。
multiCategoryIds
- 2次元のカテゴリIDのマップpublic java.util.Map<java.lang.String,java.util.List<java.lang.String>> getMultiCategoryIds()
2次元のカテゴリIDを取得します。
public java.lang.Class<?> getActivity()
通知から起動するアクティビティを取得します。 ApplicationManifest.xmlのapplication要素内に定義したcom.coreasp.corepush.notificationLaunchActivityのmeta-dataタグから値を取得します。 値を取得できない場合は、CoreAspManager#initilizeの初期化時にIllegalArgumentExceptionをスローします。
public int getIconResourceId()
通知アイコンのリソースIDを取得します。 ApplicationManifest.xmlのapplication要素内に定義したcom.coreasp.corepush.iconResourceIdのmeta-dataタグから値を取得します。 値を取得できない場合は、CoreAspManager#initilizeの初期化時にIllegalArgumentExceptionをスローします。
public int getIconAccentColor()
Anroid5.0以上で有効な通知アイコンのアクセント色を取得します。 ApplicationManifest.xmlのapplication要素内に定義したcom.coreasp.corepush.iconAccentColorタグから値を取得します。 取得できない場合は、-1を返します。
public int getNotificationStyle()
通知スタイルを取得します。 ApplicationManifest.xmlのapplication要素内に定義したcom.coreasp.corepush.notificationStyleタグから値を取得します。 値を取得できない場合は、NOTIFICATION_STYLE_STATUS_BARの定数値を表す0を返します。
public boolean isNotificationCollapsed()
通知の複数表示の設定値を取得します。ステータスバーに最新の1件を表示する場合はtrue、複数件表示する場合はfalseの値が返ります。 ApplicationManifest.xmlのapplication要素内に定義したcom.coreasp.corepush.notificationCollapsedタグから値を取得します。 値を取得できない場合は、trueを返します。
public void registerToken()
CORE ASPサーバにデバイストークン登録します。 デバイストークンは、デバイストークンの登録成功後にPreferenceにCOREPUSH_FCM_TOKEN_KEYキーで保存されます。 また、その際にSharedPreferenceのCOREPUSH_TOKEN_SENT_TO_SERVERキーにデバイストークンの登録済みフラグがtrueで保存されます。 デバイストークンの登録が成功した場合は、COREPUSH_REGISTRATION_TOKEN_REQUEST_SUCCESSのキーでブロードキャスを行います。 デバイストークンの登録が失敗した場合は、COREPUSH_REGISTRATION_TOKEN_REQUEST_FAILのキーでブロードキャスを行います。
public void unregisterToken()
CORE ASPサーバからデバイストークン削除します。 デバイストークン削除成功後に SharedPreferenceのCOREPUSH_FCM_TOKEN_KEYキーに保存されたデバイストークンを削除します。 また、その際にSharedPreferenceのCOREPUSH_TOKEN_SENT_TO_SERVERキーにデバイストークンの登録済みフラグがfalseで保存されます。 デバイストークンの削除が成功した場合は、COREPUSH_UNREGISTRATION_TOKEN_REQUEST_SUCCESSのキーでブロードキャストを行います。 デバイストークンの削除が失敗した場合は、COREPUSH_UNREGISTRATION_TOKEN_REQUEST_FAILのキーでブロードキャストを行います。
public boolean isTokenSentToServer()
デバイストークンがCORE ASPサーバに登録済みか判断します。 SharedPreferenceのCOREPUSH_TOKEN_SENT_TO_SERVERキーに保存された値を返します。 アプリを新規にインストールした直後は、PreferenceのCOREPUSH_TOKEN_SENT_TO_SERVERキーに値が保存されていないため、以前のCORE ASPサーバへの デバイストークンの登録の有無に関わらずfalseの値が返ります。
public java.lang.String getDate(android.content.Intent intent)
通知センターから起動するActivityでIntentから日時を取得します。
intent
- 通知センターから起動するActivityのIntentpublic java.lang.String getToken()
デバイストークンを取得します。
public java.lang.String getTitle(android.content.Intent intent)
通知センターから起動するActivityでIntentからタイトルを取得します。
intent
- 通知センターから起動するActivityのIntentpublic java.lang.String getMessage(android.content.Intent intent)
通知センターから起動するActivityでIntentからメッセージを取得します。
intent
- 通知センターから起動するActivityのIntentpublic java.lang.String getUrl(android.content.Intent intent)
通知センターから起動するActivityでIntentからURLを取得します。
intent
- 通知センターから起動するActivityのIntentpublic java.lang.String getPushId(android.content.Intent intent)
通知センターから起動するActivityでIntentから通知IDを取得します。
intent
- 通知センターから起動するActivityのIntentpublic void deleteNotificationChannel(java.lang.String channelId)