Where to place firebase-messaging-sw.js file in Play framework project? - scala

I am using FCM to send a notification to the browser. I get the following error:
messaging/failed-serviceworker-registration", message: "Messaging: We
are unable to register the default s…t. (messaging/failed-serviceworker-
registration).", browserErrorMessage: "Failed to register a
ServiceWorker: A bad HTTP res…code (404) was received when fetching the
script.", stack: "FirebaseError: Messaging: We are unable to
registe…/assets/javascripts/firebase/firebase.js:1:760104
What I understand from my google research is that the firebase-messaging-sw.js is not in the root directory, I'am placing it under public/javascripts/. I'am using play framework for this project. My project hiearchy:
|app(controllers, views)
|public
|conf

Related

Web Tracker Apache Unomi

I'm working on a project that uses the Apache Unomi, I had installed all the requirements installation for the Apache Unomi and created a profile and some rules, and all worked well.
But, when I tried to test the web tracker example provided in the Apache Unomi documentation.
I got the following error before pressing the submit button
[UNOMI] XML request error: Unsupported Media Type (415) unomi-tracker.js:16068:29
onreadystatechange http://localhost:8181/tracker/unomi-tracker.js:16068
and after the submitting, I got those errors
XHRPOSThttp://localhost:8181/cxs/context.json
[HTTP/1.1 415 Unsupported Media Type 4ms]
[UNOMI] XML request error: Unsupported Media Type (415) unomi-tracker.js:16068:29
onreadystatechange http://localhost:8181/tracker/unomi-tracker.js:16068
(Async: EventHandlerNonNull)
ajax http://localhost:8181/tracker/unomi-tracker.js:16053
loadContext http://localhost:8181/tracker/unomi-tracker.js:15788
initialize http://localhost:8181/tracker/unomi-tracker.js:15622
initialize http://localhost:8181/tracker/unomi-tracker.js:4064
initialize http://localhost:8181/tracker/unomi-tracker.js:1433
baseEach http://localhost:8181/tracker/unomi-tracker.js:595
each http://localhost:8181/tracker/unomi-tracker.js:633
initialize http://localhost:8181/tracker/unomi-tracker.js:1409
exports http://localhost:8181/tracker/unomi-tracker.js:5500
callback http://localhost:8181/tracker/?firstName=John&lastName=Doe&email=johndoe#acme.com#:84
load http://localhost:8181/tracker/?firstName=John&lastName=Doe&email=johndoe#acme.com#:112
(Async: EventListener.handleEvent)
load http://localhost:8181/tracker/?firstName=John&lastName=Doe&email=johndoe#acme.com#:110
(Async: EventListener.handleEvent)
http://localhost:8181/tracker/?firstName=John&lastName=Doe&email=johndoe#acme.com#:128
http://localhost:8181/tracker/?firstName=John&lastName=Doe&email=johndoe#acme.com#:143
Because of the errors, the event is not sent to the Apache Unomi.

SOAP API Automating testing with ROBOTFRAMEWORK

Good day,
I am trying to use robot framework to test a soap based api. I tried using the RobotFramework-Soap library first. I tried a sample case and it works but as soon as I put in my api link it does not work. Im not sure if it is because my api link contains an api.
N.B. due to confidentiality I am unable to post the actual api link. But it is in the format shown below.
*** Settings ***
Library SoapLibrary
Library OperatingSystem
*** Test Cases ***
Example
Create Soap Client http://000.000.000.000:8000/SomeService?wsdl
${response} Call SOAP Method With XML ${CURDIR}/request.xml
${text} Get Data From XML By Tag ${response} AddResult
Log To Console ${text}
Save XML To File ${response} ${CURDIR} response_test
When I run the above test. It fails with following error:
ConnectionError: HTTPConnectionPool(host='xxx_cert', port=8000): Max retries exceeded with url: /SomeService?xsd=xsd0 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
I even tried using the suds library as well. and when i do a simple test as follows:
***Test Cases***
Example
Create Soap Client http://000.000.000.000:8000/SomeService?wsdl
I get the following error: URLError: urlopen error [Errno 11001] getaddrinfo failed
I did some searching and I found that it could be related to the port. But Im not sure how to resolve this issue.
Any assistance would be greatly appreciated.
Thanks,
Lee
The solution was to edit the local host file to cater for the web service. That seemed to solve all the problems.

