小编Ben*_*nke的帖子

ExpoKit和React Native项目之间的区别

我现在做了很多研究,以找出React Native项目,CRNA和Expo项目之间的确切差异和权衡.

我的主要指导是这个

但是我仍然不明白我使用带有本机代码的ExpoKit与使用本机代码的普通React Native项目有什么(dis-)优势,除了我不能在普通的React Native项目中使用Expo API.

我知道当我在Expo开始一个项目时,我可以将它作为ExpoKit项目或React Native项目弹出.在两者中我都可以使用本机代码.在ExpoKit中,我仍然可以在普通的React Native项目中使用Expo API.

所以我的问题:

  1. 如果我可以在ExpoKit项目中使用本机代码和所有Expo API,那么使用react本机项目会有什么兴趣?在ExpoKit项目中,我仍然可以使用所有Expo API和所有React Native API,对吧?!

  2. 如果我安装expo,我可以在React Native项目中使用Expo API npm install --save expo吗?

  3. React Native API和Expo API有什么区别?

react-native expo

20
推荐指数
1
解决办法
6326
查看次数

虽然许可是明显的,但需要振动许可

我想通过点击按钮让我的设备振动.但它总是抛出我的java.lang.SecurityException: Requires VIBRATE permission错误,虽然我在清单中有VIBRATE权限.

我知道从API 23开始,应用程序必须在运行时询问某些权限,但根据此链接,无需询问即可获得Vibrate权限.

有任何想法吗?

方法代码:

 @Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.action_settings:
            // User chose the "Settings" item, show the app settings UI...
            return true;

        case R.id.share:
            // User chose the "Favorite" action, mark the current item
            // as a favorite...
            return true;
        case R.id.sync:
            Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
            // Vibrate for 500 milliseconds
            v.vibrate(500); //MainActivity line 832
            getRemoteItems();

        default:
            // If we got here, the user's action …
Run Code Online (Sandbox Code Playgroud)

java permissions android

6
推荐指数
1
解决办法
1011
查看次数

标签 统计

android ×1

expo ×1

java ×1

permissions ×1

react-native ×1