-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from capacitor-community/crashes-android-support
Crashes android support
- Loading branch information
Showing
73 changed files
with
1,259 additions
and
366 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# Change Log | ||
|
||
## 0.4.0 | ||
|
||
* adding Android support | ||
|
||
## 0.3.1 | ||
|
||
* Update `Appcenter/Analytics` to 4.2.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
appcenter-crashes/android/gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.mycompany.plugins.example"> | ||
package="com.getcapacitor.plugin.appcenter.crashes"> | ||
</manifest> |
38 changes: 38 additions & 0 deletions
38
...-crashes/android/src/main/java/com/getcapacitor/plugin/appcenter/crashes/CrashesBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.getcapacitor.plugin.appcenter.crashes; | ||
|
||
import com.microsoft.appcenter.AppCenter; | ||
import com.microsoft.appcenter.crashes.Crashes; | ||
|
||
public class CrashesBase { | ||
|
||
public void enable(boolean enabled) { | ||
Crashes.setEnabled(enabled).get(); | ||
} | ||
|
||
public boolean isEnabled() { | ||
return Crashes.isEnabled().get(); | ||
} | ||
|
||
public void start() { | ||
if (AppCenter.isConfigured()) { | ||
AppCenter.start(Crashes.class); | ||
} | ||
} | ||
|
||
public void generateTestCrash() { | ||
Crashes.generateTestCrash(); | ||
} | ||
|
||
public boolean hasReceivedMemoryWarningInLastSession() { | ||
return Crashes.hasReceivedMemoryWarningInLastSession().get(); | ||
} | ||
|
||
public boolean hasCrashedInLastSession() { | ||
return Crashes.hasCrashedInLastSession().get(); | ||
} | ||
|
||
// public void lastSessionCrashReport() { | ||
// return Crashes.lastSessionCrashReport().get() | ||
// } | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
...rashes/android/src/main/java/com/getcapacitor/plugin/appcenter/crashes/CrashesPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.getcapacitor.plugin.appcenter.crashes; | ||
|
||
import com.getcapacitor.JSObject; | ||
import com.getcapacitor.Plugin; | ||
import com.getcapacitor.PluginCall; | ||
import com.getcapacitor.PluginMethod; | ||
import com.getcapacitor.annotation.CapacitorPlugin; | ||
|
||
import com.microsoft.appcenter.AppCenter; | ||
import com.microsoft.appcenter.crashes.Crashes; | ||
import com.microsoft.appcenter.reactnative.shared.AppCenterReactNativeShared; | ||
|
||
@CapacitorPlugin(name = "Crashes") | ||
public class CrashesPlugin extends Plugin { | ||
|
||
private CrashesBase implementation = new CrashesBase(); | ||
|
||
@Override | ||
public void load() { | ||
AppCenterReactNativeShared.configureAppCenter(this.getActivity().getApplication()); | ||
implementation.start(); | ||
} | ||
|
||
@PluginMethod(returnType = PluginMethod.RETURN_NONE) | ||
public void setEnable(PluginCall call) { | ||
implementation.enable(call.getBoolean("enable", false)); | ||
call.resolve(); | ||
} | ||
|
||
@PluginMethod | ||
public void isEnabled(PluginCall call) { | ||
JSObject ret = new JSObject(); | ||
ret.put("value", implementation.isEnabled()); | ||
call.resolve(ret); | ||
} | ||
|
||
@PluginMethod(returnType = PluginMethod.RETURN_NONE) | ||
public void generateTestCrash(PluginCall call) { | ||
implementation.generateTestCrash(); | ||
call.resolve(); | ||
} | ||
|
||
@PluginMethod | ||
public void hasReceivedMemoryWarningInLastSession(PluginCall call) { | ||
JSObject ret = new JSObject(); | ||
ret.put("value", implementation.hasReceivedMemoryWarningInLastSession()); | ||
call.resolve(ret); | ||
} | ||
|
||
@PluginMethod | ||
public void hasCrashedInLastSession(PluginCall call) { | ||
JSObject ret = new JSObject(); | ||
ret.put("value", implementation.hasCrashedInLastSession()); | ||
call.resolve(ret); | ||
} | ||
|
||
@PluginMethod | ||
public void lastSessionCrashReport(PluginCall call) { | ||
call.unimplemented("Not yet implemented on Android."); | ||
} | ||
|
||
} |
8 changes: 0 additions & 8 deletions
8
appcenter-crashes/android/src/main/java/com/mycompany/plugins/example/AppCenterCrashes.java
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
...r-crashes/android/src/main/java/com/mycompany/plugins/example/AppCenterCrashesPlugin.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore | ||
|
||
# Built application files | ||
*.apk | ||
*.aar | ||
*.ap_ | ||
*.aab | ||
|
||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ | ||
# Uncomment the following line in case you need and you don't have the release build type files in your app | ||
# release/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
# IntelliJ | ||
*.iml | ||
.idea/workspace.xml | ||
.idea/tasks.xml | ||
.idea/gradle.xml | ||
.idea/assetWizardSettings.xml | ||
.idea/dictionaries | ||
.idea/libraries | ||
# Android Studio 3 in .gitignore file. | ||
.idea/caches | ||
.idea/modules.xml | ||
# Comment next line if keeping position of elements in Navigation Editor is relevant for you | ||
.idea/navEditor.xml | ||
|
||
# Keystore files | ||
# Uncomment the following lines if you do not want to check your keystore files in. | ||
#*.jks | ||
#*.keystore | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
.externalNativeBuild | ||
.cxx/ | ||
|
||
# Google Services (e.g. APIs or Firebase) | ||
# google-services.json | ||
|
||
# Freeline | ||
freeline.py | ||
freeline/ | ||
freeline_project_description.json | ||
|
||
# fastlane | ||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots | ||
fastlane/test_output | ||
fastlane/readme.md | ||
|
||
# Version control | ||
vcs.xml | ||
|
||
# lint | ||
lint/intermediates/ | ||
lint/generated/ | ||
lint/outputs/ | ||
lint/tmp/ | ||
# lint/reports/ | ||
|
||
# Android Profiling | ||
*.hprof | ||
|
||
# Cordova plugins for Capacitor | ||
capacitor-cordova-android-plugins | ||
|
||
# Copied web assets | ||
app/src/main/assets/public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/build/* | ||
!/build/.npmkeep |
Oops, something went wrong.