Error in setting up Google play services in unity

Following the instruction on google play games plugin for unity, I have not been able to set it up correctly. My application crashes on signing in, with the following log output (with no more details). I've got no luck in finding a probable cause and searches seems to be out of any useful tip.
The actual error is displayed as:
Application ID () must be a numeric value. Please verify that your manifest refers to the correct project ID
The complete log output:
10-08 19:43:49.581 25688-25734/? E/linker: readlink('/proc/self/fd/49') failed: Permission denied [fd=49]
10-08 19:43:49.581 25688-25734/? E/linker: warning: unable to get realpath for the library "/data/data/com.testcompany.testapp/app_.gpg.classloader/d75c8e1bbeab9e1ddffb9d332585db71.dex". Will use given name.
10-08 19:43:49.667 25688-25734/? W/PopupManager: You have not specified a View to use as content view for popups. Falling back to the Activity content view. Note that this may not work as expected in multi-screen environments
10-08 19:43:49.675 25688-26526/? I/GamesNativeSDK: Auth operation started: SIGN IN
10-08 19:43:49.675 25688-26526/? I/GamesNativeSDK: Connecting to Google Play...
10-08 19:43:49.802 10946-10956/? W/GamesServiceBroker: Client connected with SDK 9683000, Services 9683438, and Games 37240038
10-08 19:43:49.837 10946-26540/? E/ValidateServiceOp: Application ID () must be a numeric value. Please verify that your manifest refers to the correct project ID.
10-08 19:43:49.842 25688-25688/? D/AndroidRuntime: Shutting down VM
10-08 19:43:49.846 25688-25688/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.testcompany.testapp, PID: 25688
java.lang.Error: FATAL EXCEPTION [main]
Unity version : 5.4.0f3
Device model : LGE Nexus 5
Device fingerprint: google/hammerhead/hammerhead:6.0/MRA58K/2256973:user/release-keys
Caused by: java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
at com.google.android.gms.common.internal.zze$zza.zzc(Unknown Source)
at com.google.android.gms.common.internal.zze$zza.zzv(Unknown Source)
at com.google.android.gms.common.internal.zze$zze.zzauc(Unknown Source)
at com.google.android.gms.common.internal.zze$zzd.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
I've taken the steps needed to generate OAuth2 client ID and I've successfully applied that to GooglePlayGame plugin in unity. What could be the reason of the error message?
If we refer to the actual error as shown in your log output, the problem is caused by the application ID declared in your Manifest which is actually one of the top setup mistakes committed by developers as shown in this video.
To troubleshoot this kind of error, please check the following:
For Android:
please verify that the value of the #string/app_id resource matches your application's numeric ID. The value of this resource should only contain digits. For example:
<string name="app_id">123456789012</string>
Warning: Do not use the full client ID (1233456789012.apps.googleusercontent.com) as your app ID. This will result in errors.
For iOS:
The application_ID is the number that Google Play Developer Console assigns to your project. Please note that is not the same as your Apple application_ID.
Then, after checking the application ID, please also check the certificate fingerprint. Please be noted that:
If you are debugging your game using your debug certificate but have configured games services using your release certificate, you should add a second linked app using the same package name and your debug certificate's SHA1 fingerprint. This will allow you to sign in to the application whether it's signed with the debug or release certificates.
For additional tips, refer to these related resources:
Top 7 Google Play games services setup mistakes - Video that describes common Google Play games services setup pitfalls and scenarios.
Android troubleshooting guide - Developer documentation that describes how to troubleshoot issues while developing Android games.
Lastly, this Q&A thread might also help wherein this GitHub post was suggested.
The problem was caused by multiple application configurations in Google play services. Although the game services panel was showing only one application with my package name, there were several instances of the same application configured in google cloud services previously for google cloud messaging and other services. The problem was only solved when I shut down all services, deleted the applications and patiently created one unified application configuration in Google play services.
I got this problem too. Here's My solution:
Delete old version of GooglePlayService and Admob plugins and import the new ones.
Open Android SDK Manager(In Unity, Window -> Google Play Games -> Downloads -> Google Play Gamse SDK(Android)), update the following ones:
Then try to set up Goole Play Service.
Additional, current verion of GooglPlayServices and Admob both import PlayServicesResolver/Editor/Google.JarResolverLib.dll(JarResolverLib.dll), just delete Google.JarResolerLib.dll.
Hope this can help you!

