Skip to content

Commit 1054a58

Browse files
committed
Android sample
0 parents  commit 1054a58

File tree

84 files changed

+41771
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+41771
-0
lines changed

.gitignore

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
.vscode
21+
.idea
22+
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# Optional eslint cache
28+
.eslintcache

android/.gitignore

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore
2+
3+
# Built application files
4+
*.apk
5+
*.aar
6+
*.ap_
7+
*.aab
8+
9+
# Files for the ART/Dalvik VM
10+
*.dex
11+
12+
# Java class files
13+
*.class
14+
15+
# Generated files
16+
bin/
17+
gen/
18+
out/
19+
# Uncomment the following line in case you need and you don't have the release build type files in your app
20+
# release/
21+
22+
# Gradle files
23+
.gradle/
24+
build/
25+
26+
# Local configuration file (sdk path, etc)
27+
local.properties
28+
29+
# Proguard folder generated by Eclipse
30+
proguard/
31+
32+
# Log Files
33+
*.log
34+
35+
# Android Studio Navigation editor temp files
36+
.navigation/
37+
38+
# Android Studio captures folder
39+
captures/
40+
41+
# IntelliJ
42+
*.iml
43+
.idea/workspace.xml
44+
.idea/tasks.xml
45+
.idea/gradle.xml
46+
.idea/assetWizardSettings.xml
47+
.idea/dictionaries
48+
.idea/libraries
49+
# Android Studio 3 in .gitignore file.
50+
.idea/caches
51+
.idea/modules.xml
52+
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
53+
.idea/navEditor.xml
54+
55+
# Keystore files
56+
# Uncomment the following lines if you do not want to check your keystore files in.
57+
#*.jks
58+
#*.keystore
59+
60+
# External native build folder generated in Android Studio 2.2 and later
61+
.externalNativeBuild
62+
.cxx/
63+
64+
# Google Services (e.g. APIs or Firebase)
65+
# google-services.json
66+
67+
# Freeline
68+
freeline.py
69+
freeline/
70+
freeline_project_description.json
71+
72+
# fastlane
73+
fastlane/report.xml
74+
fastlane/Preview.html
75+
fastlane/screenshots
76+
fastlane/test_output
77+
fastlane/readme.md
78+
79+
# Version control
80+
vcs.xml
81+
82+
# lint
83+
lint/intermediates/
84+
lint/generated/
85+
lint/outputs/
86+
lint/tmp/
87+
# lint/reports/
88+
89+
# Android Profiling
90+
*.hprof
91+
92+
# Cordova plugins for Capacitor
93+
capacitor-cordova-android-plugins
94+
95+
# Copied web assets
96+
app/src/main/assets/public

