首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在没有google账户的情况下安装条形码扫描库?

如何在没有google账户的情况下安装条形码扫描库?
EN

Stack Overflow用户
提问于 2016-08-23 21:49:47
回答 3查看 3.1K关注 0票数 12

我想在不允许登录google帐户的设备上安装google play服务的android-vision部分。传统上,android-vision库是通过play商店下载的,作为google play服务的更新。

根据this的说法,包名应该是com.google.android.gms.vision.barcode。我使用adb列出了安装在已下载条形码扫描库的根节点设备上的所有软件包,但该软件包不在列表中。我希望拉出包本身,然后分发它。

感谢您的时间和努力。

EN

回答 3

Stack Overflow用户

发布于 2016-08-23 21:58:52

对于任何google服务,你应该在控制台注册你的add应用程序。

如果您不想添加您的应用程序,那么您可以使用条形码的任何第三方API。

https://github.com/zxing/zxing

票数 3
EN

Stack Overflow用户

发布于 2018-06-26 16:24:15

您可以使用第三方库实现com.journeyapps:zxing-android-embedded:3.5.0

使用这个库,您可以轻松集成二维码和条形码阅读器,而无需使用google帐户登录。

我的条形码阅读器代码如下:

代码语言:javascript
复制
    package com.example.elanwrap.qr_code_elan;

    import android.content.Intent;
    import android.net.Uri;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.Toast;
    import com.google.zxing.integration.android.IntentIntegrator;
    import com.google.zxing.integration.android.IntentResult;

    import static android.widget.Toast.LENGTH_LONG;

    public class MainActivity extends AppCompatActivity {

        Button button;
        //CREATING OBJECT
        private IntentIntegrator qrCode;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);

            button = (Button) findViewById(R.id.button);

            qrCode = new IntentIntegrator(this);

            button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                   //  start the Scan here
                    qrCode.initiateScan();
                }
            });
        }

        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            IntentResult intentResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
            super.onActivityResult(requestCode, resultCode, data);
            if (intentResult != null) {
             //passing result to another Activity.
            //    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(intentResult.getContents() + ""));
                Intent browserIntent = new Intent(this, Result_activity.class );
                browserIntent.putExtra("rah",(intentResult.getContents()+""));
                startActivity(browserIntent);



            } else {
                Toast.makeText(getApplicationContext(), " Empty Result ", Toast.LENGTH_SHORT).show();
            }
        }
    }

和:

代码语言:javascript
复制
package com.example.elanwrap.qr_code_elan;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.TextView;
import android.widget.Toast;

public class Result_activity extends Activity {
    TextView textView;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.result_activity);
        textView=(TextView)findViewById(R.id.details);
        Intent intent = getIntent();
        String str = intent.getStringExtra("rah");
        textView.setText(str);
        Toast.makeText(this, str, Toast.LENGTH_SHORT).show();
    }
}
票数 2
EN

Stack Overflow用户

发布于 2018-06-28 19:22:44

步骤1:尝试将该库包含在基于应用程序的gradle文件中

实施com.google.android.gms:play-services-vision:11.0.2

实施info.androidhive:barcode-reader:1.1.2

第2步:通过引用link创建用于扫描的布局

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39103077

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档