Giter VIP home page Giter VIP logo

com.williamrijksen.onesignal's Introduction

Titanium OneSignal Build Status

This module gives you the possibility to integrate OneSignal into you're Appcelerator Android or iOS-application. It's even possible to target people by registering tags.

Where to get it:

Please check https://github.com/williamrijksen/com.williamrijksen.onesignal/releases to download latest releases of the module.

Generate Credentials

Before setting up the Titanium SDK, you must generate the appropriate credentials for the platform(s) you are releasing on:

Follow Guide

Setup

  1. Integrate the module into the modules folder and define them into the tiapp.xml file:

    <modules>
      <module platform="iphone" version="2.1.1">com.williamrijksen.onesignal</module>
      <module platform="android" version="2.1.1">com.williamrijksen.onesignal</module>
    </modules>
  2. Configure your app into the App Settings panel for the right Platform (Android and/or iOS).

  3. To use OneSignal on iOS devices, register the OneSignal-appId into tiapp.xml:

    <property name="OneSignal_AppID" type="string">[App-id]</property>
  4. To use OneSignal on Android devices, register some meta-data as well:

    <meta-data android:name="onesignal_app_id"
                   android:value="[App-id]" />
  5. To use rich notifications on iOS 10 you need to add an extension to your app. To do so see:

Usage

  1. Register device for Push Notifications

        // This registers your device automatically into OneSignal
        var onesignal = require('com.williamrijksen.onesignal');
  2. On iOS you'll need to request permission to use notifications:

        onesignal.promptForPushNotificationsWithUserResponse(function(obj) {
            alert(JSON.stringify(obj));
        });
  3. To add the possibility to target people for notifications, send a tag:

        onesignal.sendTag({ key: 'foo', value: 'bar' });
  4. Delete tag:

        onesignal.deleteTag({ key: 'foo' });
  5. Get tags:

        onesignal.getTags(function(e) {
            if (!e.success) {
                Ti.API.error("Error: " + e.error);
                return
            }
    
            Ti.API.info(Ti.Platform.osname === "iphone"? e.results : JSON.parse(e.results));
        });
  6. Set External User ID:

        onesignal.setExternalUserId('your_db_user_id');
  7. Remove External User ID:

        onesignal.removeExternalUserId();
  8. Get if user is subscribed (Boolean):

        var subscribed = onesignal.retrieveSubscribed();
  9. Get One Signal Player ID (String):

        var res = onesignal.retrievePlayerId();
  10. Get One Signal Token (String):

        var token = onesignal.retrieveToken();
  11. Get Permission Subscription State (iOS-only for now):

        var res = onesignal.getPermissionSubscriptionState();
        /* res example:
            {
                "subscriptionStatus": {
                    "userSubscriptionSetting": true,
                    "subscribed": false,
                    "userId": "123-123-123-123-123456789",
                    "pushToken": null
                },
                "permissionStatus": {
                    "status": 2,
                    "provisional": false,
                    "hasPrompted": true
                },
                "emailSubscriptionStatus": {
                    "emailAddress": null,
                    "emailUserId": null
                }
            }
        */
  12. postNotification (iOS-only for now):

        //You can use idsAvailable for retrieving a playerId
        onesignal.postNotification({
            message:'Titanium test message',
            playerIds:["00000000-0000-0000-0000-000000000000"]
        });
  13. Set log level (iOS-only for now):

        onesignal.setLogLevel({
            logLevel: onesignal.LOG_LEVEL_DEBUG,
            visualLevel: onesignal.LOG_LEVEL_NONE
        });
  14. Opened listener:
    The returned content is matching the available payload on OneSignal:

    onesignal.addEventListener('notificationOpened', function (evt) {
        alert(evt);
        if (evt) {
            var title = '';
            var content = '';
            var data = {};
    
            if (evt.title) {
                title = evt.title;
            }
    
            if (evt.body) {
                content = evt.body;
            }
    
            if (evt.additionalData) {
                if (Ti.Platform.osname === 'android') {
                    // Android receives it as a JSON string
                    data = JSON.parse(evt.additionalData);
                } else {
                    data = evt.additionalData;
                }
            }
        }
        alert("Notification opened! title: " + title + ', content: ' + content + ', data: ' + evt.additionalData);
    });
  15. Received listener: The returned content is matching the available payload on OneSignal:

    onesignal.addEventListener('notificationReceived', function(evt) {
        console.log(' ***** Received! ' + JSON.stringify(evt));
    });

Cheers!

Build yourself

iOS

If you already have Titanium installed, skip the first 2 steps, if not let's install Titanium locally.

  1. brew install yarn --without-node to install yarn without relying on a specific Node version
  2. In the root directory execute yarn install
  3. Step into the ios directory
  4. If you want to update the OneSignal SDK:
  • Run carthage update
  • Drag and drop the OneSignal.framework from Carthage/Build/iOS to platform
  1. Alter the titanium.xcconfig to build with the preferred SDK
  2. To build the module execute rm -rf build && ../node_modules/.bin/ti build -p ios --build-only

