diff --git a/.gitignore b/.gitignore index 9a4962b..aa724b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,198 +1,15 @@ - -# Created by https://www.toptal.com/developers/gitignore/api/android,androidstudio,kotlin,firebase -# Edit at https://www.toptal.com/developers/gitignore?templates=android,androidstudio,kotlin,firebase - -### Android ### -# Gradle files -.gradle/ -build/ - -# Local configuration file (sdk path, etc) -local.properties - -# Log/OS Files -*.log - -# Android Studio generated files and folders -captures/ -.externalNativeBuild/ -.cxx/ -*.apk -output.json - -# IntelliJ *.iml -.idea/ -misc.xml -deploymentTargetDropDown.xml -render.experimental.xml - -# Keystore files -*.jks -*.keystore - -# Google Services (e.g. APIs or Firebase) -google-services.json - -# Android Profiling -*.hprof - -### Android Patch ### -gen-external-apklibs - -# Replacement of .externalNativeBuild directories introduced -# with Android Studio 3.5. - -### Firebase ### -.idea -**/node_modules/* -**/.firebaserc - -### Firebase Patch ### -.runtimeconfig.json -.firebase/ - -### Kotlin ### -# Compiled class file -*.class - -# Log file - -# BlueJ files -*.ctxt - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* -replay_pid* - -### AndroidStudio ### -# Covers files to be ignored for android development using Android Studio. - -# Built application files -*.ap_ -*.aab - -# Files for the ART/Dalvik VM -*.dex - -# Java class files - -# Generated files -bin/ -gen/ -out/ - -# Gradle files .gradle - -# Signing files -.signing/ - -# Local configuration file (sdk path, etc) - -# Proguard folder generated by Eclipse -proguard/ - -# Log Files - -# Android Studio -/*/build/ -/*/local.properties -/*/out -/*/*/build -/*/*/production -.navigation/ -*.ipr -*~ -*.swp - -# Keystore files - -# Google Services (e.g. APIs or Firebase) -# google-services.json - -# Android Patch - -# External native build folder generated in Android Studio 2.2 and later +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures .externalNativeBuild - -# NDK -obj/ - -# IntelliJ IDEA -*.iws -/out/ - -# User-specific configurations -.idea/ -.idea/caches/ -.idea/libraries/ -.idea/shelf/ -.idea/workspace.xml -.idea/tasks.xml -.idea/.name -.idea/compiler.xml -.idea/copyright/profiles_settings.xml -.idea/encodings.xml -.idea/misc.xml -.idea/modules.xml -.idea/scopes/scope_settings.xml -.idea/dictionaries -.idea/vcs.xml -.idea/jsLibraryMappings.xml -.idea/datasources.xml -.idea/dataSources.ids -.idea/sqlDataSources.xml -.idea/dynamic.xml -.idea/uiDesigner.xml -.idea/assetWizardSettings.xml -.idea/gradle.xml -.idea/jarRepositories.xml -.idea/navEditor.xml - -# Legacy Eclipse project files -.classpath -.project -.cproject -.settings/ - -# Mobile Tools for Java (J2ME) - -# Package Files # - -# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) - -## Plugin-specific files: - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Mongo Explorer plugin -.idea/mongoSettings.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -### AndroidStudio Patch ### - -!/gradle/wrapper/gradle-wrapper.jar - -# End of https://www.toptal.com/developers/gitignore/api/android,androidstudio,kotlin,firebase \ No newline at end of file +.cxx +local.properties diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..1480dda --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +OneSignal Android Sample \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..36256d4 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..a9f4e52 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..217e5c5 --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..9f71c83 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index a0c9445..8b8e451 100644 --- a/README.md +++ b/README.md @@ -18,4 +18,73 @@ In Android Studio: * File --> Open * You select the route where you made the 'clone' of the project, select and OK. -* That's all and run example. \ No newline at end of file +* That's all and run example. + + +![OneSignal](https://github.com/OneSignal/.github/blob/439e36ade56b001643ff3b07eeaf95b20129f3e6/assets/onesignal-banner.png) + +
+ Quickstart +   •   + Website +   •   + Docs +   •   + Examples +
+
+
+ +# OneSignal [**XYZ SDK**] Sample + +OneSignal makes engaging customers simple and is the fastest, most reliable service to send push notifications, in-app messages, SMS, and emails. + +This project demonstrates sending push notifications using [**OneSignal XYZ SDK**]. You can use this project as a boilerplate or reference to start your project. + +## 🚦 Getting started + +Thi s project assumes that you already have a OneSignal app created with push notifications setup. If you don't yet have a OneSignal app, [create one](https://documentation.onesignal.com/docs/apps-organizations#create-an-app) first, then follow the steps below to integrate the OneSignal SDK into your [Android](https://documentation.onesignal.com/docs/android-sdk-setup) or [iOS](https://documentation.onesignal.com/docs/ios-sdk-setup) app. + +```md +1. Step 1 +2. Step 2 +3. Step 3 +``` + +[☝️ replace with actual steps] + +[Add relevant code snippets or additional context if necessary] + +# Support + +## Ask a question about OneSignal + +You can ask questions about the OneSignal xxx SDK and related topics in the **onesignal-xxx-sdk** repository. + +🙋‍♂️ [Ask a question](#) + +[☝️ Update link to SDK repo issue template] + +## Create a bug report + +If you receive an error message or get blocked by an issue, please create a bug report! + +🪳 [Create bug report](#) + +[☝️ Update link to SDK repo issue template] + +# ❤️ Developer Community + +For additional resources, please join the [OneSignal Developer Community](https://onesignal.com/onesignal-developers). + +Get in touch with us or learn more about OneSignal through the channels below. + +- [Follow us on Twitter](https://twitter.com/onesignaldevs) to never miss any updates from the OneSignal team, ecosystem & community +- [Join us on Discord](https://discord.gg/EP7gf6Uz7G) to be a part of the OneSignal Developers community, showcase your work and connect with other OneSignal developers +- [Read the OneSignal Blog](https://onesignal.com/blog/) for the latest announcements, tutorials, in-depth articles & more. +- [Subscribe to us on YouTube](https://www.youtube.com/channel/UCe63d5EDQsSkOov-bIE_8Aw/featured) for walkthroughs, courses, talks, workshops & more. +- [Follow us on Twitch](https://www.twitch.tv/onesignaldevelopers) for live streams, office hours, support & more. + +## Show your support + +Give a ⭐️ if this project helped you, and watch this repo to stay up to date. diff --git a/app/build.gradle b/app/build.gradle index 0538a81..9df06d8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,16 +1,16 @@ plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' - id 'com.google.gms.google-services' } android { - compileSdk 32 + namespace 'com.onesignal.sample.android' + compileSdk 33 defaultConfig { - applicationId "dev.lizarraga.onesignal" - minSdk 21 - targetSdk 32 + applicationId "com.onesignal.sample.android" + minSdk 24 + targetSdk 33 versionCode 1 versionName "1.0" @@ -33,17 +33,13 @@ android { } dependencies { - implementation 'androidx.core:core-ktx:1.7.0' - implementation 'androidx.appcompat:appcompat:1.4.1' - implementation 'com.google.android.material:material:1.6.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.3' - - implementation platform('com.google.firebase:firebase-bom:30.0.0') - implementation 'com.google.firebase:firebase-analytics-ktx' - - implementation 'com.onesignal:OneSignal:[4.0.0, 4.99.99]' + implementation 'androidx.core:core-ktx:1.8.0' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.5.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'com.onesignal:OneSignal:[5.0.0-beta, 5.99.99]' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' } \ No newline at end of file diff --git a/app/src/androidTest/java/dev/lizarraga/onesignal/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/onesignal/sample/android/ExampleInstrumentedTest.kt similarity index 83% rename from app/src/androidTest/java/dev/lizarraga/onesignal/ExampleInstrumentedTest.kt rename to app/src/androidTest/java/com/onesignal/sample/android/ExampleInstrumentedTest.kt index 6f6404a..b44ef6b 100644 --- a/app/src/androidTest/java/dev/lizarraga/onesignal/ExampleInstrumentedTest.kt +++ b/app/src/androidTest/java/com/onesignal/sample/android/ExampleInstrumentedTest.kt @@ -1,4 +1,4 @@ -package dev.lizarraga.onesignal +package com.onesignal.sample.android import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -19,6 +19,6 @@ class ExampleInstrumentedTest { fun useAppContext() { // Context of the app under test. val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("dev.lizarraga.onesignal", appContext.packageName) + assertEquals("com.onesignal.sample.android", appContext.packageName) } } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 036bea7..3ac16b1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,18 +1,17 @@ + xmlns:tools="http://schemas.android.com/tools"> (R.id.enable_push).setOnClickListener( + { + OneSignal.User.pushSubscription.optIn() + } + ) + findViewById