Android mobile first app stopped working after Bluemix moved to cflinuxfs2 stack

I have an android app based on the bluelist app for bluemix BMS service. it stopped working yesterday when the stack is moved to cflinuxfs2.
Today I checked my ios app on the same bluemix service, it is working. so I looked into the exception on Android, it is from MFPush, looks like a context is null. see the attached image for the line of code where the NPE is thrown.
The stacktrace is: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content.Context.registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter)' on a null object reference
12-10 16:00:31.240 14482-14482/com.ibm.bluelist E/AndroidRuntime: at com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPush.listen(MFPPush.java:232)
12-10 16:00:31.240 14482-14482/com.ibm.bluelist E/AndroidRuntime: at com.ibm.bluelist.GroupsActivity.onResume(GroupsActivity.java:250)
12-10 16:00:31.240 14482-14482/com.ibm.bluelist E/AndroidRuntime: at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1257)
12-10 16:00:31.240 14482-14482/com.ibm.bluelist E/AndroidRuntime: at android.app.Activity.performResume(Activity.java:6119)
Chances are the MFPPush SDK has not been initialized when you are attempting to call:
push.listen(notificationListener)
I suggest saving the push value:
push = MFPPush.getInstance()
Immediately after initialization or registration (whatever you feel is more appropriate) in the class.
That way you will have the appropriate initialized push instance when attempting to listen to a notification listener.

iOS Dropbox Datastore API: WebKit Exception + Unsupported URL

(Note, this seems related to this question, but is with a different flavor of the Dropbox SDK.)
Using the latest version of the Dropbox Datastore API on iOS, I am getting an exception after performing these steps:
Successfully connect my app to Dropbox
Disconnect my app from Dropbox.
Reconnect app to same, or another, Dropbox account.
Then this happens:
The console in Xcode shows this:
*** WebKit discarded an uncaught exception in the webView:
decidePolicyForNavigationAction:request:frame:decisionListener:
delegate: <NSInvalidArgumentException> -[PilotPro.SettingsTableViewController
dropboxWasLinked:]: unrecognized selector sent to instance 0x7fc489cb94d0
And then this:
[WARNING] DropboxSDK: error loading DBConnectController - Error
Domain=NSURLErrorDomain Code=-1002 "unsupported URL"
UserInfo=0x7fc48c11bc50 {NSUnderlyingError=0x7fc48c4418c0 "unsupported URL",
NSErrorFailingURLStringKey=db-***://1/connect?
oauth_token_secret=***&state=***&oauth_token=***&uid=***,
NSErrorFailingURLKey=db-***://1/connect?
oauth_token_secret=***&state=***&oauth_token=***&uid=***,
NSLocalizedDescription=unsupported URL}
I suspect I am not doing enough to disconnect Dropbox from my account, so it's conflicting with a Dropbox session somehow. Here's what I'm doing to disconnect:
//===::: Disable Dropbox :::===
DBAccountManager.sharedManager().linkedAccount.unlink()
// Shutdown and stop listening for changes to the datastores
DBDatastoreManager.sharedManager().shutDown()
DBDatastoreManager.sharedManager().removeObserver(self)
//Migrate back to local datastores
DBDatastoreManager.setSharedManager(DBDatastoreManager.localManagerForAccountManager(DBAccountManager.sharedManager()))
Any ideas? Thanks in advance.
It turns out that the errors given by Xcode were a bit of a red herring in this case. I was firing an NSNotification after Dropbox finished authenticating, and in doing so I was using this:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "dropboxWasLinked:", name: "dropboxLinked", object: nil)
...but my dropboxWasLinked method wasn't set up to receive any arguments:
func dropboxWasLinked(){ ... }
So Xcode was firing an exception that messed up the authentication and made other things appear to be the cause, when in reality all I needed to do was remove the : from my selector in the NSNotification listener.
Ah, the joys of programming. :)