android/app/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build/*
2+
!/build/.npmkeep

android/app/build.gradle

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion rootProject.ext.compileSdkVersion
5+
defaultConfig {
6+
applicationId "io.ionic.starter"
7+
minSdkVersion rootProject.ext.minSdkVersion
8+
targetSdkVersion rootProject.ext.targetSdkVersion
9+
versionCode 1
10+
versionName "1.0"
11+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
12+
aaptOptions {
13+
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
14+
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
15+
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
16+
}
17+
}
18+
buildTypes {
19+
release {
20+
minifyEnabled false
21+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22+
}
23+
}
24+
}
25+
26+
repositories {
27+
flatDir{
28+
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
29+
}
30+
}
31+
32+
dependencies {
33+
implementation fileTree(include: ['*.jar'], dir: 'libs')
34+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
35+
implementation project(':capacitor-android')
36+
testImplementation "junit:junit:$junitVersion"
37+
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
38+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
39+
implementation project(':capacitor-cordova-android-plugins')
40+
}
41+
42+
apply plugin: 'com.microsoft.intune.mam'
43+
44+
intunemam {
45+
includeExternalLibraries = [
46+
"androidx.*",
47+
"com.getcapacitor.*"
48+
]
49+
}
50+
51+
52+
apply from: 'capacitor.build.gradle'
53+
54+
try {
55+
def servicesJSON = file('google-services.json')
56+
if (servicesJSON.text) {
57+
apply plugin: 'com.google.gms.google-services'
58+
}
59+
} catch(Exception e) {
60+
logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
61+
}

android/app/capacitor.build.gradle

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
2+
3+
android {
4+
compileOptions {
5+
sourceCompatibility JavaVersion.VERSION_1_8
6+
targetCompatibility JavaVersion.VERSION_1_8
7+
}
8+
}
9+
10+
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
11+
dependencies {
12+
implementation project(':capacitor-app')
13+
implementation project(':capacitor-haptics')
14+
implementation project(':capacitor-keyboard')
15+
implementation project(':ionic-enterprise-intune')
16+
17+
}
18+
19+
20+
if (hasProperty('postBuildExtras')) {
21+
postBuildExtras()
22+
}

android/app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.getcapacitor.myapp;
2+
3+
import static org.junit.Assert.*;
4+
5+
import android.content.Context;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
import androidx.test.platform.app.InstrumentationRegistry;
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
15+
*/
16+
@RunWith(AndroidJUnit4.class)
17+
public class ExampleInstrumentedTest {
18+
19+
@Test
20+
public void useAppContext() throws Exception {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
23+
24+
assertEquals("com.getcapacitor.app", appContext.getPackageName());
25+
}
26+
}
+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="io.ionic.starter">
4+
5+
<queries>
6+
<package android:name="com.azure.authenticator" />
7+
<package android:name="io.ionic.starter" />
8+
<package android:name="com.microsoft.windowsintune.companyportal" />
9+
<!-- Required for API Level 30 to make sure the app detect browsers
10+
(that don't support custom tabs) -->
11+
<intent>
12+
<action android:name="android.intent.action.VIEW" />
13+
<category android:name="android.intent.category.BROWSABLE" />
14+
<data android:scheme="https" />
15+
</intent>
16+
<!-- Required for API Level 30 to make sure the app can detect browsers that support custom tabs -->
17+
<!-- https://developers.google.com/web/updates/2020/07/custom-tabs-android-11#detecting_browsers_that_support_custom_tabs -->
18+
<intent>
19+
<action android:name="android.support.customtabs.action.CustomTabsService" />
20+
</intent>
21+
</queries>
22+
23+
<application
24+
android:allowBackup="true"
25+
android:icon="@mipmap/ic_launcher"
26+
android:label="@string/app_name"
27+
android:roundIcon="@mipmap/ic_launcher_round"
28+
android:supportsRtl="true"
29+
android:theme="@style/AppTheme"
30+
android:name="com.ionicframework.intune.IntuneApplication"
31+
>
32+
33+
<activity
34+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
35+
android:name="io.ionic.starter.MainActivity"
36+
android:label="@string/title_activity_main"
37+
android:theme="@style/AppTheme.NoActionBarLaunch"
38+
android:launchMode="singleTask">
39+
40+
<intent-filter>
41+
<action android:name="android.intent.action.MAIN" />
42+
<category android:name="android.intent.category.LAUNCHER" />
43+
</intent-filter>
44+
45+
</activity>
46+
47+
<!-- Must be specified to allow users to login via MSAL -->
48+
<activity android:name="com.microsoft.identity.client.BrowserTabActivity">
49+
<intent-filter>
50+
<action android:name="android.intent.action.VIEW" />
51+
52+
<category android:name="android.intent.category.DEFAULT" />
53+
<category android:name="android.intent.category.BROWSABLE" />
54+
55+
<!--
56+
Add in your scheme/host from registered redirect URI
57+
note that the leading "/" is required for android:path
58+
-->
59+
<!--
60+
<data
61+
android:host="io.ionic.starter"
62+
android:path="/5Lmt5lmx4ECI4NqjLePe1rm/ji0="
63+
android:scheme="msauth" />
64+
-->
65+
<data
66+
android:host="io.ionic.starter"
67+
android:path="/uHU+Ui09K1zPjWX4mZFggrgz+rk="
68+
android:scheme="msauth" />
69+
</intent-filter>
70+
</activity>
71+
72+
<provider
73+
android:name="androidx.core.content.FileProvider"
74+
android:authorities="${applicationId}.fileprovider"
75+
android:exported="false"
76+
android:grantUriPermissions="true">
77+
<meta-data
78+
android:name="android.support.FILE_PROVIDER_PATHS"
79+
android:resource="@xml/file_paths"></meta-data>
80+
</provider>
81+
</application>
82+
83+
<!-- Permissions -->
84+
85+
<uses-permission android:name="android.permission.INTERNET" />
86+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"appId": "io.ionic.starter",
3+
"appName": "ionic-intune-demo",
4+
"webDir": "build",
5+
"bundledWebRuntime": false
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[
2+
{
3+
"pkg": "@capacitor/app",
4+
"classpath": "com.capacitorjs.plugins.app.AppPlugin"
5+
},
6+
{
7+
"pkg": "@capacitor/haptics",
8+
"classpath": "com.capacitorjs.plugins.haptics.HapticsPlugin"
9+
},
10+
{
11+
"pkg": "@capacitor/keyboard",
12+
"classpath": "com.capacitorjs.plugins.keyboard.KeyboardPlugin"
13+
},
14+
{
15+
"pkg": "@ionic-enterprise/intune",
16+
"classpath": "com.ionicframework.intune.IntunePlugin"
17+
}
18+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package io.ionic.starter;
2+
3+
import com.getcapacitor.BridgeActivity;
4+
5+
public class MainActivity extends BridgeActivity {}
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)