Skip to content

Commit 467d26c

Browse files
authored
Merge pull request #2930 from wmathurin/W-19408803-hybrid-main-application
W-19408803: Add MainApplication.kt for hybrid Android apps
2 parents 5184617 + f1d405a commit 467d26c

4 files changed

Lines changed: 53 additions & 51 deletions

File tree

hybrid/HybridSampleApps/AccountEditor/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
android:anyDensity="true" />
1313

1414
<application android:label="@string/app_name"
15-
android:name="com.salesforce.androidsdk.phonegap.app.HybridApp"
15+
android:name="com.salesforce.androidsdk.phonegap.app.MainApplication"
1616
android:manageSpaceActivity="com.salesforce.androidsdk.ui.ManageSpaceActivity"
1717
android:icon="@drawable/sf__icon">
1818

hybrid/HybridSampleApps/MobileSyncExplorerHybrid/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
android:anyDensity="true" />
1313

1414
<application android:label="@string/app_name"
15-
android:name="com.salesforce.androidsdk.phonegap.app.HybridApp"
15+
android:name="com.salesforce.androidsdk.phonegap.app.MainApplication"
1616
android:manageSpaceActivity="com.salesforce.androidsdk.ui.ManageSpaceActivity"
1717
android:icon="@drawable/sf__icon"
1818
android:enableOnBackInvokedCallback="@bool/isGraterThan33">

libs/SalesforceHybrid/src/com/salesforce/androidsdk/phonegap/app/HybridApp.java

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright (c) 2026-present, salesforce.com, inc.
3+
* All rights reserved.
4+
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
5+
* that the following conditions are met:
6+
* - Redistributions of source code must retain the above copyright notice, this list of conditions and the
7+
* following disclaimer.
8+
* - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
9+
* the following disclaimer in the documentation and/or other materials provided with the distribution.
10+
* - Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or
11+
* promote products derived from this software without specific prior written permission.
12+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
13+
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
14+
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
15+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
17+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
18+
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
19+
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20+
*/
21+
package com.salesforce.androidsdk.phonegap.app
22+
23+
import android.app.Application
24+
import com.salesforce.androidsdk.phonegap.app.SalesforceHybridSDKManager
25+
26+
/**
27+
* Application class for hybrid apps.
28+
* Customize SDK initialization here.
29+
*/
30+
class MainApplication : Application() {
31+
32+
override fun onCreate() {
33+
super.onCreate()
34+
SalesforceHybridSDKManager.initHybrid(applicationContext)
35+
36+
/*
37+
* Uncomment the following line to enable IDP login flow. This will allow the user to
38+
* either authenticate using the current app or use the designated IDP app for login.
39+
* Replace 'com.salesforce.samples.salesforceandroididptemplateapp' with the package name
40+
* of the IDP app meant to be used.
41+
*/
42+
// SalesforceHybridSDKManager.getInstance().idpAppPackageName = "com.salesforce.samples.salesforceandroididptemplateapp"
43+
44+
/*
45+
* Uncomment the following line to enable push notifications in this app.
46+
* Replace 'pnInterface' with your implementation of 'PushNotificationInterface'.
47+
* Add your Firebase 'google-services.json' file to the 'app' folder of your project.
48+
*/
49+
// SalesforceHybridSDKManager.getInstance().pushNotificationReceiver = pnInterface
50+
}
51+
}

0 commit comments

Comments
 (0)