Samsung Internet for Android Extension Development Guide

[Samsung Internet] Mar 21, 2016

Samsung Internet for Android provides support for 3rd party extensions that let users customize their web browsing experience. We are constantly seeking for more services that can be integrated to further improve user experience.

Content Blocker

Starting from 4.0, Samsung Internet for Android allows 3rd party apps to provide filters for Content Blocking. You can let users browse the web without unnecessary content cluttering their screens.

The 3rd party Content Blocker apps are validated and approved by Samsung. So that the plug-in apps installed from public app markets do not interfere with Samsung Internet for Android in any unauthorized manner.

Block content OFF Block content ON

Overview

Samsung Internet for Android uses the filter data provided by your apps to tidy up web pages shown to users.

Samsung Internet for Android, Content Blocker feature is disabled by default

In Samsung Internet for Android, Content Blocker feature is disabled by default. When users install Content Blocking apps -pre-registered to Samsung Internet for Android - from app stores, the Block Content menu will become visible in our Settings – Advanced page. This setting menu becomes visible only after at least one pre-registered Content Blocking app is installed.

Samsung Internet for Android scans for pre-registered Content Blocking apps, details for registering your app to Samsung Internet for Android is described in the Basic Guidelines section.

After the user enables a Content Blocker extension, Samsung Internet for Android will request the filter data to your app and start using that filter data when rendering web pages. Although several content blocking apps can be installed and registered to Samsung Internet for Android, only one app selected by the user will be used for content blocking.

Basic Guidelines

Filter Format

Samsung Internet works with filters following the widely known Adblock Plus filter (adblockplus.org/filters) format packaged into android apk packages.

App Registration

To register your app to Samsung Internet for Android, the following preconditions need to be met.

  1. The ContentProvider’s authority string should follow this format

    (ex) <provider
           android:name="com.example.sampleApp.sampleContentProvider"
           android:authorities="< your_package_name >.contentBlocker.contentProvider"
           android:exported="true">
           </provider>

  2. Add the following uses-permission in your AndroidManifest.xml file.

    (ex) <uses-permission android:name="com.samsung.android.sbrowser.permission.CONTENTBLOCKER" />

  3. Include the version info for our Content Blocker interface in your AndroidManifest.xml file.

    (ex) <meta-data android:name="com.samsung.android.sbrowser.contentBlocker.interfaceVersion" android:value="API_1.0" />

Validation Process

The validation process from Samsung is designed to make sure that the extension interface between the extensions app and Samsung Internet is properly used, and the extension app can be properly enabled and disabled from Samsung Internet. The intent of the validation process is to make sure that the app is not misleading the user. You need to send the final apk of your app to browser@samsung.com and follow the validation process before uploading your apps to public app markets. Detailed guidelines will be provided via e-mail, and the validation process takes around 1 week. Once validated, the package name and signature will be registered, and your app will be used by Samsung Internet for Android for Content Blocking.
* Samsung reserves the rights to change the validation process without prior notice.

Data Encryption

Samsung Internet for Android provides an optional filter data encryption SW on request. The key value generated by the encryption SW should be included in the Bundle returned by the call() method in ContentProvider.
If not using data encryption, you can return null in call().
Contact browser@samsung.com to request the encryption SW and detailed guides.

(ex) @Override
       public Bundle call(String method, String arg, Bundle extras) {
       if((method.equals(“getKeyInfo”))) {
       Bundle returnData = new Bundle();
       returnData.putString(“keyInfo”, “key_value_generated_by_encryption_sw”);

       return returnData;
       }
       return null;
       }

Samsung Internet for Android requests the filter data in read-only mode, but to be sure, it is recommended that you explicitly open your filter file in read-only mode.

(ex) @Override
       public ParcelFileDescriptor openFile(Uri uri, String mode)
       throws FileNotFoundException {
       ParcelFileDescriptor parcel =
       ParcelFileDescriptor.open(file,
       ParcelFileDescriptor.MODE_READ_ONLY);
       return parcel;
       }

Updating Filter Data

Whenever your app is updated through public app markets, Samsung Internet for Android will request the up-to-date filter data from your app. Another option is for you to send a broadcast message with the intent action and data set following this format.

(ex) Intent intent = new Intent();
       intent.setAction("com.samsung.android.sbrowser.contentBlocker.ACTION_UPDATE");
       intent.setData(Uri.parse("package:<your_package_name>"));
       sendBroadcast(intent);

Launching Content Blocking Settings

You can launch the Content Blocking setting menu for Samsung Internet for Android from your app with startActivity(Intent).

(ex) Intent intent = new Intent();
       intent.setAction("com.samsung.android.sbrowser.contentBlocker.ACTION_SETTING");
       List<ResolveInfo> list = getPackageManager().queryIntentActivities(
       intent, PackageManager.MATCH_DEFAULT_ONLY);
       If (list.size() > 0) {
       startActivity(intent);
       }

Development Mode

Samsung Internet for Android provides a development mode for Content Blocker, so you can test your app before carrying out the validation process.
Type "about:contentblock" in the URL bar of Samsung Internet for Android, and you will enter Content Blocker development mode. If you launch the setting menu in development mode, you will be able to select and test your Content Blocking app even if it is not validated.

Development mode is only intended for Content Blocker app developers. You must not guide app users to enable development mode in order to use your app.

Restrictions

Supported devices: Content blocking feature is supported on Samsung Galaxy devices with Samsung Internet for Android 4.0 and above.

Developer Feedback

For more details or inquiries, please contact browser@samsung.com.

COPY URL twitter facebook