Skip to content

Commit 370a202

Browse files
author
Vivek Ayer
committed
Android: add xamarin build type
Adding xamarin build type, which is essentially a clone of unity except it requires 4 properties to be passed to gradle upon invocation: - enableXamarin - manifestApplicationId - onesignal_app_id - onesignal_google_project_number e.g., gradle assemble [ -Pproperty=value .. ]
1 parent 8e6a106 commit 370a202

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

OneSignalSDK/onesignal/build.gradle

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ android {
1919
unity {
2020
minifyEnabled false
2121
}
22+
23+
xamarin {
24+
minifyEnabled false
25+
if (project.hasProperty('enableXamarin') && enableXamarin == 'true') {
26+
if (project.hasProperty('manifestApplicationId') && project.hasProperty('onesignal_app_id') && project.hasProperty('onesignal_google_project_number')) {
27+
manifestPlaceholders = [manifestApplicationId:manifestApplicationId, onesignal_app_id:onesignal_app_id, onesignal_google_project_number:onesignal_google_project_number]
28+
} else {
29+
throw new GradleException('Please ensure you have provided manifestApplicationId, onesignal_app_id, and onesignal_google_project_number! aborting xamarin build!')
30+
}
31+
}
32+
}
2233
}
2334
}
2435

@@ -29,4 +40,4 @@ dependencies {
2940
compile 'com.google.android.gms:play-services-location:8.4.0'
3041
}
3142

32-
apply from: 'maven-push.gradle'
43+
apply from: 'maven-push.gradle'
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.onesignal">
2+
3+
<!-- Create a unique permission for your app and use it so only your app can receive your OneSignal messages. -->
4+
<permission android:name="${manifestApplicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature" />
5+
<uses-permission android:name="${manifestApplicationId}.permission.C2D_MESSAGE" />
6+
7+
<application>
8+
<meta-data android:name="onesignal_app_id" android:value="${onesignal_app_id}" />
9+
<meta-data android:name="onesignal_google_project_number" android:value="str:${onesignal_google_project_number}" />
10+
11+
<receiver
12+
android:name="com.onesignal.GcmBroadcastReceiver"
13+
android:permission="com.google.android.c2dm.permission.SEND" >
14+
<intent-filter>
15+
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
16+
<category android:name="${manifestApplicationId}" />
17+
</intent-filter>
18+
</receiver>
19+
</application>
20+
21+
</manifest>

0 commit comments

Comments
 (0)