Language
JavaClass
AIBeaconManager
AIBeaconManager
クラスは、 AIBeacon 機能全般を管理します。AIBeaconManager
class manages general AIBeacon functions.Initializer
init
Initializes an
At the same time, it generates sharing instances. instance by using
AIBeaconManager
object.At the same time, it generates sharing instances. instance by using
sharedInstance
.Declaration
public static AIBeaconManager init(Context context, String appId, String apiKey)
Parameters
context
Context
AIBeaconManager
で利用するコンテキストを設定します。Context used inAIBeaconManager
.appId
String
- 弊社から提供するアプリ ID を設定します。Set App id we provide.
apiKey
String
- 弊社から提供する API キーを設定します。Set API key we provide.
Return Value
初期化された
AIBeaconManager
オブジェクトを返します。Returns an initialized AIBeaconManager
object.Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.7.2+
Example
AIBeaconManager aiBeaconManager = AIBeaconManager.init(this, "[Your App ID]", "[Your API Key]");
Initializer
init
Initializes an
At the same time, it generates sharing instances. instance by using
AIBeaconManager
object.At the same time, it generates sharing instances. instance by using
sharedInstance
.Declaration
public static AIBeaconManager init(Context context, String appId, String apiKey, Map<String, Object> options)
Parameters
context
Context
AIBeaconManager
で利用するコンテキストを設定します。Context used inAIBeaconManager
.appId
String
- 弊社から提供するアプリ ID を設定します。Set App id we provide.
apiKey
String
- 弊社から提供する API キーを設定します。Set API key we provide.
options
Map<String, Object>
- オプションを設定します。
使用できるオプションは AIBeacon Manager Initialization Options を参照下さい。Set Options.
Refer AIBeacon Manager Initialization Options for options you can use.
Return Value
初期化された
AIBeaconManager
オブジェクトを返します。Returns an initialized AIBeaconManager
object.Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.7.2+
Example
Map<String, Object> options = new HashMap<String, Object>();
AIBeaconManager aiBeaconManager = AIBeaconManager.init(this, "[Your App ID]", "[Your API Key]", options);
Public Field
requestPermissionsTargetActivity
パーミッション要求ダイアログボックスの表示先アクティビティ。
Activity for displaying a permission request dialog box.
Declaration
public Activity requestPermissionsTargetActivity = null;
Discussion
必要なパーミッションを要求するダイアログボックスの、表示先のアクティビティを設定、または取得します。デフォルトは
Android
Importantこのプロパティに
その
正常に動作させるには、
null
です。Android
6.0
以降の場合のみ有効です。 (Android 6.0
未満の場合に使用しても問題は発生しません)Importantこのプロパティに
null
が設定されている場合は、 init(Context,String,String,String)
または init(Context,String,String,String,Map)
で設定された Context
が使用されます。その
Context
が Activity
のコンテキストではない場合は正常に動作しません。正常に動作させるには、
Activity
のコンテキストを init
の Context
に設定する必要があります。You can set or get the activity for displaying a permission request dialog. The default value is null.
This activity is valid in the case of Android
ImportantIn the case where this property is set to
If the
In order to avoid the error, You need to set the
This activity is valid in the case of Android
6.0
or above. (No problem occurs even if you use this property for Android before 6.0
)ImportantIn the case where this property is set to
null
, the SDK uses the Context
which is set in init(Context,String,String,String)
or init(Context,String,String,String,Map)
.If the
Context
is not of an Activity
, it occurs an error.In order to avoid the error, You need to set the
Context
of an Activity
to that in init.Availability
SDK 1.4.0+
Example
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
AIBeaconManager.sharedInstance().requestPermissionsTargetActivity = this;
}
}
Public Method
aiBeacons
領域内の AIBeacon 情報のリストを取得します。
Gets the list of AIBeacon information in the region.
Declaration
public AIContactInfo[] aiBeacons()
Return Value
現在領域内にある AIBeacon 情報のリストを返します。Returns the list of AIBeacon information in the region.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.4.0+
Example
AIContactInfo[] aiBeacons = AIBeaconManager.sharedInstance().aiBeacons();
Public Static Method
checkPermissionsGranted
要求されたパーミッションが許可されたかどうかを確認します。
Checks whether the requested permission is granted.
Declaration
@RequiresApi(24)
public static boolean checkPermissionsGranted(int requestCode, String[] permissions, int[] grantResults)
Parameters
requestCode
int
- 確認するパーミッションの要求コードを設定します。
要求コードは AIBeacon Permissions Request Codes を参照下さい。Request code of the permission to confirm.
Refer the document AIBeacon Permissions Request Codes for the request codes. permissions
String[]
- 要求されたパーミッションを設定します。Requested permissions.
grantResults
Boolean[]
- 要求されたパーミッションの許可結果を設定します。Grant results of the requested permissions.
Return Value
許可された場合は
true
を、許可されなかった場合は false
を返します。Returns true
if the permissions are granted, and returns false
if they are not granted.Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.11.2+
Example
// パーミッション要求結果受け取り用の ActivityResultLauncher を設定します。
@TargetApi(24)
ActivityResultLauncher<String[]> requestPermissionsResultLauncher = registerForActivityResult(
new ActivityResultContracts.RequestMultiplePermissions(),
results -> {
String[] permissions = results.keySet().toArray(new String[0]);
Boolean[] grantResults = results.values().toArray(new Boolean[0]);
if (AIBeaconManager.checkPermissionsGranted(
AIBeaconPermissionsRequestCode.AIBeaconScan, permissions, grantResults
)) {
// AIBeacon の領域監視を開始する。
AIBeaconManager.sharedInstance().startAiBeaconMonitoring();
}
}
);
// Set up an ActivityResultLauncher to receive the results of a permission request.
@TargetApi(24)
ActivityResultLauncher<String[]> requestPermissionsResultLauncher = registerForActivityResult(
new ActivityResultContracts.RequestMultiplePermissions(),
results -> {
String[] permissions = results.keySet().toArray(new String[0]);
Boolean[] grantResults = results.values().toArray(new Boolean[0]);
if (AIBeaconManager.checkPermissionsGranted(
AIBeaconPermissionsRequestCode.AIBeaconScan, permissions, grantResults
)) {
// Starts monitoring the region of AIBeacon.
AIBeaconManager.sharedInstance().startAiBeaconMonitoring();
}
}
);
Public Static Method
checkPermissionsGranted
要求されたパーミッションが許可されたかどうかを確認します。
Checks whether the requested permission is granted.
Declaration
public static boolean checkPermissionsGranted(int requestCode, String[] permissions, int[] grantResults)
Parameters
requestCode
int
- 確認するパーミッションの要求コードを設定します。
要求コードは AIBeacon Permissions Request Codes を参照下さい。Request code of the permission to confirm.
Refer the document AIBeacon Permissions Request Codes for the request codes. permissions
String[]
- 要求されたパーミッションを設定します。Requested permissions.
grantResults
int[]
- 要求されたパーミッションの許可結果を設定します。Grant results of the requested permissions.
Return Value
許可された場合は
true
を、許可されなかった場合は false
を返します。Returns true
if the permissions are granted, and returns false
if they are not granted.Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.4.0+
Example
// 要求されたパーミッションの許可結果を受け取った際に呼び出されます。
@Override
@TargetApi(23)
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
if (AIBeaconManager.checkPermissionsGranted(AIBeaconPermissionsRequestCode.AIBeaconScan, permissions, grantResults)) {
// AIBeacon の領域監視を開始する。
AIBeaconManager.sharedInstance().startAiBeaconMonitoring();
}
}
// Called when the grant results of the requested permissions are received.
@Override
@TargetApi(23)
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
if (AIBeaconManager.checkPermissionsGranted(AIBeaconPermissionsRequestCode.AIBeaconScan, permissions, grantResults)) {
// Starts monitoring the area of AIBeacons.
AIBeaconManager.sharedInstance().startAiBeaconMonitoring();
}
}
Public Methods
getRequestPermissionsTargetActivity
パーミッション要求ダイアログボックスの表示先アクティビティを取得します。
Get the activity for displaying a permission request dialog box.
Declaration
public Activity getRequestPermissionsTargetActivity()
Return Value
パーミッション要求ダイアログボックスの表示先アクティビティを返します。Activity for displaying a permission request dialog box.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.5.0+
Example
Activity activity = AIBeaconManager.sharedInstance().getRequestPermissionsTargetActivity();
Public Method
isDebugEnabled
デバッグモードの有効/無効を表します。
Indicates whether debug mode is enabled / disabled.
Declaration
public boolean isDebugEnabled()
Return Value
デバッグモードが有効の場合は
true
、無効の場合は false
を返します。Returns true
if debug mode is enabled, false
if it is disabled.Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.7.0+
Example
boolean isDebugEnabled = AIBeaconManager.sharedInstance().isDebugEnabled();
Public Method
numberOfAiBeacons
領域内の AIBeacon 情報の数を取得します。
Gets the number of AIBeacon information in the region.
Declaration
public int numberOfAiBeacons()
Return Value
現在領域内にある AIBeacon 情報の数を返します。Returns the current number of AIBeacon information in the region.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.4.0+
Example
int count = AIBeaconManager.sharedInstance().numberOfAiBeacons();
Public Method
registerService
AIBeacon サービスへの登録を行います。既に登録されている場合は更新が行われます。
Note is renamed to
AIBeaconManager
の初期化後に必ず呼び出して下さい。Note
registerDevice
registerService
since SDK 1.4.0
.Registers to AIBeacon service. If the instance has already registered, it renews the registration.
You need to call it certainly after initializing
Note is renamed to
You need to call it certainly after initializing
AIBeaconManager
.Note
registerDevice
registerService
since SDK 1.4.0
.Declaration
public void registerService()
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.0.0+
Example
// AIBeacon サービスへの登録を行う。
AIBeaconManager.sharedInstance().registerService();
// Registers to AIBeacon service.
AIBeaconManager.sharedInstance().registerService();
Public Method
registerService
AIBeacon サービスへ FCM 登録トークン の登録を行います。
既に登録されている場合は更新が行われます。
ImportantAIBeacon のプッシュ通知機能を有効にした後に
既に登録されている場合は更新が行われます。
ImportantAIBeacon のプッシュ通知機能を有効にした後に
registerService()
メソッドを呼び出すことで、 FCM 登録トークン を自動で取得して登録することができます。Registers the FCM registration token to AIBeacon service.
If the token has been already registered, it renews the registration.
ImportantIf you call the
If the token has been already registered, it renews the registration.
ImportantIf you call the
registerService()
method after enabling the push notification of AIBeacon, you can get FCM registration token and register automatically.Declaration
public void registerService(final String registrationToken)
Parameters
registrationToken
String
- FCM の 登録トークン を設定します。Sets the registration token of FCM.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.4.0+
Example
AIBeaconManager.sharedInstance().registerService("[FCM 登録トークン]");
AIBeaconManager.sharedInstance().registerService("[FCM registration token]");
Public Methods
setCustomParameters
AIBeacon サーバに送信するカスタムパラメータをまとめて設定します。
Configures custom parameters sending to the AIBeacon server at once.
Declaration
public void setCustomParameters(Map<String, Object> params)
Parameters
params
Map<String, Object>
- カスタムパラメータのキーと値のペアを設定します。Sets pairs of the key and value of the custom parameter.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.3.0+
Example
AIBeaconManager.sharedInstance().setCustomParameters(new HashMap<String, Object>() {{
put("UserID", "123");
put("Gender", "female");
}});
Public Methods
setCustomParameter
AIBeacon サーバに送信するカスタムパラメータを設定します。
Sets a custom parameter sending to the AIBeacon server.
Declaration
public void setCustomParameter(final String key, final Object value)
Parameters
key
String
- カスタムパラメータのキーを設定します。Sets the key of the custom parameter.
value
Object
- カスタムパラメータの値を設定します。Sets the value of the custom parameter.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.3.0+
Example
AIBeaconManager.sharedInstance().setCustomParameter("UserID", "123");
Public Method
setDebugEnabled
デバッグモードを有効にするかどうかを設定します。
デバッグモードを有効にすることで各種デバッグログが出力されるようになります。
デフォルトは無効です。
Importantこのメソッドは
また、リリースバージョンのアプリではデバッグモードを有効にしないで下さい。
デバッグモードを有効にすることで各種デバッグログが出力されるようになります。
デフォルトは無効です。
Importantこのメソッドは
AIBeaconManager
の初期化後に呼び出して下さい。AIBeaconManager
の初期化時のログも出力したい場合は、 AIBeaconManagerInitOption.Keys.DebugEnabled を使用してデバッグモードを有効にして下さい。また、リリースバージョンのアプリではデバッグモードを有効にしないで下さい。
Enables the debug mode.
Various debug logs will be output by enabling the debug mode.
It is disabled by default.
ImportantThis method should be called after initialization of
If you also want to output the log when initializing
Please do not enable debug mode in released version of application.
Various debug logs will be output by enabling the debug mode.
It is disabled by default.
ImportantThis method should be called after initialization of
AIBeaconManager
.If you also want to output the log when initializing
AIBeaconManager
, please use AIBeaconManagerInitOption.Keys.DebugEnabled to enable debug mode.Please do not enable debug mode in released version of application.
Declaration
public void setDebugEnabled(final boolean enabled)
Parameters
enabled
boolean
- 有効にする場合は
true
を、無効にする場合はfalse
を設定します。Settrue
if you want to enable, and setfalse
otherwise.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.7.0+
Example
AIBeaconManager.sharedInstance().setDebugEnabled(true);
Public Method
setNotificationOpenActivityName
通知をタップした際に起動するアクティビティ名を設定します。
Name of the Activity which starts when the notification is tapped.
Declaration
public void setNotificationOpenActivityName(String activityName)
Parameters
activityName
String
- パッケージ名を含んだアクティビティ名を設定します。Name of the Activity including the package name.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.0.0+
Example
AIBeaconManager.sharedInstance().setNotificationOpenActivityName(this.getClass().getName());
Public Method
setNotificationSmallIconId
通知バーに表示するアイコンを設定します。
Configures the icon shown in the notification bar.
Declaration
public void setNotificationSmallIconId(int smallIconId)
Parameters
smallIconId
int
- アイコンのリソース ID を設定します。Sets the resource id of the icon.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.0.0+
Example
AIBeaconManager.sharedInstance().setNotificationSmallIconId(R.drawable.notification_small_icon);
Public Method
setPushNotificationEnabled
AIBeacon のプッシュ通知機能を有効にするかどうかを設定します。
Configures whether the push notification of AIBeacon is enabled.
Declaration
public void setPushNotificationEnabled(boolean enabled)
Parameters
enabled
boolean
- 有効にする場合は
true
を、無効にする場合はfalse
を設定します。Settrue
if you want to enable it, and setfalse
otherwise.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.4.0+
Example
AIBeaconManager.sharedInstance().setPushNotificationEnabled(true);
Public Methods
setRequestPermissionsTargetActivity
パーミッション要求ダイアログボックスの表示先アクティビティを設定します。
Set the activity for displaying a permission request dialog box.
Declaration
public void setRequestPermissionsTargetActivity(Activity activity)
Parameters
activity
Activity
- パーミッション要求ダイアログボックスの表示先アクティビティを設定します。Set the activity for displaying a permission request dialog box.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.5.0+
Example
AIBeaconManager.sharedInstance().setRequestPermissionsTargetActivity(this);
Public Method
setServerTransmissionCycleForContactInfo
AIBeacon 接触情報のサーバ送信周期を設定します。
Sets the server transmission cycle of AIBeacon contact information.
Declaration
public void setServerTransmissionCycleForContactInfo(int seconds)
Parameters
seconds
int
- サーバ送信周期を秒単位で設定します。
最小値は15
秒で、それを下回る値は自動的に最小値に置き換わります。
デフォルトは3600
秒です。Sets the server transmission cycle in seconds.
The minimum value is15
seconds, and values below it are automatically replaced by the minimum value.
The default is3600
seconds.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.6.0+
Example
AIBeaconManager.sharedInstance().setServerTransmissionCycleForContactInfo(30);
Public Static Method
sharedInstance
AIBeaconManager
の共有インスタンスを返します。Returns a shared instance of
AIBeaconManager
.Declaration
public static AIBeaconManager sharedInstance()
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.0.0+
Example
AIBeaconManager aiBeaconManager = AIBeaconManager.sharedInstance();
Public Method
startAiBeaconMonitoring
AIBeacon の領域監視を開始します。
デバイスの OS が Android
デバイスの OS が Android
6.0
以降の場合、このメソッドを呼び出した直後に、必要なパーミッションを要求するダイアログボックスが表示されます。Starts monitoring of AIBeacon.
In the case where the device's OS is Android
In the case where the device's OS is Android
6.0
or above, a dialog box which requests the necessary permission is shown immediately after this method is called.Declaration
public void startAiBeaconMonitoring
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.1.0+
Example
AIBeaconManager.sharedInstance().startAiBeaconMonitoring();
Public Method
stopAiBeaconMonitoring
AIBeacon の領域監視を停止します。
Stops monitoring of AIBeacon.
Declaration
public void stopAiBeaconMonitoring
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.10.1+
Example
AIBeaconManager.sharedInstance().stopAiBeaconMonitoring();
Public Method
onResume
通知センターの通知からアプリを起動するために使用します。
ImportantAndroid 12 以降のデバイスで、通知トランポリンの制限により通知センターの通知をタップした際にアプリが起動しない問題があり、それを回避するために必要になります。
Refs: 通知トランポリンの制限 - Android Developers
ImportantAndroid 12 以降のデバイスで、通知トランポリンの制限により通知センターの通知をタップした際にアプリが起動しない問題があり、それを回避するために必要になります。
Refs: 通知トランポリンの制限 - Android Developers
Used to launch an app from a notification in the Notification Center.
ImportantThis is necessary to avoid an issue on Android 12 or later devices where the app does not launch when you tap a notification in the Notification Center due to a notification trampoline restriction.
Refs: Notification trampoline restrictions - Android Developers
ImportantThis is necessary to avoid an issue on Android 12 or later devices where the app does not launch when you tap a notification in the Notification Center due to a notification trampoline restriction.
Refs: Notification trampoline restrictions - Android Developers
Declaration
public void onResume(Intent intent)
Parameters
intent
Intent
- 通知センターの通知から起動する Activity の Intent を設定します。Set the Intent of the Activity that will be launched from the notification in the Notification Center.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.11.0+
Example
AIBeaconManager.sharedInstance().onResume(getIntent());
Public Method
restartGlobalNotification
対象デバイスに対する AIBeacon グローバルプッシュ通知の配信を再開します。
Restarts publishing the global push notification of AIBeacon to the device.
Declaration
public void restartGlobalNotification()
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.2.2+
Example
// AIBeacon グローバルプッシュ通知の配信を再開する。
AIBeaconManager.sharedInstance().restartGlobalNotification();
// Restarts publishing the global push notification.
AIBeaconManager.sharedInstance().restartGlobalNotification();
Public Method
setListener
AIBeacon 機能のイベント通知を受けるリスナーを設定します。
Sets a listener which receives an event notification of AIBeacon functions.
Declaration
public void setListener(AIBeaconListener listener)
Parameters
listener
AIBeaconListener
AIBeaconListener
インターフェイスが実装されたクラスのオブジェクトを設定します。Sets an object of a class in which someAIBeaconLister
interface is implemented.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.0.0+
Example
AIBeaconManager.sharedInstance().setListener(this);
Public Method
setRequestPermissionsResultLauncher
パーミッション要求結果受け取り用の ActivityResultLauncher を設定します。
AIBeaconManager
の初期化後に必ず呼び出して下さい。Set up an ActivityResultLauncher for receiving the results of a permission request.
You need to call it certainly after initializing
You need to call it certainly after initializing
AIBeaconManager
.Declaration
public void setRequestPermissionsResultLauncher(@Nullable ActivityResultLauncher<String[]> activityResultLauncher)
Parameters
activityResultLauncher
ActivityResultLauncher
- パーミッション要求結果受け取り用の ActivityResultLauncher を設定します。Set up an ActivityResultLauncher for receiving the results of a permission request.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.11.2+
Example
AIBeaconManager.sharedInstance().setRequestPermissionsResultLauncher(requestPermissionsResultLauncher);
Public Method
stopGlobalNotification
対象デバイスに対する AIBeacon グローバルプッシュ通知の配信を停止します。
Stops publishing the global push notification of AIBeacon to the device.
Declaration
public void stopGlobalNotification(long timeInterval)
Parameters
timeInterval
long
- 配信を停止する時間を秒単位で設定します。Duration in seconds to stop publishing.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconManager
Availability
SDK 1.2.2+
Example
// AIBeacon グローバルプッシュ通知の配信を停止する。
AIBeaconManager.sharedInstance().stopGlobalNotification(3600);
// Stops publishing the global push notification.
AIBeaconManager.sharedInstance().stopGlobalNotification(3600);
Public Interface
AIBeaconListener
AIBeaconListener
インターフェースは、 AIBeacon の接触に関するメソッドを定義します。AIBeaconListener
interface defines a method about contacts of AIBeacon.Public Method
didEnterRegionOfAiBeacon
AIBeacon の領域に入った際に呼び出されます。
Note is renamed to
Note
enterRegion
didEnterRegionOfAiBeacon
since SDK 1.5.0
.Called when the device enters the region of AIBeacon.
Note is renamed to
Note
enterRegion
didEnterRegionOfAiBeacon
since SDK 1.5.0
.Declaration
public void didEnterRegionOfAiBeacon(AIContactInfo aiBeacon)
Parameters
aiBeacon
AIContactInfo
- AIBeacon の接触情報を設定します。Contact information of AIBeacon.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconListener
Availability
SDK 1.1.0+
Example
// アクティビティにインターフェースを実装します。
public class MainActivity extends Activity implements AIBeaconListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
// AIBeaconManager にリスナーを設定します。
AIBeaconManager.sharedInstance().setListener(this);
}
// AIBeacon の領域に入った際に呼び出される。
@Override
public void didEnterRegionOfAiBeacon(@Nullable AIContactInfo aiBeacon) {
Log.d(TAG, "didEnterRegionOfAiBeacon: unitId = " + aiBeacon.unitId());
}
}
// Implements an interface in the Activity.
public class MainActivity extends Activity implements AIBeaconListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
// Sets a listener to AIBeaconManager.
AIBeaconManager.sharedInstance().setListener(this);
}
// Called when the device enters the region of AIBeacon.
@Override
public void didEnterRegionOfAiBeacon(@Nullable AIContactInfo aiBeacon) {
Log.d(TAG, "didEnterRegionOfAiBeacon: unitId = " + aiBeacon.unitId());
}
}
Public Method
didExitRegionOfAiBeacon
AIBeacon の領域から出た際に呼び出されます。
Note is renamed to
Note
exitRegion
didExitRegionOfAiBeacon
since SDK 1.5.0
.Called when the device exits the region of AIBeacon.
Note is renamed to
Note
exitRegion
didExitRegionOfAiBeacon
since SDK 1.5.0
.Declaration
public void didExitRegionOfAiBeacon(AIContactInfo aiBeacon)
Parameters
aiBeacon
AIContactInfo;
- AIBeacon の情報を指定します。Contact information of AIBeacon.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconListener
Availability
SDK 1.1.0+
Example
// アクティビティにインターフェースを実装します。
public class MainActivity extends Activity implements AIBeaconListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
// AIBeaconManager にリスナーを設定します。
AIBeaconManager.sharedInstance().setListener(this);
}
// AIBeacon の領域から出た際に呼び出される。
@Override
public void didExitRegionOfAiBeacon(@Nullable AIContactInfo aiBeacon) {
Log.d(TAG, "didExitRegionOfAiBeacon: unitId = " + aiBeacon.unitId());
}
}
// Implements an interface in the Activity.
public class MainActivity extends Activity implements AIBeaconListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
// Sets a listener to AIBeaconManager.
AIBeaconManager.sharedInstance().setListener(this);
}
// Called when the device exits the region of AIBeacon.
@Override
public void didExitRegionOfAiBeacon(@Nullable AIContactInfo aiBeacon) {
Log.d(TAG, "didExitRegionOfAiBeacon: unitId = " + aiBeacon.unitId());
}
}
Public Method
didRangeAiBeacons
AIBeacon の測距中の間、継続的に呼び出されます。
Note is renamed to
Note
ranging
didRangeAiBeacons
since SDK 1.5.0
.Called continuously while the AIBeacons are measuring the ranges.
Note is renamed to
Note
ranging
didRangeAiBeacons
since SDK 1.5.0
.Declaration
public void didRangeAiBeacons(ArrayList<AIContactInfo> aiBeacons)
Parameters
aiBeacons
ArrayList<AIContactInfo>
- AIBeacon の接触情報のリストを設定します。List of contact information of AIBeacon.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconListener
Availability
SDK 1.1.0+
Example
// アクティビティにインターフェースを実装します。
public class MainActivity extends Activity implements AIBeaconListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
// AIBeaconManager にリスナーを設定します。
AIBeaconManager.sharedInstance().setListener(this);
}
// AIBeacon の測距中の間、継続的に呼び出されます。
@Override
public void didRangeAiBeacons(@Nullable ArrayList<AIContactInfo> aiBeacons) {
int count = aiBeacons == null ? 0 : aiBeacons.size();
if (count > 0) {
for (int i = 0; i < count; i++) {
AIContactInfo aiBeacon = aiBeacons.get(i);
Log.d(TAG, "didRangeAiBeacons: unitId = " + aiBeacon.unitId());
}
}
}
}
// Implements an interface in the Activity.
public class MainActivity extends Activity implements AIBeaconListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
// Sets a listener to AIBeaconManager.
AIBeaconManager.sharedInstance().setListener(this);
}
// Called continuously while the AIBeacons are measuring the ranges.
@Override
public void didRangeAiBeacons(@Nullable ArrayList<AIContactInfo> aiBeacons) {
int count = aiBeacons == null ? 0 : aiBeacons.size();
if (count > 0) {
for (int i = 0; i < count; i++) {
AIContactInfo aiBeacon = aiBeacons.get(i);
Log.d(TAG, "didRangeAiBeacons: unitId = " + aiBeacon.unitId());
}
}
}
}
Public Method
registerServiceFailed
AIBeacon サービスへのデバイス登録が失敗した際に呼び出されます。
Note is renamed to
Note
registerDeviceFailed
registerServiceFailed
since SDK 1.4.0
.Called when the registration to the AIBeacon service or its renewal fails.
Note is renamed to
Note
registerDeviceFailed
registerServiceFailed
since SDK 1.4.0
.Declaration
public void registerServiceFailed(String message)
Parameters
message
String
- エラーメッセージを指定します。Error message.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconListener
Availability
SDK 1.0.0+
Example
// アクティビティにインターフェースを実装します。
public class MainActivity extends Activity implements AIBeaconListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
// AIBeaconManager にリスナーを設定します。
AIBeaconManager.sharedInstance().setListener(this);
}
// AIBeacon サービスへの登録または更新が失敗した際に呼び出される。
@Override
public void registerServiceFailed(String message) {
Log.e(TAG, "Registration to service failed: " + message);
}
}
// Implements an interface in the Activity.
public class MainActivity extends Activity implements AIBeaconListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
// Sets a listener to AIBeaconManager.
AIBeaconManager.sharedInstance().setListener(this);
}
// Called when the registration to the AIBeacon service or its renewal fails.
@Override
public void registerServiceFailed(String message) {
Log.e(TAG, "Registration to service failed: " + message);
}
}
Public Method
registerServiceSucceeded
AIBeacon サービスへの登録または更新が成功した際に呼び出されます。
Note is renamed to
Note
registerDeviceSucceeded
registerServiceSucceeded
since SDK 1.4.0
.Called when the registration to the AIBeacon service or its renewal succeeds.
Note is renamed to
Note
registerDeviceSucceeded
registerServiceSucceeded
since SDK 1.4.0
.Declaration
public void registerServiceSucceeded()
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconListener
Availability
SDK 1.0.0+
Example
// アクティビティにインターフェースを実装します。
public class MainActivity extends Activity implements AIBeaconListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
// AIBeaconManager にリスナーを設定します。
AIBeaconManager.sharedInstance().setListener(this);
}
// AIBeacon サービスへの登録または更新が成功した際に呼び出される。
@Override
public void registerServiceSucceeded() {
Log.i(TAG, "Registration to service succeeded");
}
}
// Implements an interface in the Activity.
public class MainActivity extends Activity implements AIBeaconListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
// Sets a listener to AIBeaconManager.
AIBeaconManager.sharedInstance().setListener(this);
}
// Called when the registration to the AIBeacon service or its renewal succeeds.
@Override
public void registerServiceSucceeded() {
Log.i(TAG, "Registration to service succeeded");
}
}
Public Method
shouldContactNotificationInquiry
AIBeacon 接触プッシュで配信するプッシュ通知メッセージがあるか確認する直前に呼び出されます。
Called just before checking for push notification messages to be delivered by AIBeacon's contact push.
Declaration
public boolean shouldContactNotificationInquiry(@Nullable AIContactInfo aiBeacon)
Parameters
aiBeacon
AIContactInfo
- AIBeacon の接触情報を設定します。Contact information of AIBeacon.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconListener
Availability
SDK 1.9.1+
Example
@Override
public boolean shouldContactNotificationInquiry(@Nullable AIContactInfo aiBeacon) {
// AIBeacon 接触プッシュで配信するプッシュ通知メッセージがあるか確認する直前に呼び出されます。
// 配信するプッシュ通知メッセージがあるか確認しない場合は、return に false を返します。
return true;
}
@Override
public boolean shouldContactNotificationInquiry(@Nullable AIContactInfo aiBeacon) {
// Called just before checking for push notification messages to be delivered by AIBeacon's contact push.
// If you do not want to see if there are push notification messages to deliver, return true.
return true;
}
Public Method
willReceiveNotification
AIBeacon のプッシュ通知を受信する直前に呼び出されます。
バックグラウンドで接触プッシュ (ローカル通知) を受信した際に呼び出されます。
ImportantSDK 1.11.5 までは、
SDK 1.11.6 以降、
バックグラウンドで接触プッシュ (ローカル通知) を受信した際に呼び出されます。
ImportantSDK 1.11.5 までは、
AINotificationData
の title()
しか受け取ることができませんでした。SDK 1.11.6 以降、
AINotificationData
の全てのデータを受け取れるようになりました。Called just before the push notification of AIBeacon is received.
It is called when a contact push (local notification) is received in the background.
ImportantUp until SDK 1.11.5, you could only receive the
From SDK 1.11.6 onwards, you can receive all data of
It is called when a contact push (local notification) is received in the background.
ImportantUp until SDK 1.11.5, you could only receive the
title
of AINotificationData
.From SDK 1.11.6 onwards, you can receive all data of
AINotificationData
.Declaration
public boolean willReceiveNotification(AINotificationData notificationData)
Parameters
notificationData
AINotificationData
- AIBeacon のプッシュ通知情報を設定します。Sets the data of the push notification of AIBeacon.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconListener
Availability
SDK 1.2.0+
Example
@Override
public boolean willReceiveNotification(AINotificationData notificationData) {
// AIBeacon のプッシュ通知を受信する直前に呼ばれます。
// 通知センターに通知を表示したくない場合は、return に false を返します。
return true;
}
@Override
public boolean willReceiveNotification(AINotificationData notificationData) {
// Called just before the push notification of AIBeacon is received.
// If you don't want to show the notification in the notification center, return false.
return true;
}
Public Method
willShowNotificationMessage
AIBeacon のプッシュ通知メッセージを表示する直前に呼び出されます。
Called just before the push notification message of AIBeacon is shown.
Declaration
public boolean willShowNotificationMessage(AINotificationData notificationData)
Parameters
notificationData
AINotificationData
- AIBeacon のプッシュ通知情報を設定します。Sets the data of the push notification of AIBeacon.
Import Statement
import jp.co.adinte.AIBeaconSDK.AIBeaconListener
Availability
SDK 1.2.0+
Example
@Override
public boolean willShowNotificationMessage(AINotificationData notificationData) {
Log.d(TAG, "willShowNotificationMessage: notificationData.title = " + notificationData.title());
Log.d(TAG, "willShowNotificationMessage: notificationData.message = " + notificationData.message());
Log.d(TAG, "willShowNotificationMessage: notificationData.url = " + notificationData.url());
// AIBeacon のプッシュ通知メッセージを表示する直前に呼ばれます。
// AIBeacon 標準のメッセージを表示したくない場合は、return に false を返します。
return false;
}
@Override
public boolean willShowNotificationMessage(AINotificationData notificationData) {
Log.d(TAG, "willShowNotificationMessage: notificationData.title = " + notificationData.title());
Log.d(TAG, "willShowNotificationMessage: notificationData.message = " + notificationData.message());
Log.d(TAG, "willShowNotificationMessage: notificationData.url = " + notificationData.url());
// Called just before the push notification message of AIBeacon is shown.
// If you don't want to show the standard notification message of AIBeacon, return false.
return false;
}
Option
AIBeacon Manager Initialization Options
AIBeaconManager
にオプションを設定するために使用するキー。The key for configuring the options of
AIBeaconManager
.Global Variable
AIBeaconManagerInitOption.Keys.AiBeaconScanOperationType
Declaration
public static String AiBeaconScanOperationType
Discussion
AIBeacon スキャンの動作タイプを
キーが指定されてない、または
AIBeaconScanOperationType
クラスの定数を使って指定します。キーが指定されてない、または
AIBeaconScanOperationType
クラスに定義されていない値が指定された場合のデフォルト値は AIBeaconScanOperationType.Always
です。Specify the operation type of the AIBeacon scan using the constant of the
The default value is
AIBeaconScanOperationType
class.The default value is
AIBeaconScanOperationType.Always
if no key is specified or a value is specified that is not defined in the AIBeaconScanOperationType
class.Availability
SDK 1.7.0+
Global Variable
AIBeaconManagerInitOption.Keys.AutoServiceRegistrationEnabled
Declaration
public static String AutoServiceRegistrationEnabled
Discussion
AIBeacon サービスへの登録を自動で行うかどうか (以下 自動サービス登録 と呼ぶ) を
キーの値が
キーが指定されてない場合のデフォルト値は
Importantこのキーの値に
boolean
型の値で指定します。キーの値が
true
の場合は自動サービス登録が有効になり、 false
の場合は無効になります。キーが指定されてない場合のデフォルト値は
false
です。Importantこのキーの値に
false
を設定した場合は、 AIBeaconManager
初期化後に registerService()
または registerService(String)
を呼び出す必要があります。Specify with
If value of this key is
Value of this key is
ImportantIn the case where the key is set to
boolean
value for this key whether to enable registration to the AIBeacon service is automated.If value of this key is
true
, the above automated service registration is enabled, and if false
it is disabled.Value of this key is
false
by default.ImportantIn the case where the key is set to
false
, you need to call registerService()
or registerService(String)
after initializing AIBeaconManager
.Availability
SDK 1.4.0+
Global Variable
AIBeaconManagerInitOption.Keys.DebugEnabled
Declaration
public static String DebugEnabled
Discussion
デバッグモードを有効にするかどうかを
キーの値が
キーが指定されてない場合のデフォルト値は
Importantリリースバージョンのアプリではデバッグモードを有効にしないで下さい。
boolean
型の値で指定します。キーの値が
true
の場合はデバッグモードが有効になり、 false
の場合は無効になります。キーが指定されてない場合のデフォルト値は
false
です。Importantリリースバージョンのアプリではデバッグモードを有効にしないで下さい。
Specify with
If value of this key is
Value of this key is
ImportantPlease do not enable debug mode in released version of application.
boolean
value for this key whether to enable debug mode.If value of this key is
true
, debug mode is enabled, and if false
it is disabled.Value of this key is
false
by default.ImportantPlease do not enable debug mode in released version of application.
Availability
SDK 1.7.0+
Global Variable
AIBeaconManagerInitOption.Keys.PushNotificationEnabled
Declaration
public static String PushNotificationEnabled
Discussion
AIBeacon のプッシュ通知機能を有効にするかどうかを
キーの値が
キーが指定されてない場合のデフォルト値は
boolean
型の値で指定します。キーの値が
true
の場合はプッシュ通知機能が有効になり、 false
の場合は無効になります。キーが指定されてない場合のデフォルト値は
false
です。Specify with
If value of this key is
Value of this key is
boolean
value for this key whether to enable the push notification function of AIBeacon.If value of this key is
true
, the push notification function of AIBeacon is enabled, and if false
it is disabled.Value of this key is
false
by default.Availability
SDK 1.4.0+
Code
AIBeacon Permissions Request Codes
AIBeacon で利用するパーミッションの要求コードを定義します。
Defines a permission request code using for AIBeacon.
Global Variable
AIBeaconPermissionsRequestCode.AIBeaconScan
AIBeacon の領域監視を行うために必要なパーミッションの要求コード。
Request code for the permissions which need for monitoring the region of AIBeacon.
Declaration
public static final int AIBeaconScan = 0;
Availability
SDK 1.1.0+
Class
AIBeaconScanOperationType
AIBeacon スキャンの動作タイプを定義します。
Defines the operation type of AIBeacon scan.
Global Variable
AIBeaconScanOperationType.Always
Declaration
public static final int Always = 0;
Discussion
AIBeacon スキャンは常に動作します。
AIBeacon scanning always works.
Availability
SDK 1.7.0+
Global Variable
AIBeaconScanOperationType.WhenInUse
Declaration
public static final int WhenInUse = 1;
Discussion
AIBeacon スキャンはアプリを使用中の場合にのみ動作します。
AIBeacon scanning works only when using your app.
Availability
SDK 1.7.0+
Class
AIContactInfo
AIBeacon の接触情報。
Contact information of AIBeacon.
Public Method
enteredTime
AIBeacon 領域に入った時間 (UNIX タイム) を取得します。
Gets the time of entered the region of AIBeacon. (UNIX time)
Declaration
final public long enteredTime()
Return Value
領域に入った UNIX タイムを返します。UNIX time of entered the region of AIBeacon.
Availability
SDK 1.5.0+
Public Method
exitedTime
AIBeacon 領域から出た時間 (UNIX タイム) を取得します。
Gets the time of exited the region of AIBeacon. (UNIX time)
Declaration
final public long exitedTime()
Return Value
領域から出た UNIX タイムを返します。UNIX time of exited the region of AIBeacon.
Availability
SDK 1.5.0+
Public Method
lastProximity
直前の AIBeacon との近接度を取得します。
Gets the latest proximity with the AIBeacon.
Declaration
final public int lastProximity()
Return Value
直前の近接度を返します。Latest proximity.
Availability
SDK 1.4.0+
Public Method
proximity
AIBeacon との近接度を取得します。
Gets the proximity with the AIBeacon.
Declaration
final public int proximity()
Return Value
近接度を返します。Proximity.
Availability
SDK 1.4.0+
Public Method
rssi
AIBeacon からの受信信号強度を取得します。
Gets the received signal strength from the AIBeacon.
Declaration
final public int rssi()
Return Value
受信信号強度を返します。RSSI.
Availability
SDK 1.4.0+
Public Method
stayedTime
AIBeacon 領域に滞在した時間 (秒) を取得します。
Gets the stayed time in the region of AIBeacon. (sec)
Declaration
final public long stayedTime()
Return Value
滞在した秒数を返します。Stayed time in seconds.
Availability
SDK 1.4.0+
Public Method
unitId
AIBeacon のユニット ID を取得します。
Gets the unit id of the AIBeacon.
Declaration
final public String unitId()
Return Value
ユニット ID を返します。Unit id.
Availability
SDK 1.4.0+
Class
AINotificationData
AIBeacon のプッシュ通知データ。
Push notification data from AIBeacon.
Public Method
message
AIBeacon プッシュ通知のメッセージを取得します。
Gets the push notification message of AIBeacon.
Declaration
final public String message()
Return Value
通知メッセージを返します。Notification message.
Availability
SDK 1.4.1+
Public Method
title
AIBeacon プッシュ通知のタイトルを取得します。
Gets the tile of the push notification of AIBeacon.
Declaration
final public String title()
Return Value
通知タイトルを返します。Notification title.
Availability
SDK 1.4.1+
Public Method
url
AIBeacon プッシュ通知の URL を取得します。
URL of the push notification of AIBeacon.
Declaration
final public URL url()
Return Value
通知 URL を返します。Notification URL.
Availability
SDK 1.4.1+