Android

  1. brew install yarn --without-node to install yarn without relying on a specific Node version
  2. In the root directory execute yarn install
  3. Step into the android directory
  4. Copy build.properties.dist to build.properties and edit to match your environment
  5. To build the module execute rm -rf build && mkdir -p build/docs && ../node_modules/.bin/ti build -p android --build-only

Google Play Services

Since Titanium 7.x this module relies on https://github.com/appcelerator-modules/ti.playservices

If you still need to support Titanium 6.x and you need to change the used Google Play Services version, execute the following actions:

  1. Install the Google Play Services on your system:

    sdkmanager "extras;google;m2repository"
  2. Fetch the 4 needed *.aar files from the SDK path extras/google/m2repository/com/google/android/gms

    • base
    • basement
    • gcm
    • idd
    • location

    For the version you want use.

  3. Extract the *.aar file, and rename the classes.jar to google-play-services-<part>.jar.

  4. Update the used jars in the lib folder.

  5. Update the res folder with the one from the google-play-services-basement.jar

com.williamrijksen.onesignal's People

Contributors

abdullahfaqeir avatar aduptoro avatar aurusapps avatar chmiiller avatar hansemannn avatar janvennemann avatar jvandijk avatar topener avatar williamrijksen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

com.williamrijksen.onesignal's Issues

Can't RUN on iOS. App crashes on require('com.williamrijksen.onesignal');

The app crashes immediately when it encounters the line

var onesignal = require('com.williamrijksen.onesignal');

This happens when I "run" in development mode or package and deploy via TestFlight. The module works fine, receives messages, etc. when I run it in debug mode. Android works fine in any mode.

Ti SDK 5.5.1
Module versions 1.2.1 and 1.3
Latest release versions of Studio, XCode, etc.

Any pointers would be appreciated, thanks!

Notification Received Handler

First of all, thanks for the module! It works perfectly!
Do you have any idea on how to listen for the Payload sent together with the Push Notification on the Titanium app?
On Android SDK I've seen this handler NotificationReceivedHandler. And for iOS I was wondering if is it possible to use the Titanium callback on the Ti.Network.registerForPushNotifications(). Do you think this is gonna work?
I might start implementing the Android version tomorrow, so let me know what do you think =)

Android: Module Conflicting with ti.map on Ti 6.0.1.GA

#Hi,

I'm trying the module version 1.3.0 on Ti SDK 6.0.1.GA but it is conflicting with vanilla ti.map.

When i try to build the app with the onesignal module I get the following error:

[ERROR] Conflicting jar files detected:
[ERROR]
[ERROR] The following modules have different "google-play-services-base.jar" files
[ERROR]    ti.map                         (version 3.0.1) (hash=730a1d6196847cb5b1067ac02a875876)
[ERROR]    com.williamrijksen.onesignal   (version 1.3.0) (hash=68b48e0a3cb3582bd4ab0bb00625b83a)
[ERROR]
[ERROR] You can either select a version of these modules where the conflicting jar file is the same or you
[ERROR] can try copying the jar file from one module's "lib" folder to the other module's "lib" folder.

I have tried to delete google-play-services-base.jar and the app compiles and dexes normally but when the app runs it gives a lot of errors regarding the google-play-services version.

Anybody managed to run this module together with ti.map on 6.0.1.GA successfully? If so what have you done regarding the conflicting google-play-services jars?

Thanks!

onesignal.idsAvailable even not getting called

Setup done properly onesignal.idsAvailable even not getting called even after the permission for push notification allowed.
In the steps which mentioned there, I didn't do the 5th step Since for me all basic push notification. What am I missing here?

inFocusDisplaying

I tried setting below but I still get message alert when app is in foreground. Please let me know how to suppress notification alert message when app is in foreground.
var onesignal = require('com.williamrijksen.onesignal');
onesignal.inFocusDisplaying = onesignal.Notification;

Naming

is it possible to rename this repo into Ti.OneSignal (for better finding of it)?

Android Notification receive issue in latest devices

I am using appcelerator, facing problem in receiving push notification in android oneplus 3 and above phones, also in Mi4i and many more phones with Oreo OS.
When app is in background or in foreground it receives notification, but when I remove app from my doc, then I am facing problem.

I got this error:-
broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=com.demo.notification (has extras) }

After looking over this, it shows that the service is been killed when you remove your app from doc list.
Kindly look after this issue it is very critical. Thanks in advance.

NSInvalidArgumentException Crash

