So here now we can see we
can get the transition type
using
geofencingEvent.getGeofenceTransition.
This is going to return
an integer to us.
Now, the geofence object contains these
constants GeofenceTransitionEnter and
GeofenceTransitionExit.
So all we have to do then is if
the geofence transition is this or
the geofence transition is this,
then we're going to run a block of code.
We'll see what that block of
code is in a few moments, but
this is all you'll have to do to check
the transition type if you're
entering or if you're existing.
Of course, it's up to you how
you build your application.
If you want to build it so
that events only happen when you enter,
then you don't need to check for the
geofence transition exit and vice versa.
وبالتالي يمكننا أن نعرف الآن
نوع الانتقال ونحصل عليه
باستخدام
geofencingEvent.getGeofenceTransition.
يؤدي ذلك إلى
إرجاع عدد صحيح.
والآن، يحتوي كائن النطاق الجغرافي على
GeofenceTransitionEnter
وGeofenceTransitionExit الثابتين.
وبالتالي كل ما علينا فعله هو إذا
كان انتقال النطاق الجغرافي هذا أو
إذا كان انتقال النطق الجغرافي هذا،
فيمكننا تشغيل كتلة من التعليمات البرمجية.
سنتعرف على كتلة التعليمات
البرمجية في غضون دقائق
ولكن هذا هو كل ما عليك فعله للتحقق
من نوع الانتقال عند
الدخول أو الخروج.
بالطبع، الأمر إليك في
كيفية إنشاء تطبيقك.
إذا كنت تريد إنشاءه بحيث تحدث
الأحداث فقط عند دخولك،
فلست بحاجة إلى التحقق من الخروج
من انتقال النطاق الجغرافي والعكس.
Agora, aqui, vemos que podemos
obter o tipo de transição
usando
"geofencingEvent.getGeofenceTransition".
Isso nos retornará
um número inteiro.
Bem, o objeto "geofence"
contém estas constantes,
"GeofenceTransitionEnter" e
"GeofenceTransitionExit".
O que temos que fazer é,
se a transição de geofence for esta
ou esta,
executar
um bloco de código.
Já, já veremos o que é
um bloco de código,
mas você só precisa fazer isso
para verificar o tipo de transição,
se você está entrando
ou se está saindo.
É claro que você é que decide
como compilar seu aplicativo.
Se quiser compilá-lo
para que eventos só ocorram quando você entrar,
não será preciso verificar
"GeofenceTransitionExit",
e vice-versa.
现在可以看到 我们可以使用
geofencingEvent.getGeofenceTransition 获得过渡类型
此类型将向我们返回一个整数
现在 Geofence 对象包含这些常量 Geofence_Transition_Enter
和 Geofence_Transition_Exit
然后我们要做的是 如果 Geofence 过渡是这个
或者 Geofence 过渡是这个 那么我们将运行一个代码块
一会我们将看到该代码块是什么
但是如果你正在进入或者正在退出 这是你要做的所有工作
以查看过渡类型
当然 这取决于你如何建立应用程序
如果你希望建立它 使事件 只在进入时发生
那么不需要检查 Geofence 过渡退出 反之亦然