Comments (9)
Try setting it using Ti.App.Properties.setString('gcm.senderid', '1118111...');
make sure to remove it from tiapp.xml if you go this way as it makes the property readonly.
Of course this must be done before calling "registerForPushNotifications" method
from ti.goosh.
yes awesome that seems to work. I'm tempting to close but what about something like
require('ti.goosh')(1118111...);
or
var tg = require('ti.goosh');
tg.setSenderId(1118111...); // since there is also getSenderId() if i look at the source?
from ti.goosh.
That wouldn't work. For now the above is the only solution if it works. The getSenderId()
method gets it from the Titanium.App.Properties
directly
from ti.goosh.
in the current implementation it wouldnt no. But there is something to say for the discrepancies of app/config.json
vs tiapp.xml
. By defining it in the javascript you give the power to the user since they can define how they retrieve configuration.
It seems very reasonable to have it as a constructor argument, vs defining a hard property somewhere.
from ti.goosh.
The main focus of this module is to maintain full compatibility with how iOS notifications are handled by Titanium. Creating a specific method is a possibility. Something like TiGoosh.setSenderId()
but it doesn't seem critical at the moment.
from ti.goosh.
The main focus of this module is to get Android notifications working at all. There is no compatibility/parity with iOS vs the Android implementation. The only thing that corresponds is the function name itself registerForPushNotifications
and success
/error
/callback
as arguments (and its invocations).
A programmer needs to attach custom handlers for iOS anyway so I bet most programmers end up with a separated setup for 50% of the code.
from ti.goosh.
That shouldn't be the case. The same callback functions should work on both Android and iOS. We wanted to make sure of this and it's the same reason why we expect the payload to be formatted in a certain way.
from ti.goosh.
yes the callback functions would have 100% parity which is good. But invocation of TiGoosh needs to happen on Android only anyway so it might as well receive a parameter when constructing it
from ti.goosh.
We usually do something like this
function requireOrNull(moduleId) {
var module = null;
try {
module = require(moduleId);
} catch(e) {
Ti.API.error("Module couldn't be loaded")
}
return module;
}
var Push = OS_ANDROID ? requireOrNull('ti.goosh') : Ti.Network;
Push.registerForPushNotifications(callback, success, error);
And then we use Push
everywhere.
Check out Trimethyl and in particular Notifications
from ti.goosh.
Related Issues (20)
- How can we use both ios? HOT 3
- Failed to get GCM Registration Token:TIMEOUT HOT 1
- Cannot build with 7.1.0 SDK. HOT 10
- Crash Report HOT 2
- Crash report from Google Play HOT 1
- Crash report HOT 2
- Recent crash report HOT 10
- java.lang.ClassCastException receiving foregrounded FCM ttl and sent_time HOT 2
- Silent notification not receiving payload? HOT 2
- Getting invalid sender error
- Compilation Error HOT 10
- targetSdkVersion="26" Notifications not received on some android device HOT 24
- Android Oreo Issue --Notification is not receiving in background HOT 3
- Not getting callback when the app is in background or killed HOT 27
- [WARN] : W/ti.goosh.IntentService: Show Notification: FALSE HOT 5
- ti.goosh and ti.admob together
- Use Android notification channels HOT 1
- Firebase support - internal dependencies HOT 8
- Remove app from background, No notification get
- Need to bump version for TiSDK 9.x version HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ti.goosh.