Short Dynamic link error com.google.android.gms.common.api.ApiException: 8:

前端 未结 3 543
感情败类
感情败类 2021-02-07 21:43

I am trying to get Firebase dynamic links to work in my app.

I have a function with the following

    //long
    String link = \"http://www.blessd.mobi         


        
相关标签:
3条回答
  • 2021-02-07 22:30

    Firebase team was able to reproduce the issue and has already reported this to their team.

    Currently, there are two workarounds for this issue:

    • Use the Dynamic Link version 16.0.1 to be able to generate a short Dynamic Link: implementation 'com.google.firebase:firebase-core:16.0.1'
      implementation 'com.google.firebase:firebase-dynamic-links:16.0.1'

    • Stick in using version 16.1.1, create a long link first then try to shorten the long Dynamic Link using this guide.

    0 讨论(0)
  • 2021-02-07 22:30

    Solution:

    step 1 :check update version implementation 'com.google.android.gms:play-services-auth:18.1.0'

    Step 2: check link, domainUriPrefix app level and firebase console dynamic link setting

    Step 3: check sha1 key

    0 讨论(0)
  • 2021-02-07 22:36

    Use my solution to build your short link and avoid downgrading firebase.

               String builtLink = new LinkBuilder().setDomain("example.page.link")
               .setLink("your link goes here")
               .setSd(socialTagDesc)
               .setSt(socialTagTitle)
               .setSi("social image link here")
               .setApn("android app pkg")
               .setAmv("android min version")
               .setIbi("ios app pkg")
               .setImv("ios app min version")
               .setIsi("iosid number").build();
    
        DynamicLink.Builder builder =  FirebaseDynamicLinks.getInstance().createDynamicLink()
                .setLongLink(Uri.parse(builtLink));
    
        builder.buildShortDynamicLink()
                .addOnSuccessListener(listener)
                .addOnFailureListener(failureListener);
    
    
    
    
    
     public class LinkBuilder
     {
        private String domain;
        private String link;
        private String apn;
        private String amv;
    
        private String ibi;
        private String imv;
        private String isi;
    
    
        private String st;
        private String sd;
        private String si;
    
        public String getURLEncode(String input){
    
            try
            {
                return URLEncoder.encode(input, "UTF-8");
            }
            catch (Exception ex){
                Timber.e(ex);
            }
    
            return input;
        }
    
    
        public LinkBuilder setDomain(String domain) {
            this.domain = domain;
            return this;
        }
    
        public LinkBuilder setLink(String link) {
            this.link = getURLEncode(link);
            return this;
        }
    
        public LinkBuilder setApn(String apn) {
            this.apn = apn;
            return this;
        }
    
        public LinkBuilder setAmv(String amv) {
            this.amv = amv;
            return this;
        }
    
        public LinkBuilder setIbi(String ibi) {
            this.ibi = ibi;
            return this;
        }
    
        public LinkBuilder setImv(String imv) {
            this.imv = imv;
            return this;
        }
    
        public LinkBuilder setIsi(String isi) {
            this.isi = isi;
            return this;
        }
    
        public LinkBuilder setSt(String st) {
            this.st = getURLEncode(st);
            return this;
        }
    
        public LinkBuilder setSd(String sd) {
            this.sd = getURLEncode(sd);;
            return this;
        }
    
        public LinkBuilder setSi(String si) {
            this.si = getURLEncode(si);;
            return this;
        }
    
        public String build(){
            return String.format("https://%s/?link=%s&apn=%s&amv=%s&ibi=%s&imv=%s&isi=%s&st=%s&sd=%s&si=%s"
                    ,domain, link, apn, amv, ibi, imv,isi,st,sd,si);
        }
    }
    
    0 讨论(0)
提交回复
热议问题