How to make a URL shortener in Sketchware. (Firebase Dynamic Links)

 See image below main.xml


The below image in on Shrink clicked



Requirements
1. A String variable "json"
2. A String variable "url_to_short
3. A map variable "map"
The code in string json "join {"longDynamincLink":
"https://messagesin.ga/?link=

Here in place of "messagesin.ga" write your dynamic link.
Ex-myapp.page.link 
Insert a join block again in "and" section

In next join block for the condition "join" add url_to_short string block.
In the "and" condition add below code.
",
"suffix": {
"option": "SHORT"
    }
}






And a toast block with message "Please wait."

RequestNetwork set params "map" to request type "REQUEST BODY"
RequestNetwork start network to method "POST" to url https://firebasedynamiclinks.googleapis .com/v1/shortLinks?key=YOUR_WEB_API_KEY

Here in place of YOUR_WEB_API_KEY add your project's API key.
In textview where the link will come add onClick and CopyToClipboard textview "output" getText.
That's all. Save and run the project

Comments

Popular posts from this blog

How to make edittext in dialog in Sketchware

How to use request network for webview in Sketchware

How to make a browser in sketchware