During the `registerForPushNotifications() call I'm receiving an exception that is causing a crash.

This was working at some point in this app so I'm not entirely sure what changed...

Mar 31 14:32:10 iPhone APP(CoreFoundation)[6452] <Notice>: -[ComWilliamrijksenOnesignalModule application:didRegisterForRemoteNotificationsWithDeviceToken:]: unrecognized selector sent to instance 0x100d24b30
Mar 31 14:32:10 iPhone APP[6452] <Notice>: [ERROR] The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
Reason:
-[ComWilliamrijksenOnesignalModule application:didRegisterForRemoteNotificationsWithDeviceToken:]: unrecognized selector sent to instance 0x100d24b30
Stack trace:

0   CoreFoundation                      0x000000018702afd8 <redacted> + 124
1   libobjc.A.dylib                     0x0000000185a8c538 objc_exception_throw + 56
2   CoreFoundation                      0x0000000187031ef4 <redacted> + 0
3   CoreFoundation                      0x000000018702ef4c <redacted> + 916
4   CoreFoundation                      0x0000000186f2ad2c _CF_forwarding_prep_0 + 92
5   APP                                       0x000000010014be08 APP + 1359368
6   APP                                       0x0000000100245f90 APP + 2383760
7   libdispatch.dylib                   0x0000000185ee29e0 <redacted> + 24
8   libdispatch.dylib                   0x0000000185ee29a0 <redacted> + 16
9   libdispatch.dylib                   0x0<\M-b\M^@\M-&>
Mar 31 14:32:10 iPhone APP(CoreFoundation)[6452] <Notice>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ComWilliamrijksenOnesignalModule application:didRegisterForRemoteNotificationsWithDeviceToken:]: unrecognized selector sent to instance 0x100d24b30'

Missing libraries

Hi,
i got this error compiling for ios and for android as well.
I'm using titanium 6.0.3.

I know i'm doing something wrong but i don't know what.

IOS
[ERROR] : Module com.williamrijksen.onesignal version 1.5.0 is missing library file: /Users/alessandrofranchini/Library/Application Support/Titanium/modules/iphone/com.williamrijksen.onesignal/1.5/libcom.williamrijksen.onesignal.a
ANDROID
[ERROR] : art: dlopen("/data/app/it.genomedics.rivistamedia-1/lib/arm/libcom.mykingdom.mupdf.so", RTLD_LAZY) failed: dlopen failed: could not load library "libstlport_shared.so" needed by "libcom.mykingdom.mupdf.so"; caused by library "libstlport_shared.so" not found [ERROR] : TiApplication: (KrollRuntimeThread) [88,600] Sending event: exception on thread: KrollRuntimeThread msg:java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "libstlport_shared.so" needed by "libcom.mykingdom.mupdf.so"; caused by library "libstlport_shared.so" not found; Titanium 6.0.3,2017/03/22 12:00,undefined [ERROR] : TiApplication: java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "libstlport_shared.so" needed by "libcom.mykingdom.mupdf.so"; caused by library "libstlport_shared.so" not found [ERROR] : TiApplication: at java.lang.Runtime.loadLibrary(Runtime.java:371) [ERROR] : TiApplication: at java.lang.System.loadLibrary(System.java:989) [ERROR] : TiApplication: at org.appcelerator.kroll.runtime.v8.V8Runtime.loadExternalModules(V8Runtime.java:151) [ERROR] : TiApplication: at org.appcelerator.kroll.runtime.v8.V8Runtime.initRuntime(V8Runtime.java:118) [ERROR] : TiApplication: at org.appcelerator.kroll.KrollRuntime.doInit(KrollRuntime.java:205) [ERROR] : TiApplication: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:114) [ERROR] : AndroidRuntime: FATAL EXCEPTION: KrollRuntimeThread [ERROR] : AndroidRuntime: Process: it.genomedics.rivistamedia, PID: 18023 [ERROR] : AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "libstlport_shared.so" needed by "libcom.mykingdom.mupdf.so"; caused by library "libstlport_shared.so" not found [ERROR] : AndroidRuntime: at java.lang.Runtime.loadLibrary(Runtime.java:371) [ERROR] : AndroidRuntime: at java.lang.System.loadLibrary(System.java:989) [ERROR] : AndroidRuntime: at org.appcelerator.kroll.runtime.v8.V8Runtime.loadExternalModules(V8Runtime.java:151) [ERROR] : AndroidRuntime: at org.appcelerator.kroll.runtime.v8.V8Runtime.initRuntime(V8Runtime.java:118) [ERROR] : AndroidRuntime: at org.appcelerator.kroll.KrollRuntime.doInit(KrollRuntime.java:205) [ERROR] : AndroidRuntime: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:114)

Warnings in onesignal event

When I use my objects for example inside onesignal.idsAvailable(function(e) {}); I receive many warning and relative errors that I'm creating a object in differente context than the calling function, for example:

Creating [object TiDatabase] in a different context than the calling function
Creating [object TiAppProperties] in a different context than the calling function

How can be fixed?
I have read that can be a problem between js and objective-c ... http://noodlecode.net/2016/08/creating-object-in-a-different-context-than-the-calling-function/

Implementation of getTags (Android)

Hi,

Not sure how others are doing it, but its currently not possible to clear tags of a user without knowing which tags were set in the absence of getTags and deleteTags methods in the module.

A work around would be to maintain a property (like a cookie) in the app but this method is causing redundancy of data (tags are being maintained and referred in both client app and onesignal servers) and is also flawed if a user does a data clear on Android.

Is there any plans to implement the 2 mentioned methods anytime soon?

[iOS] handleNotificationReceived when app is closed

Add support for handleNotificationReceived: it detects when user opens a notification from outside the app and provides the additionalData already, but unfortunately, it doesn't work when the app is completely closed, don't know why =/

@hansemannn said:
" it's because it needs to listen to the core TiApp class to get notified and linking to that required the method to be in the class method "load""

But I don't know how to implement it.

Issue with Android??

I am not sure if this is an issue, or am I doing something wrong? Below is the screenshot. It is working for iOS, but for android, the module is just not being recognized. Please advise.
http://prntscr.com/i3c47t

"Location point" empty

Hi,

Thanks for this perfect module !
I just have a question : I'd like to send notifications based on location but the "Location point" column in onesignal is always empty.
How can I do to complete it ?

Thanks a lot :)

Runtime disposed, cannot fire event 'notificationReceived'

Facing "Runtime disposed, cannot fire event 'notificationReceived'"
and "Runtime disposed, cannot fire event 'notificationOpened'"

On android device while app is not running(In background) both the notificationReceived & notificationOpened
method does not works
Titanium SDK : 6.2.2.GA

Verify OSNotificationPayload structure in Android

A title is an optional field for a notification. This means that its existence should be verified before use, else this happens:

java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.onesignal.OSNotificationPayload.title' on a null object reference
	at com.williamrijksen.onesignal.ComWilliamrijksenOnesignalModule$NotificationOpenedHandler.notificationOpened(ComWilliamrijksenOnesignalModule.java:96)
	at com.onesignal.OneSignal$10.run(OneSignal.java:1014)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:148)
	at android.app.ActivityThread.main(ActivityThread.java:7325)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Android Issue

I am using the recent version (2.0.0) as well as ti.playservices module. My one_signal_app_id is also correct. However, I am getting the following error.

[ERROR] : OneSignal: OneSignal AppId format is invalid.
[ERROR] : OneSignal: Example: 'b2f7f966-d8cc-11e4-bed1-df8f05be55ba'
[ERROR] : OneSignal:
[ERROR] : OneSignal: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String[] java.lang.String.split(java.lang.String)' on a null object reference
[ERROR] : OneSignal: at java.util.UUID.fromString(UUID.java:192)
[ERROR] : OneSignal: at com.onesignal.OSUtils.initializationChecker(OSUtils.java:62)
[ERROR] : OneSignal: at com.onesignal.OneSignal.init(OneSignal.java:491)
[ERROR] : OneSignal: at com.onesignal.OneSignal.init(OneSignal.java:467)
[ERROR] : OneSignal: at com.onesignal.OneSignal.access$000(OneSignal.java:79)
[ERROR] : OneSignal: at com.onesignal.OneSignal$Builder.init(OneSignal.java:283)
[ERROR] : OneSignal: at com.williamrijksen.onesignal.ComWilliamrijksenOnesignalModule.onAppCreate(ComWilliamrijksenOnesignalModule.java:65)
[ERROR] : OneSignal: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] : OneSignal: at com.appsconda.onesignal.OneSignalApplication.onCreate(OneSignalApplication.java:151)
[ERROR] : OneSignal: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
[ERROR] : OneSignal: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5403)
[ERROR] : OneSignal: at android.app.ActivityThread.-wrap2(ActivityThread.java)
[ERROR] : OneSignal: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
[ERROR] : OneSignal: at android.os.Handler.dispatchMessage(Handler.java:102)
[ERROR] : OneSignal: at android.os.Looper.loop(Looper.java:154)
[ERROR] : OneSignal: at android.app.ActivityThread.main(ActivityThread.java:6119)
[ERROR] : OneSignal: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] : OneSignal: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
[ERROR] : OneSignal: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Google Play Services error

Hey everyone!

I'm trying to use One Signal in my app but i'm facing this error:

build/android/AndroidManifest.xml:20: error: Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').

I've tried with (and without) <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/> inside the application tag.

Has anyone had this error too? I'm using SDK 6.1.1 GA, but I got the same error with every 6.0.x version. What am I doing wrong? =/

Thanks!!

Compiled Modules

Is there any chance we could get compiled modules added to the repo? I have been having all sorts of issues compiling these repositories based on versions of node and my android ndk in particular.
As an example on the android compile:
[ERROR] /Users/carmin/Library/Application Support/Titanium/mobilesdk/osx/6.1.0.GA/android/native/include/AndroidUtil.h:57:49: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]

onesignal.idsAvailable For Android

What's the way to receive the playerID for OneSignal in Android. My Scenario is, wanted to send Push Notification to each and every user from the REST API Call with out PlayerID how to Achieve it ?

App crashes on notification click

Hi,

I'm using OneSignal and your plugin for my app. All is working very well, except when I click on a received notification. In this case, the app is always crashing. Do you know this problem ?

Thanks a lot.

android notification icons

I cant seem to get anything other then the standard "bell" icon to show up in notifications. Is this supported? If so how are others getting it to work? I've tried adding to resources, etc...
BTW, guess this is not an "issue" but be great if it worked.. probably just something I'm not doing correctly...

Incompatibility with Ti.GA module

Hi, I'm getting an incompatibility issue with benbahrenburg/Ti.GA around google-play-services-base.jar.

Both modules use the same jar file.

I've tried copying it from one module to the other one (both ways) but it didn't do the trick, I still get an error upon dexer translation when trying to compile for Android using 6.2.2.GA Ti SDK.

Anyway you can help solving this issue?

I've found some leads here, there and here.

No virtual method areNotificationsEnabled()Z

I am trying to implement this android notifications but i am getting this error.
Despite the error, I can get the token, but when sending the notification from the web portal, it never arrives.

[ERROR] : art: java.lang.NoSuchMethodError: No virtual method areNotificationsEnabled()Z in class Landroid/support/v4/app/NotificationManagerCompat; or its super classes
[ERROR] : art: ----- class 'Landroid/support/v4/app/NotificationManagerCompat;' cl=0x12cca140 -----
[ERROR] : art: objectSize=516 (440 from super)
[ERROR] : art: access=0x0008.0011
[ERROR] : art: super='java.lang.Class<java.lang.Object>' (cl=0x0)
[ERROR] : art: vtable (5 entries, 11 in super):
[ERROR] : art: 0: void android.support.v4.app.NotificationManagerCompat.cancel(int)
[ERROR] : art: 1: void android.support.v4.app.NotificationManagerCompat.cancel(java.lang.String, int)
[ERROR] : art: 2: void android.support.v4.app.NotificationManagerCompat.cancelAll()
[ERROR] : art: 3: void android.support.v4.app.NotificationManagerCompat.notify(int, android.app.Notification)
[ERROR] : art: 4: void android.support.v4.app.NotificationManagerCompat.notify(java.lang.String, int, android.app.Notification)
[ERROR] : art: direct methods (7 entries):
[ERROR] : art: 0: void android.support.v4.app.NotificationManagerCompat.()
[ERROR] : art: 1: void android.support.v4.app.NotificationManagerCompat.(android.content.Context)
[ERROR] : art: 2: int android.support.v4.app.NotificationManagerCompat.access$000()
[ERROR] : art: 3: android.support.v4.app.NotificationManagerCompat android.support.v4.app.NotificationManagerCompat.from(android.content.Context)
[ERROR] : art: 4: java.util.Set android.support.v4.app.NotificationManagerCompat.getEnabledListenerPackages(android.content.Context)
[ERROR] : art: 5: void android.support.v4.app.NotificationManagerCompat.pushSideChannelQueue(android.support.v4.app.NotificationManagerCompat$Task)
[ERROR] : art: 6: boolean android.support.v4.app.NotificationManagerCompat.useSideChannelForNotification(android.app.Notification)
[ERROR] : art: static fields (14 entries):
[ERROR] : art: 0: java.lang.String android.support.v4.app.NotificationManagerCompat.ACTION_BIND_SIDE_CHANNEL
[ERROR] : art: 1: java.lang.String android.support.v4.app.NotificationManagerCompat.EXTRA_USE_SIDE_CHANNEL
[ERROR] : art: 2: android.support.v4.app.NotificationManagerCompat$Impl android.support.v4.app.NotificationManagerCompat.IMPL
[ERROR] : art: 3: int android.support.v4.app.NotificationManagerCompat.MAX_SIDE_CHANNEL_SDK_VERSION
[ERROR] : art: 4: java.lang.String android.support.v4.app.NotificationManagerCompat.SETTING_ENABLED_NOTIFICATION_LISTENERS
[ERROR] : art: 5: int android.support.v4.app.NotificationManagerCompat.SIDE_CHANNEL_BIND_FLAGS
[ERROR] : art: 6: int android.support.v4.app.NotificationManagerCompat.SIDE_CHANNEL_RETRY_BASE_INTERVAL_MS
[ERROR] : art: 7: int android.support.v4.app.NotificationManagerCompat.SIDE_CHANNEL_RETRY_MAX_COUNT
[ERROR] : art: 8: java.lang.String android.support.v4.app.NotificationManagerCompat.TAG
[ERROR] : art: 9: java.util.Set android.support.v4.app.NotificationManagerCompat.sEnabledNotificationListenerPackages
[ERROR] : art: 10: java.lang.String android.support.v4.app.NotificationManagerCompat.sEnabledNotificationListeners
[ERROR] : art: 11: java.lang.Object android.support.v4.app.NotificationManagerCompat.sEnabledNotificationListenersLock
[ERROR] : art: 12: java.lang.Object android.support.v4.app.NotificationManagerCompat.sLock
[ERROR] : art: 13: android.support.v4.app.NotificationManagerCompat$SideChannelManager android.support.v4.app.NotificationManagerCompat.sSideChannelManager
[ERROR] : art: instance fields (2 entries):
[ERROR] : art: 0: android.content.Context android.support.v4.app.NotificationManagerCompat.mContext
[ERROR] : art: 1: android.app.NotificationManager android.support.v4.app.NotificationManagerCompat.mNotificationManager
[ERROR] : art:
[ERROR] : linker: readlink('') failed: No such file or directory [fd=39]
[ERROR] : linker: warning: unable to get realpath for the library "/system/lib/hw/gralloc.sc8830.so". Will use given name.
[INFO] : art: Background sticky concurrent mark sweep GC freed 2767(247KB) AllocSpace objects, 6(108KB) LOS objects, 0%% free, 15MB/15MB, paused 5.889ms total 332.916ms
[ERROR] : art: java.lang.NoSuchMethodError: No virtual method areNotificationsEnabled()Z in class Landroid/support/v4/app/NotificationManagerCompat; or its super classes
[ERROR] : art: ----- class 'Landroid/support/v4/app/NotificationManagerCompat;' cl=0x12cca140 -----
[ERROR] : art: objectSize=516 (440 from super)
[ERROR] : art: access=0x0008.0011
[ERROR] : art: super='java.lang.Class<java.lang.Object>' (cl=0x0)
[ERROR] : art: vtable (5 entries, 11 in super):
[ERROR] : art: 0: void android.support.v4.app.NotificationManagerCompat.cancel(int)
[ERROR] : art: 1: void android.support.v4.app.NotificationManagerCompat.cancel(java.lang.String, int)
[ERROR] : art: 2: void android.support.v4.app.NotificationManagerCompat.cancelAll()
[ERROR] : art: 3: void android.support.v4.app.NotificationManagerCompat.notify(int, android.app.Notification)
[ERROR] : art: 4: void android.support.v4.app.NotificationManagerCompat.notify(java.lang.String, int, android.app.Notification)
[ERROR] : art: direct methods (7 entries):
[ERROR] : art: 0: void android.support.v4.app.NotificationManagerCompat.()
[ERROR] : art: 1: void android.support.v4.app.NotificationManagerCompat.(android.content.Context)
[ERROR] : art: 2: int android.support.v4.app.NotificationManagerCompat.access$000()
[ERROR] : art: 3: android.support.v4.app.NotificationManagerCompat android.support.v4.app.NotificationManagerCompat.from(android.content.Context)
[ERROR] : art: 4: java.util.Set android.support.v4.app.NotificationManagerCompat.getEnabledListenerPackages(android.content.Context)
[ERROR] : art: 5: void android.support.v4.app.NotificationManagerCompat.pushSideChannelQueue(android.support.v4.app.NotificationManagerCompat$Task)
[ERROR] : art: 6: boolean android.support.v4.app.NotificationManagerCompat.useSideChannelForNotification(android.app.Notification)
[ERROR] : art: static fields (14 entries):
[ERROR] : art: 0: java.lang.String android.support.v4.app.NotificationManagerCompat.ACTION_BIND_SIDE_CHANNEL
[ERROR] : art: 1: java.lang.String android.support.v4.app.NotificationManagerCompat.EXTRA_USE_SIDE_CHANNEL
[ERROR] : art: 2: android.support.v4.app.NotificationManagerCompat$Impl android.support.v4.app.NotificationManagerCompat.IMPL
[ERROR] : art: 3: int android.support.v4.app.NotificationManagerCompat.MAX_SIDE_CHANNEL_SDK_VERSION
[ERROR] : art: 4: java.lang.String android.support.v4.app.NotificationManagerCompat.SETTING_ENABLED_NOTIFICATION_LISTENERS
[ERROR] : art: 5: int android.support.v4.app.NotificationManagerCompat.SIDE_CHANNEL_BIND_FLAGS
[ERROR] : art: 6: int android.support.v4.app.NotificationManagerCompat.SIDE_CHANNEL_RETRY_BASE_INTERVAL_MS
[ERROR] : art: 7: int android.support.v4.app.NotificationManagerCompat.SIDE_CHANNEL_RETRY_MAX_COUNT
[ERROR] : art: 8: java.lang.String android.support.v4.app.NotificationManagerCompat.TAG
[ERROR] : art: 9: java.util.Set android.support.v4.app.NotificationManagerCompat.sEnabledNotificationListenerPackages
[ERROR] : art: 10: java.lang.String android.support.v4.app.NotificationManagerCompat.sEnabledNotificationListeners
[ERROR] : art: 11: java.lang.Object android.support.v4.app.NotificationManagerCompat.sEnabledNotificationListenersLock
[ERROR] : art: 12: java.lang.Object android.support.v4.app.NotificationManagerCompat.sLock
[ERROR] : art: 13: android.support.v4.app.NotificationManagerCompat$SideChannelManager android.support.v4.app.NotificationManagerCompat.sSideChannelManager
[ERROR] : art: instance fields (2 entries):
[ERROR] : art: 0: android.content.Context android.support.v4.app.NotificationManagerCompat.mContext
[ERROR] : art: 1: android.app.NotificationManager android.support.v4.app.NotificationManagerCompat.mNotificationManager
[ERROR] : art:

iOS media attachments

Hi all, so as of now, January 20th 2018, what's the process for getting media links to show as little thumb images on iOS. I put a media url (https and ending with .png) into the OneSignal push field but only the message is displayed, not the thumb image. iOS 11.2 app in development mode on iPhone X. Ti SDK 7.0.1

Alert added in notificationReceived event

I am getting in-build(in module) alert in notificationReceived event, this should not be there.
In our case we are using our custom alert to redirect to relevant screen. Please check and update me on this.

Opt-out with the module

Is there any way of opting-out for push notification by using the module and without telling our users to go into their settings?

Android - Error on message receive

Hi @williamrijksen

Thank you for the module! :-)

I have been trying to use it on my project by I get the following error.

Nexus 5
Android API 22
Titanium SDK 7.1.1

[ERROR] : TiApplication: (main) [179899,243219] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to instantiate receiver com.google.android.gcm.GCMBroadcastReceiver: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gcm.GCMBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.test.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.test.app-1/lib/x86, /vendor/lib, /system/lib]]; Titanium 7.1.0,2018/03/14 13:40,undefined
[ERROR] : TiApplication: java.lang.RuntimeException: Unable to instantiate receiver com.google.android.gcm.GCMBroadcastReceiver: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gcm.GCMBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.test.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.test.app-1/lib/x86, /vendor/lib, /system/lib]]
[ERROR] : TiApplication: at android.app.ActivityThread.handleReceiver(ActivityThread.java:2590)
[ERROR] : TiApplication: at android.app.ActivityThread.access$1700(ActivityThread.java:151)
[ERROR] : TiApplication: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1380)
[ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:102)
[ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:135)
[ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5254)
[ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Method.java:372)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[ERROR] : TiApplication: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gcm.GCMBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.test.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.test.app-1/lib/x86, /vendor/lib, /system/lib]]
[ERROR] : TiApplication: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
[ERROR] : TiApplication: at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
[ERROR] : TiApplication: at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
[ERROR] : TiApplication: at android.app.ActivityThread.handleReceiver(ActivityThread.java:2585)
[ERROR] : TiApplication: ... 9 more
[ERROR] : TiApplication: Suppressed: java.lang.ClassNotFoundException: com.google.android.gcm.GCMBroadcastReceiver
[ERROR] : TiApplication: at java.lang.Class.classForName(Native Method)
[ERROR] : TiApplication: at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
[ERROR] : TiApplication: at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
[ERROR] : TiApplication: at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
[ERROR] : TiApplication: ... 11 more
[ERROR] : TiApplication: Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

7.5.0.GA - onesignal.idsAvailable is not fired - support

Hello. Good afternoon.

Basically this part of code onesignal.idsAvailable is not executed with Titanium SDK 7.5.0.GA using the module version of iOS 2.1.1
https://github.com/williamrijksen/com.williamrijksen.onesignal/releases/download/2.1.1/com.williamrijksen.onesignal-iphone-2.1.1.zip, but if I use the version 2.0.0 of the module, the second time that I open the app is working pretty good as the code showed below, but the first time with 7.5.0.GA, and 2.0.0 is crashing the app also.

if (OS_IOS) {
     var onesignal = require('com.williamrijksen.onesignal');

     onesignal.promptForPushNotificationsWithUserResponse(function(y) {
          Ti.API.info(y);
          onesignal.idsAvailable(function(e) {
               Ti.API.info(e);
          }
     }
}

Please let me know whether you have any doubt or question.
Thanks, and best,
AD.

OneSignal: OneSignal AppId format is invalid

Hi William @williamrijksen ,
Thank you for making this module, it looks great!

I've been trying to integrate it with my appcelerator app on android and been running into this problem described in the title:

I think it's something to do with the way I setup my xml, here's how I set it:

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="onesignal_app_id" android:value="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" /> <meta-data android:name="onesignal_google_project_number" android:value="str:xxxxxxxxxxxx" />

Am I setting this right? Also could you please post an example for the tiapp.xml file?

Thank you!

The application has crashed with an uncaught exception 'NSInvalidArgumentException'.

Hello, I have an issue using Titanium SDK 6.1.1GA.

Here's the complete error.

The application has crashed with an uncaught exception 'NSInvalidArgumentException'. [ERROR] : Reason: [ERROR] : -[ComWilliamrijksenOnesignalModule application:didFailToRegisterForRemoteNotificationsWithError:]: unrecognized selector sent to instance 0x7faecb7166b0 [ERROR] : Stack trace: [ERROR] : 0 CoreFoundation 0x0000000117392af3 __exceptionPreprocess + 147 [ERROR] : 1 libobjc.A.dylib 0x0000000116950141 objc_exception_throw + 48 [ERROR] : 2 CoreFoundation 0x0000000117402134 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 [ERROR] : 3 CoreFoundation 0x0000000117319840 ___forwarding___ + 1024 [ERROR] : 4 CoreFoundation 0x00000001173193b8 _CF_forwarding_prep_0 + 120 [ERROR] : 5 Surveiyo 0x000000010faefa33 -[TiApp application:didFailToRegisterForRemoteNotificationsWithError:] + 99 [ERROR] : 6 Surveiyo 0x000000010fc5f3fb -[OneSignalAppDelegate oneSignalDidFailRegisterForRemoteNotification:error:] + 251 [ERROR] : 7 libdispatch.dylib 0x000000011a057585 _dispatch_call_block_and_release + 12 [ERROR] : 8 libdispatch.dylib 0x000000011a078792 _dispatch_client_callout + 8 [ERROR] : 9 libdispatch.dylib 0x000000011a060247 _dispatch_main_queue_callback_4CF + 1041 [ERROR] : 10 CoreFoundation 0x0000000117357909 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 [ERROR] : 11 CoreFoundation 0x000000011731dae4 __CFRunLoopRun + 2164 [ERROR] : 12 CoreFoundation 0x000000011731d016 CFRunLoopRunSpecific + 406 [ERROR] : 13 GraphicsServices 0x0000000119e0ca24 GSEventRunModal + 62 [ERROR] : 14 UIKit 0x00000001128cf134 UIApplicationMain + 159 [ERROR] : 15 Surveiyo 0x000000010f909e64 main + 100 [ERROR] : 16 libdyld.dylib 0x000000011a0c165d start + 1 [ERROR] : 17 ??? 0x0000000000000001 0x0 + 1 -- End simulator log ---------------------------------------------------------

10 Android SDK releases --is this module maintained ?

Hi @williamrijksen @chmiiller @jvandijk @Topener @aduptoro & all !

One time again, thanks for this module.

I'm facing issues on Android 8 devices : push notifications (app killed & app in background) are not received.

Last commit of this module is 25 March 2018 (6 months ago)
10 new Android SDK versions have been released during this time
https://github.com/OneSignal/OneSignal-Android-SDK/releases

So, it's not clear about is this module maintained ?
Otherwise, just explain it in readme because production apps really suffer !
Opened issues didn't receive answers since few months ...

A quick answer will be really appreciated guys

If i can update onesignal Android SDK myself, please list me the steps (but i think java code must be changed ?).

External User Id

Hi,

Thank you for this module :)

I'd like to know if it's possible to send the "external user id" parameter to onesignal, in order to target a list of users by their ID ?
If not, how can I send a notification to a list of users ?
I don't find any information about this.

Thanks a lot :)

[iOS] Update OneSignal framework

When trying to update module's One Signal framework with the last one on their github repo, the app crashes when I send a notification and app is opened, or attempt to open the app from notification.
The message is:

-[TiApp application:didReceiveRemoteNotification:]: unrecognized selector sent to instance 0x1701f0900
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TiApp application:didReceiveRemoteNotification:]: unrecognized selector sent to instance 0x1701f0900'

Not sure what they've changed about it =/
Do you guys have a solution for this by any chance?
Thanks

[iOS]The app closes at the beginning

Good, I have a problem loading the module in titanium when the program runs in both the emulator and the device the app is closed, I'm using SDK 6.3.0 GA. Why can this happen? If I stop loading the module it does not close.

Thanks for your help

Ti SDK 7.4.0 Support - iOS

Greetings,

If you use the current release version of this module with the latest Titanium SDK (7.4.0.GA), you can consistently see the following crash:

1.) Start your app.
2.) Register for push notifications.
3.) Kill your app. (Double-tap home button, swipe up on app.)
4.) Send push notification from oneSignal.
5.) Open push notification on your device.
6.) You'll see the app splashscreen, then the app will immediately crash. No hints in the terminal.

If you send the push notification while the app is running, everything works as intended.

iOS12 reliability depends on fixes present in TiSDK 7.4.0. In order to use OneSignal, I had to manually merge in the iOS12 fixes from 7.4.0.GA into 7.2.0.GA, the last TiSDK that OneSignal runs on without crashing. Something broke from 7.3.0GA and on.

OneSignal iOS Native 2.4.X Update - NotificationServiceExtension

@williamrijksen We recently released version 2.4.0 of our SDK which uses a NotificationServiceExtension. Media attachments and action buttons now use a NotificationServiceExtension with mutable-content instead of content-available on iOS 10 for improved delivery reliability and speed. This fixes the issue where notifications with these features would not show if the app was force-quit by swiping it away.
https://github.com/OneSignal/OneSignal-iOS-SDK/releases/tag/2.4.0

This also includes other bug fixes and improvements so I highly recommend updating. I am OneSignal's lead mobile SDK developer so feel free to ask me any questions if you need any help on updating.

Update: (2017-03-31)
2.5.0 has been released with some additional methods, bug fixes and additional improvements.

Android Push Notifications do not respect priority

I wondered how notifications from some apps draw over a screen and you can read them where as all other notifications only appear as an icon on the status bar.

In my research I found that the priority of the notifications controls this and only priority 10 messages will be shown with a sliding view over other apps or even while on the OS main screen.

However the current module does not support these notifications and do not respect the priority sent. On futher research, I was to realise that Onesignal implemented priority in a later release of their SDK than the one in use in this module.

This issue is therefore a request to use the latest SDK found here:
https://github.com/OneSignal/OneSignal-Android-SDK/blob/b68d7004aaa868b3bdf25b64e4dc5feffcf19d0c/OneSignalSDK.jar

The good news is I have replaced the SDK and tested the priority to be working by simply replace this file and rebuilding the module.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.