Huvle SDK Integration Manual1. Android Studio1-1. Library Module Import1-2. Library Path Setup2. AndroidManifest Setup2-1. Single Instance2-2. usesCleartextTraffic2-3. Permission2-4. Application3. Proguard Setup4. Huvle SDK Integration4-1. Huvle SDK Integration API4-2. Huvle SDK Integration API Call4-3. Huvle SDK Execution 5. Video Guide
Import the unzipped [Stealthaddplatformbrowser_lib] module
Open the Project Structure window to integrate the imported module with main application
Modules
section of the Project Structure window and then
select app
After selecting app
module, select Dependencies
at
the top right of Project Structure
After selecting Dependencies tab, click +
button at the top
right to add imported module
After selecting [Stealthaddplatformbrowser_lib] Module, click OK
button
OK
button
After adding the module, select Rebuild Project
of Build menu to
rebuild the Project
If AndroidManifest.xml
and MainActivity
can not refer to the Huvle
Library Project even if Huvle Library Project has been imported normally and implemented
into dependencies
,
Please add the path of jar
used by Huvle Library Project of
dependencies
in build.gradle(Module:app)
file
Example Library Path Setup
[build.gradle(Module:app)/dependencies
]
x...
dependencies {
...
//-- include project path/lib
implementation fileTree(dir: '../Stealthaddplatformbrowser_lib_sw_3.0.17/libs', include: ['*.jar'])
implementation project(path: ':Stealthaddplatformbrowser_lib_sw_3.0.17')
...
}
...
You should set the Library Path in accordance with your app's folder structure and Library version
If you execute your app without exiting Huvle browser after executed the browser, the Huvle browser will be executed instead of your MainActivity
EX ) When
Sigle Instance
andclearTaskOnLaunch
Properties aren't applied
- Execute Huvle browser
- Select home button
- Execute your App
- Huvle browser will be executed instead of your app
To execute your app always, please add
android:launchMode="singleInstance"
and android:clearTaskOnLaunch="true"
info to MainActivity
Example Code [AndroidManifest.xml
]
android:launchMode="singleInstance"
android:clearTaskOnLaunch="true"
<application
.... >
...
<activity
android:name=".MainActivity"
android:launchMode="singleInstance"
android:clearTaskOnLaunch="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
</application>
Add above codes into Activity which is executed as
<action android:name="android.intent.action.MAIN" />
If your application has Target SDK Version
above '26', when Huvle
browser is executed, it can't load http
web page, not https
.
To solve the problem, you must set android:userCleartextTraffic
property of the
application
property info in the AndroidManifest.xml
file as
true
Example Code [AndroidManifest.xml
]
...
<application
...
android:usesCleartextTraffic="true"
...>
...
</application>
...
Huvle Browser Permissions are as below, You must add all permissions info
Example Code [AndroidManifest.xml
]
x
...
<!-- Start Huvle Permission -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<!-- If Target SDK Version is above 28, please add following permission.
(If Target SDK is below 28, do not need following Permission.) -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!-- End Huvle Permission -->
...
Huvle SDK's Component
info are as below
You must add all Component
info into <application>
of AndroidManifest.xml
From version
3.0.17
, some of application's contents has been changedWhen you try to update your app, Please check the changed things
Example Code [AndroidManifest.xml
]
...
<!-- Start Huvle Library -->
<activity android:name="com.byappsoft.sap.browser.Sap_MainActivity" android:clearTaskOnLaunch="true" android:configChanges="orientation|screenSize|keyboardHidden|keyboard" android:finishOnTaskLaunch="true" android:label="@string/app_name" android:launchMode="singleTask" android:theme="@style/SapLightTheme" android:exported="false"><intent-filter><category android:name="android.intent.category.DEFAULT" /><category android:name="android.intent.category.LAUNCHER" /><category android:name="android.intent.category.BROWSABLE" /><category android:name="android.intent.category.APP_BROWSER" /></intent-filter></activity>
<activity android:name="com.byappsoft.sap.browser.utils.Sap_IncognitoActivity" android:configChanges="orientation|screenSize|keyboardHidden|keyboard" android:label="@string/app_name" android:launchMode="singleTask" android:theme="@style/SapDarkTheme" android:windowSoftInputMode="stateHidden" android:exported="false"><intent-filter><action android:name="android.intent.action.INCOGNITO" /><category android:name="android.intent.category.DEFAULT" /></intent-filter></activity>
<activity android:name="com.byappsoft.sap.browser.Sap_BrowserSearchActivity" android:theme="@android:style/Theme.NoTitleBar" />
<activity android:name="com.byappsoft.sap.launcher.Sap_act_middle" android:theme="@android:style/Theme.Dialog" android:launchMode="singleTask"/>
<activity android:name="com.byappsoft.sap.browser.Sap_SettingsActivity" android:clearTaskOnLaunch="true" android:configChanges="orientation|screenSize|keyboardHidden|keyboard" android:launchMode="singleTask" android:label="@string/cmn_setting" android:theme="@android:style/Theme.NoTitleBar" ><intent-filter><action android:name="android.intent.action.SETTINGS" /><category android:name="android.intent.category.DEFAULT" /></intent-filter></activity>
<activity android:name="com.byappsoft.sap.browser.Sap_AdvancedSettingsActivity" android:configChanges="orientation|screenSize|keyboardHidden|keyboard" android:label="@string/advanced" android:theme="@android:style/Theme.NoTitleBar" ><intent-filter><action android:name="android.intent.action.ADVANCED_SETTINGS" /><category android:name="android.intent.category.DEFAULT" /></intent-filter></activity>
<activity android:name="com.byappsoft.sap.browser.download.Sap_DownloadActivity" android:theme="@android:style/Theme.NoTitleBar" />
<activity android:name="com.byappsoft.sap.browser.Sap_HistoryBookmarksActivity" android:theme="@android:style/Theme.NoTitleBar" />
<activity android:name="com.byappsoft.sap.browser.Sap_SettingDownActivity" android:theme="@android:style/Theme.NoTitleBar" />
<activity android:name="com.byappsoft.sap.browser.pageinfo.Sap_PageInfoActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar" />
<activity android:name="com.byappsoft.sap.browser.Sap_QRCodeListActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar"/>
<activity android:name="com.byappsoft.sap.zxing.client.android.CaptureActivity" android:configChanges="orientation|keyboardHidden" android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateAlwaysHidden" ><intent-filter><action android:name="com.byappsoft.sap.zxing.client.android.SCAN" /><category android:name="android.intent.category.DEFAULT" /></intent-filter></activity>
<activity android:name="com.byappsoft.sap.browser.Sap_BrowserUtils" android:excludeFromRecents="true" android:theme="@style/browser_util_style" android:exported="false" />
<service android:name="com.byappsoft.sap.service.HuvleNotiBarService" />
<service android:name="com.byappsoft.sap.utils.Sap_act_noti_background" />
<service android:name="com.byappsoft.sap.service.BaseRequestService" />
<service android:name="com.byappsoft.sap.cApp.CAppService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true" />
<receiver android:name="com.byappsoft.sap.utils.Sap_act_noti_receiver" android:exported="true" />
<receiver android:name="com.byappsoft.sap.utils.Sap_act_receiver" android:exported="true" android:permission="android.permission.RECEIVE_BOOT_COMPLETED" ><intent-filter><action android:name="android.intent.action.BOOT_COMPLETED" /><action android:name="com.byappsoft.Stealthaddplatform.noti" /><action android:name="android.intent.action.MY_PACKAGE_REPLACED" /></intent-filter></receiver>
<!-- END Huvle Library -->
...
If you use proguard in your app project, Please make Huvle SDK in the proguard-rules.pro
file be the exception as below
Example Code [proguard-rules.pro
]
...
-keep class com.byappsoft.sap.**{*;}
...
Sap_act_main_launcher.class
Type | Definition |
---|---|
Context | this You must specify the context information as this, not getApplicationContext(). |
String | Agent Key If you contract with Huvle through the network company, please contact them to ask about the Agent Key. If you contract directly, please use the same Agent Key that was created when you joined agent.huvle.com |
Boolean | Notibar Status This is the setting value to specify whether to use Huvle Notification Bar in the notification area (Default : true) |
Boolean | Searchbar Status This is setting value to specify whether to use the Huvle Browser’s Search Box (Default :true) |
To call Huvle SDK Integration API, you must acquire Read and Write files permission as essential
onCreate( )
method of MainActivity
has Read and Write files permission. If it doesn't, you must request this
permissiononCreate( )
method of MainActivity
had Read and Write files permission, call the Huvle integration API
Example Code[MainActivity.java
]
...
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//- Please check the essential permission
if(checkPermission()==false) {
requestSapPermissions();
}
}
protected void onResume() {
super.onResume();
//-- Please check the essential permission
if(checkPermission()) {
//-- Change your Agent Code
Sap_act_main_launcher.initsapStart(this, "bynetwork", true, true);
}
}
private boolean checkPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED ||
checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)
{
return false;
}
}
return true;
}
private void requestSapPermissions() {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE}, 0);
}
} catch (Exception e) {
}
}
...
Why is the Read and Write files permission essential ?
To prevent Huvle Noti-bar from output overlap when one device has many apps integrated with Huvle SDK, The integrated Package info has been managed as files
Also, Huvle browser setup info has been managed as files to provide same browser setup info to users if they change the setup info of Huvle browser
When your app is executed after integrated with Huvle Library, Huvle SDK Noti-bar will be created as following scenario
4-3-1. Acquisition Process of Permissions[MainActivity:onCreate(
)
]
4-3-2. Approval Window Output After Acquired Permissions[MainActivity:onResume(
)
]
If above approval window can't be outputted normally, Please refer Huvle Approval Window Error Page from the 'Solve the Error' page
4-3-3. Huvle Noti-bar Output
If above approval window is outputted normally and then an user checks the 'allow' but Huvle Noti-Bar can't be outputted normally, Please check the below
Check whether the Alram
function of the app setup menu is On
or not
Alarm(Huvle Noti-bar)
Check whether your app is set as 'power saving mode' on Device
Care App
Device Care
App
, it can't receive the Alarm(Huvle Noti-bar)
4-3-4. Huvle Browser Execution
Once Huvle Noti-bar is outputted normally, push Web
Search
button of Huvle Noti-bar to check whether Huvle Browser is executed normally
If Huvle browser is executed but the web page info can't be found as below, Please check whether Integration Manual 3-2. useCleartextTraffic Property is set correctly
You must test on the device which has OS above 28, and then check whether the web page is loaded normally