-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Refactor Ionic/Capacitor/Cordova Wizards #5093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ab4065c
Update Ionic Wizard
lucas-zimerman 2eb162a
Update Capacitor Wizard
lucas-zimerman 262acde
Update Cordova Wizard
lucas-zimerman e4aec17
update capacitor wizard
lucas-zimerman dddc063
Update ionic wizard
lucas-zimerman d8513f2
update install steps on capacitor
lucas-zimerman dc04e62
Update troubleshooting.mdx
lucas-zimerman 54d9ea8
Apply suggestions from code review
lucas-zimerman f5b98fc
Update src/platforms/javascript/guides/capacitor/troubleshooting.mdx
lucas-zimerman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -25,7 +25,13 @@ npm install --save @sentry/capacitor @sentry/tracing | |
yarn add @sentry/capacitor | ||
``` | ||
|
||
## Android Installation | ||
## Capacitor 2 - Android Installation | ||
|
||
<Note> | ||
|
||
This step is not needed if you are using Capacitor 3 | ||
|
||
</Note> | ||
|
||
Then, add the `SentryCapacitor` plugin class inside the `onCreate` method of your `MainActivity` file. | ||
|
||
|
@@ -59,7 +65,7 @@ import com.getcapacitor.Plugin | |
import io.sentry.capacitor.SentryCapacitor | ||
|
||
class MainActivity : BridgeActivity() { | ||
fun onCreate(savedInstanceState: Bundle?) { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
// Initializes the Bridge | ||
this.init( | ||
|
@@ -78,26 +84,26 @@ With Ionic/Angular: | |
|
||
```typescript | ||
// app.module.ts | ||
import * as Sentry from "@sentry/capacitor"; | ||
import * as SentryAngular from "@sentry/angular"; | ||
import * as Sentry from '@sentry/capacitor'; | ||
import * as SentryAngular from '@sentry/angular'; | ||
// If taking advantage of automatic instrumentation (highly recommended) | ||
import { BrowserTracing } from "@sentry/tracing"; | ||
import { BrowserTracing } from '@sentry/tracing'; | ||
// Or, if only manually tracing | ||
// import "@sentry/tracing"; | ||
// Note: You MUST import the package in some way for tracing to work | ||
|
||
Sentry.init( | ||
{ | ||
dsn: "___PUBLIC_DSN___", | ||
dsn: '___PUBLIC_DSN___', | ||
// To set your release and dist versions | ||
release: "my-project-name@" + process.env.npm_package_version, | ||
dist: "1", | ||
release: 'my-project-name@' + process.env.npm_package_version, | ||
dist: '1', | ||
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring. | ||
// We recommend adjusting this value in production. | ||
tracesSampleRate: 1.0, | ||
integrations: [ | ||
new BrowserTracing({ | ||
tracingOrigins: ["localhost", "https://yourserver.io/api"], | ||
tracingOrigins: ['localhost', 'https://yourserver.io/api'], | ||
}), | ||
] | ||
}, | ||
|
@@ -120,15 +126,15 @@ Standalone: | |
|
||
```javascript | ||
// App.js | ||
import * as Sentry from "@sentry/capacitor"; | ||
import * as Sentry from '@sentry/capacitor'; | ||
|
||
Sentry.init({ | ||
dsn: "___PUBLIC_DSN___", | ||
dsn: '___PUBLIC_DSN___', | ||
|
||
// Set your release version, such as "[email protected]" | ||
release: "my-project-name@<release-name>", | ||
// Set your release version, such as '[email protected]' | ||
release: 'my-project-name@<release-name>', | ||
// Set your dist version, such as "1" | ||
dist: "<dist>", | ||
dist: '<dist>', | ||
}); | ||
``` | ||
|
||
|
@@ -137,22 +143,22 @@ Sentry.init({ | |
This snippet includes an intentional error, so you can test that everything is working as soon as you set it up: | ||
|
||
```javascript | ||
import * as Sentry from "@sentry/capacitor"; | ||
import * as Sentry from '@sentry/capacitor'; | ||
|
||
Sentry.captureException("Test Captured Exception"); | ||
Sentry.captureException('Test Captured Exception'); | ||
``` | ||
|
||
You can also throw an error anywhere in your application: | ||
|
||
```javascript | ||
// Must be thrown after Sentry.init is called to be captured. | ||
throw new Error(`Test Thrown Error`); | ||
throw new Error('Test Thrown Error'); | ||
``` | ||
|
||
Or trigger a native crash: | ||
|
||
```javascript | ||
import * as Sentry from "@sentry/capacitor"; | ||
import * as Sentry from '@sentry/capacitor'; | ||
|
||
Sentry.nativeCrash(); | ||
``` |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.