Forums

OverviewFelgo 2 Support (Qt 5) › Trouble setting up OneSignal

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #21482

    Edward

    Hey!

    I’ve been struggling to set up the One Signal plugin,

    I have followed the steps, my build.gradle and other files all have the appropriate lines added for this, but I am still receiving the error;

     

    Warning: Plugin “VPlay.plugins.onesignal” disabled: Native frameworks not found

     

    The only thing I can’t seem to find is my main.cpp, unsure at what point this has disappeared but my app works fine with it’s firebase integration, are the additions to the main.cpp needed for OneSignal to function, and will the lack of a main.cpp cause issues for me in the future?

     

    Thanks!

    #21509

    Günther
    Felgo Team

    Hi Edward,

    the error

    Warning: Plugin “VPlay.plugins.onesignal” disabled: Native frameworks not found

    hints that the native iOS or Android library for OneSignal is not found.

    For Android, the specified  build.gradle dependency for the One Signal library is sufficient:  compile ‘net.vplay.plugins:plugin-onesignal:3.+’

    On iOS, it is required to manually copy the Framework to your iOS project folder, as described here: https://felgo.com/doc/plugin-onesignal/#ios-integration-steps

     

    Regardless of whether you are using a plugin, and regardless of the above error:
    The main.cpp is the starting point for every application. In case you deleted it accidentally, you should add it again. As your application still builds and runs fine (otherwise the error message wouldn’t even show), your main.cpp is either not missing at all, or still available in your build folder from a previous project build.

    Best,
    Günther

    #21520

    Edward

    Hi Gunther,

     

    I have double checked my build.gradle, and the dependency is there yet I still get the error! The code for my build.gradle is:

     

    buildscript {
        repositories {
            jcenter()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:2.3.3'
            classpath 'com.google.gms:google-services:3.0.0'        
        }
    }
    
    allprojects {
        repositories {
            maven { url 'https://maven.google.com' }
            jcenter()
            maven { url 'https://sdk.v-play.net/maven/' }
        }
    }
    
    apply plugin: 'com.android.application'
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile "com.android.support:support-core-utils:27.1.0"
        compile "com.android.support:appcompat-v7:27.1.0"
        compile 'net.vplay.plugins:plugin-firebase:2.+'
        compile 'com.google.firebase:firebase-firestore:17.0.1'
        compile 'net.vplay.plugins:plugin-onesignal:3.+'
    }
    
    android {
        compileSdkVersion androidCompileSdkVersion.toInteger()
        buildToolsVersion androidBuildToolsVersion
        defaultConfig {
        applicationId = '<com.MYAPP.MYAPP.MYAPP>'
        }
    
        sourceSets {
            main {
                manifest.srcFile 'AndroidManifest.xml'
                java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
                aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
                res.srcDirs = [qt5AndroidDir + '/res', 'res']
                resources.srcDirs = ['src']
                renderscript.srcDirs = ['src']
                assets.srcDirs = ['assets']
                jniLibs.srcDirs = ['libs']
           }
        }
    
        lintOptions {
            abortOnError false
        }
    }
    
    apply plugin: 'com.google.gms.google-services'
    

     

    Is this incorrect? My app requires both firebase and onesignal

     

    In regards to the main.cpp, I recently removed all previous build folders for space, so am unable to track when it was lost, but recreated it today (made a new project and copy/pasted it, Felgo live works fine, and I have been testing with this for some time as firebase is not supported on desktop – but when I try to build I receive a series of errors. This is a different subject, so I will make a new topic if I cannot fix!

     

    Thanks

    Edd

    #21533

    Günther
    Felgo Team

    Hi Edward,

    actually the line for Firebase is incorrect, as we moved to versionn 3.+ for all plugins with Felgo 3.1.0:

        compile 'net.vplay.plugins:plugin-firebase:3.+'
    

     

    can you use 3.+ for both plugins, and also make sure to create a fresh and clean Android build then:

    • Close Qt Creator
    • Uninstall the app from your test device
    • Delete the *.pro.user file of your project
    • Remove your existing project build folder (folder named something like build-Android-….)
    • Open your project in Qt Creator and choose your Build Kits
    • Right-click proejct in the Project Explorer and choose “Clean”
    • Rebuild your project for Android

    Hope this helps!

    #21573

    Edward

    Hi Gunther!

    Thanks for the heads up, I’ve amended the firebase line!

    I have fixed the main.cpp issue (yay), but when using the Felgo Live Reloading application I still log the error of

    Warning: Plugin "VPlay.plugins.onesignal" disabled: Native frameworks not found

    Other than the issue with the firebase line in my gradle, why else would this not be working?

    Thanks!

    #21579

    Alex
    Felgo Team

    Hi Edward,

    currently OneSignal is not supported with the Live Client, please use standard deployment to test the plugin.

    The reason is that for OneSignal the app identifier of your mobile App must match the one of your OneSignal configuration (so remote notifications can me associated to your application on the device). As the Live Client is an app on its own, it is running with its own app identifier on the Phone. Your source code is just executed in the context of this app, but not with its own app identifier.

    Cheers,
    Alex

    #21593

    Edward

    Hi Alex!

     

    How would I go about getting another users one signal UserID to send a notification to just this user?

    Effectively, in app – when a ‘user’ saves a date, the ‘admin(s)’ (may be multiple, but only admin(s)), will get a notification of a new date saved?

    Also in return if the admin edits this date, send a notification back to only the ‘users’ userID?

    I am struggling to find any way to obtain the said individual userID of another app user, without having to make oneSignal tags for every user-name/location (which seems rather cumbersome) to send direct notifications?

     

    Also sorry for the late reply and thanks for the info, that will make sense as to why I was having issues 🙂

    #21605

    Günther
    Felgo Team

    Hi Edward,

    One Signal is an independent push notification service. The userId of a certain user is available with the userId property: https://felgo.com/doc/felgo-onesignal/#userId-prop

    For complex push notification use-cases, it is best to provide a web service, which you can use to trigger notifications from your app. The plugin documentation holds some examples to trigger notification via PHP using curl: https://felgo.com/doc/plugin-onesignal/#advanced-usages

    You could also trigger such notifications with web requests to OneSignal directly from your app instead of a server application. However, for security reasons, it makes sense to decouple the push notification sending from the client application.

    To send notifications to certain user groups, you can use One Signal tags and target all these users then.

    Best,
    Günther

    #21613

    Edward

    Hi Gunther,

    Thanks for the info – so (forgive me, this has absolutely blown my head off), ideally, I need to use a webservice – so when something happens in my app, it sends the signal to the webservice – which in turn sends the notification via one signal?

    How would I go about setting up this webservice  – and how would I host this? I have looked at the curl examples before, this code wouldn’t be in my app, instead the webservice? (or am I mistaken)

     

    alternatively where I am also using firebase – could I trigger these with either one signal or the GCM from firebase functions? I’m really sorry I’m seriously struggling to understand this!

     

    Thanks.

     

    #21619

    Günther
    Felgo Team

    Hi Edward,

    setup and hosting of the web service is completely up to you. If you do not have experience with web applications and services, maybe you can ask a professional or friend for help.

    In case you simply want to get the application working, you can also communicate with the One Signal REST API with custom HttpRequests from within your app. (Instead of PHP curl, you then use JS HttpRequest to send your request). Adding this feature directly to your app is simply not the ideal way in terms of good application architecture and security.

    Best,
    Günther

    #21626

    Edward

    Hi Gunther,

    Thanks,

    Last night I got this working using the HttpRequest in app, which I know means keeping my Rest API key in app code (not recommended), would you say it’s better (still not ideal), if I set the key as a value in the firebase DB – then on user log in this is assigned as a property? therefore keeping it out of the application code? just read when the user is logged in?

     

    Thanks

     

    #21657

    Günther
    Felgo Team

    Hi Edward,

    the idea to load the API key from your db is actually not bad, as you don’t keep the key in your client code then. I guess this solution is ok for now. Of course, there’s always some room to improve in terms security if needed. (but actually, nothing is ever 100% secure, “no risk no fun” :D)

    Cheers,
    Günther

Viewing 12 posts - 1 through 12 (of 12 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support