如何安装条码扫描库没有谷歌帐户



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

根据这个,包的名字应该是com.google.android.gms.vision.barcode。我使用adb列出安装在我的根nexus设备上的所有软件包,这些软件包下载了条形码扫描库,并且软件包不在列表中。我希望自己把包拉出来,然后再分发。

感谢您的时间和努力

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

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

https://github.com/zxing/zxing

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

使用这个库,你可以很容易地集成qr码和条形码阅读器,以及没有与谷歌帐户登录。

我的条形码阅读器代码:

    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();
            }
        }
    }

:

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();
    }
}

第一步:尝试在基于应用程序的gradle文件中包含这个库

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

实现info.androidhive:barcode-reader:1.1.2

步骤2:通过引用链接

创建扫描布局

最新更新