Creating Link sharing feature in Sketchware


  • A webpage
  • APK Editor plus or alternatives for editing Android Manifest.

Welcome to Sketchub Blog, in this blog I will try to explain how to create post/profile link sharing option just like Sketchub. (There is no special need of Firebase Dynamics for this).

For example you have a webpage "". Then in index file, you will need to add a button with id "btn_open_project" which will be used for opening the app:

 <h4 id="btn_open_project">Open Project</h4>
And add javascript code in but end of body tag:
var url_string = window.location.href;
var url = new URL(url_string);
var a = document.getElementById('link_main');
a.href = "project.sketchub://" + url;
Here, link_main is the id of button or text which will be used to open the project through the page. We will explain, why we added "project.sketchub://" before the URL, in end of this post.

Now lets move to the Sketchware project.
In MainActivity, preferably in OnCreate , add this code for obtaining the link when app is opened via link:
   Intent intent = getIntent();
   Uri data = intent.getData();
   shared_data = data.toString();
} catch (Exception e) {
   // The app is not opened via link
If your app is opened via link, it will get the link in the string shared_data. The value of shared_data will be "project.sketchub://" (why project.sketchub:// , we will explain later).
Now, in the link, "id" is URL parameter, with value of "123". And we can add multiple URL parameters like: "" (here userID and other is another parameters with value 456 & 789 respectively).

In Sketchware, we will need to get value of "id" from the string "shared_data" by using this code:

 Uri uri = Uri.parse(shared_data);
String server = uri.getAuthority();
String path = uri.getPath();
String protocol = uri.getScheme();
Set<String> args = uri.getQueryParameterNames();

shared_key = uri.getQueryParameter("id");
Here, "shared_key" is the value of URL parameter "id" i.e. "123".

Now, you will need to implement your own method to find the post with id=123 ;)

Now run the project, and edit APK's android manifest using APK Editor Plus or alternative apps.
Add this code after any </activity> in the existing code.

 <activity android:label="@string/app_name" android:name=".MainActivity">
       <action android:name="android.intent.action.VIEW" />
       <action android:name="com.yourapppackage.LAUNCH" />
       <category android:name="android.intent.category.DEFAULT" />
       <category android:name="android.intent.category.BROWSABLE" />
       <data android:scheme="project.sketchub" />

Here android:scheme="project.sketchub" means that it will only pick those links which starts from "project.sketchub://...". (This way also forces user to move to webpage first, you may edit it if you don't want so, but again, it is useful to send user to webpage.)

Build the APK and test it, it will work ;)


  1. Great. It's helpful... Very nice😍

  2. Can you make video on this and share

  3. Canot copy code when i select code its selecting whole web pls fix add button to copy code

  4. How to create like dislike button in Sketchware studio like youtube

  5. Pls give me video tutorial!


Note: Only a member of this blog may post a comment.

Powered by Blogger.