How to add intent filter in the Sketchware Apps

With the help of intent filter, you can increase your user experience. For eg when you click on Link or File, a dialog pop-up for opening the link/file. If you are building Apps like browser, you will like to show your app in that dialog while clicking on link. It is possible to add this feature in sketchware apps.

  • Apk Editor (or any android manifest editor)

Here are the steps:

Step 1: While preparing your project, add this code in OnCreate OnStart etc to receive the data ( when somebody click the link, the link should be transferred to the app):
Intent intent = getIntent();
Uri data = intent.getData();
} catch (Exception e){
// if there is no data
I have placed try catch because if there will no data it may crash.

Step 2: Run the project and install apk.

Step 3: Open Apk Editor > Choose your app > Manifest > Long Hold any line > Open in a new Tab.

Step 4: Add this code ( place it after any word):
 <activity android:label="@string/app_name" android:name=".MainActivity">
    <action android:name="android.intent.action.VIEW" />
    <action android:name="com.example.My Application.LAUNCH" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="https" />
    <data android:scheme="http" />
Here you may not change anything.

Step 5: Click on Save and Build the apk.

Fact: You can add your own schemes and hosts so that your app will open only for specific link(s). For it you have to add only single line in the code of "Step 4".
Example Link:
 <data android:scheme="http"
                android:pathPrefix="/hello" />
Hope that it will be helpful to you. Please comment if you are facing any problem.

No comments:

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

Powered by Blogger.