So now we need to set up
Google Play Services.
So first let's open up the Android SD
cam manager and scroll down to Extras.
Then you need to make sure you
have both Google Play Services and
the Google Repository installed.
I'm not kidding here because
you really do need both.
If you forget one of them say the Google
Repository you'll start to get some
weird Lint errors that you might
not be able to figure out.
So double-check, hit install for
both and then we can move on.
Then we'll need to update build.gradle
to reference this new library.
So all we need is a new compile role.
Note, however that with Google Play
Services you don't just reference
the library, but also the particular
bundle that you want to use.
Also, the version number will probably
have changed from what you see here, so
use the Android Lint recommendation
to make sure you always have the most
up-to-date version number.
For any service provided
by Google Play Services,
it's important to check that
Google Play Services is even available.
So you remember Rito's explanation of
the Android activity life cycle, right?
Obviously, we want to check that
everything is good to go when we first
start the app, but you'll also want
to recheck anytime the app resumes,
because you never know how
the user will use their device and
you don't want your app to be in a wonky
state when it's actually trying to run.
So you can just copy the helper method
that I have in order to actually perform
the check because I'm more interested
in making sure that you know
how to just perform the call in the
right places to make sure that your app
always knows what's going on.
الآن نريد إعداد
.خدمات Google Play
لذا دعونا أولاً نفتح مدير كاميرا Android SD
.والتمرير إلى Extras
يتعين بعد ذلك التأكد من تثبيت
كل من خدمات Google Play
.ومستودع Google
ولست أمزح هنا لأنكم
.تحتاجونهما حقًا
وفي حال نسيان أحدهما، كمستودع
Google مثلاً، فسوف تحصلون على أخطاء تتعلق
بتحليل البرامج النصية قد
.لا تكون لديكم القدرة على فهمها
لذا تحققوا مجددًا من هذا الأمر، وتأكدوا من تثبيت
.الأمرين ثم يمكننا المتابعة
نحتاج بعد ذلك إلى تحديث build.gradle
.للإشارة إلى هذه المكتبة الجديدة
.وبالتالي فإن كل ما نحتاجه هو دور تجميع جديد
ومع ذلك لا بد من ملاحظة أنه في حال استخدام خدمات Google Play
لا تحتاجون للإشارة للمكتبة فقط
وإنما الإشارة إلى الحزمة
.الخاصة التي ترغبون في استخدامها
كذلك سيتم تغيير رقم الإصدار
عما ترونه هنا، وبالتالي
يمكنكم استخدام توصية تحليل البرامج النصية من Android
للتأكد من وجود
.رقم الإصدار الأحدث
وللحصول على أي خدمة تقدمها
،خدمات Google Play
ينبغي التحقق من وجود
.خدمات Google Play
هل تذكرون شرح Rito لدورة
حياة نشاط Android؟
من الواضح أنه لا بد لنا من التأكد من أن
كل شيء على ما يرام عند تشغيل
التطبيق لأول مرة، لكن يتعين عليكم
،التحقق مجددًا في كل مرة يستأنف فيها التطبيق العمل
لأنكم لا تعلمون أبدًا
طريقة استخدام الشخص للجهاز
ولا ترغبون في أن يكون التطبيق في حالة
.غير مستقرة حين تحاولون تشغيله
لذا يمكنكم نسخ أسلوب المساعد
الموجود هنا لتنفيذ
عملية التحقق هذه لأني حريص
على التأكد من معرفتكم
طريقة تنفيذ هذا الأمر
في الموضع المناسب للتأكد من أن التطبيق
.على علم بما يجري دائمًا
Bom, agora precisamos configurar
o Google Play Services.
Para isso, vamos começar abrindo o
gerenciador de câmera do Android SD e rolar para baixo até Extras.
Em seguida, confira se já instalou
o Google Play Services e
o Google Repository.
Isso é muito sério, pois ambos
são essenciais.
Caso esqueça de instalar um deles, como
o Google Repository, erros estranhos
do Lint serão exibidos e é possível
que você não os entenda.
Por isso, confira bem antes e
selecione Install para ambos para avançarmos.
Em seguida, precisaremos atualizar build.gradle
para fazer referência a esta nova biblioteca.
Agora só precisamos de um novo papel de compilação.
Note, no entanto, que com o Google Play
Services você não só consulta
a biblioteca, mas também o pacote
específico que deseja usar.
Além disso, o número de versão provavelmente
estará diferente do que vê aqui, portanto
use a recomendação do Android Lint
para que sempre tenha o número
de versão mais atual.
Para qualquer serviço oferecido
pelo Google Play Services,
é importante verificar
se o Google Play Services está disponível.
Por isso, lembre-se do que o Rito explicou
sobre o ciclo de vida de atividade do Android, ok?
É claro que precisamos verificar se
está tudo bem antes de executarmos
o aplicativo, mas também é importante
dedicar um tempo à verificação de sua reinicialização
porque nunca se sabe como
o usuário utilizará seu dispositivo e
é preciso evitar o mau funcionamento
do aplicativo ao tentar inicializar.
Basta copiar o método auxiliar que tenho
para executar a verificação
porque tenho mais interesse em garantir
que você aprenda como
realizar a invocação
nos lugares ideais para garantir que o seu aplicativo
sempre saiba o que está acontecendo.
我们现在要设置
Google Play 服务。
首先,打开 Android SD cam 管理器,
向下滚动至 Extras。
然后确保安装了
Google Play 服务和
Google Repository。
我不是开玩笑,
因为真的需要这两个。
如果没有其中之一,比如说 Google
Repository,就会遇到一些
奇怪的 Lint 错误,
而且还会找不出来错在哪里。
所以,请仔细检查,安装两个程序,
然后就可以继续了。
我们需要更新 build.gradle
以引用这个新库。
我们需要的是新的编译角色。
注意,在 Google Play 服务中,
不能仅引用该库,
还要引用想要使用
的特定包。
同样,在这里看到的版本号
也可能发生了改变,因此
请使用 Android Lint 建议
以确保使用的始终是
最新的版本号。
对于任何由 Google Play 服务
提供的服务,
检查 Google Play 服务
是否可用非常重要。
还记得 Rito 对 Android 活动
生命周期的解释,对吗?
很明显,我们想要在第一次启动
应用时检查是否一切正常,
但您也会在应用
恢复时随时重新检查,
因为您从来都不知道
用户会如何使用他们的设备,并且
您也不希望您的应用在
运行时处于不稳定的状态。
因此,可以复制我的
辅助方法来执行检查,
因为我更有兴趣
确定您知道
如何在正确的位置执行调用,
以确保您的应用
始终知道正在发生些什么。