To add Google Services you use a
meta-data tag in your app manifest.xml.
Here I've pasted it in and
you can see it's a meta-data tag
as a child of the application tag.
You're specifying that the name
is the gms.version and
the value is this
integer/google_play_services_version.
This will get replaced for your actual
run time or whenever you compile.
But just leave
integer/google_play_services_version,
and Android studio will do the rest.
In addition to that,
we want to specify find location, and
we do that using
the user's permission tag.
So the user's permission tag goes
here under the application and
above the closing manifest.
And again, we're just saying,
uses permission, and
the permission that we're going to
use is access find location.
If you're asked to do so, like I've
been asked here to do a grade all sync,
go ahead and do that.
And that's, once we're done,
we'll if everything compiles okay.
If you look closely at
the bottom of the screen,
that's where Gradle provides its
update of what it's actually doing.
We can see that it's synced and
everything worked.
We have no errors, so
let's go ahead and write our code.
لإضافة خدمات Google تستخدم علامة بيانات
تعريف في بيان تطبيقك xml.
التي قمت بلصقها هنا
وكما ترى فهي علامة بيانات تعريف فرعية
من علامة التطبيق.
أنت تحدد أن الاسم هو إصدار.gms
القيمة هي إصدار_ خدمات
google_play/ رقم صحيح.
سيتم تبديل ذلك عند تشغيلك للتطبيق
أو عند تحويله برمجياً.
لكن اترك فقط
إصدار_خدمات_google_play/ عدد صحيح،
وسينفذ الاستوديو ما تبقى.
بالإضافة إلى ذلك، نريد تحديد الموقع
ونقوم بذلك باستخدام علامة إذن المستخدم.
لذا تظهر علامة إذن المستخدم
هنا أسفل التطبيق
أعلى بيان الإغلاق.
مرة آخرى نذكر فقط، استخدم الإذن
الإذن الذي سنستخدمه هو
إذن وصول العثورعلى موقع.
إذا طُلب منك القيام بذلك، مثلما طلب مني
إنشاء grade لكل المزامنات،
استمر وأفعل ذلك.
هذا كل شيء وبمجرد انتهائنا من ذلك،
سنفعل إذا تم التحويل برمجيًا بشكل صحيح.
إذا نظرت عن كثب في أسفل الشاشة،
حيث يقوم Gradle بتقديم تحديثات
لما يفعله.
يمكن أن نرى أنه متزامن
وأن كل شيء يعمل جيداً.
ليس لدينا أخطاء، لنكمل ونكتب التعليمة
البرمجية الخاصة بنا.
Para adicionar Google Services, use uma tag meta-data
em seu arquivo
manifest.xml
Colei ele aqui,
e como pode ver,
trata-se de uma tag meta-data como filha da tag application.
Você está especificando que o nome
é gms.version
e que o valor é
@integer/google_play_services_version.
Na verdade, isso será
substituído durante a execução
ou no momento em que compilar.
Porém, apenas deixe integer/google_play_services_version
e
o Android Studio cuidará do resto.
Além disso, precisamos especificar
FINE_LOCATION,
e isso é feito usando
a tag de permissão do usuário.
Portanto, a tag uses-permission
vai bem aqui, logo abaixo do aplicativo
e acima do manifest de fechamento.
Mais uma vez, temos aqui:
uses-permission
e a permissão que vamos
usar é ACCESS_FINE_LOCATION.
Se pedirem para que faça isso
(assim como me pediram nesse caso)
para fazer uma sincronização Gradle,
não perca tempo.
Quando terminar, confira
se tudo está funcionando certinho.
Se observar atentamente
a parte inferior da tela,
notará que este é o lugar onde o Gradle
fornece uma atualização do que está fazendo.
Podemos ver que ele está sincronizado
e que tudo deu certo.
Não há erro algum, por isso
siga adiante e desenvolva o nosso código.
添加 Google 服务 可在应用的 manifest.xml 中使用一个元数据标记
我已经将其贴入
可以发现它是元数据标记 作为应用程序标记的子标记
可规定其名称为 gms.version
值为 integer/google_play_services_version
这将针对你的实际运行时间予以替换 或每当编译时替换
但是不要管 integer/google_play_services_version
Android Studio 将完成余下的工作
此外 我们要指定 Find_Location
我们使用 uses-permission 标记来进行
uses-permission 标记在这里
应用程序下面 关闭清单上面
同样 我们只是说 uses-permission
我们将使用的权限是访问 Find_Location
如果被要求这样做 像我在这里被要求做一个 Gradle 同步一样
继续那样做
完成后 如果一切都编译得很好 那就行了
如果仔细观察屏幕底部
这里是 Gradle 提供对目前实际操作更新的地方
我们可以看到 它被同步 且一切正常
没有任何错误 可以继续编写代码