Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
None
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:
ti.cloudpush 5.0.0 , SDK 7.0.1, android 6.0
Description
Steps :
1. Create a new project and copy ti.cloud sample app
var win = Ti.UI.createWindow({
|
backgroundColor : '#ccc',
|
title : 'Android Cloud Push Notification'
|
});
|
|
var CloudPush = require('ti.cloudpush');
|
CloudPush.debug = true;
|
CloudPush.enabled = true;
|
CloudPush.showTrayNotificationsWhenFocused = true;
|
CloudPush.showTrayNotification = true;
|
CloudPush.focusAppOnPush = false;
|
|
var deviceToken = null;
|
var Cloud = require('ti.cloud');
|
Cloud.debug = true;
|
|
var submit = Ti.UI.createButton({
|
title : 'Register For Push Notification',
|
color : '#000',
|
height : 60,
|
width : 200,
|
top : 100,
|
});
|
|
win.add(submit);
|
|
submit.addEventListener('click', function(e) {
|
loginDefault();
|
});
|
|
var submit1 = Ti.UI.createButton({
|
title : 'Subscribe Device',
|
color : '#000',
|
height : 60,
|
width : 200,
|
top : 200,
|
});
|
|
win.add(submit1);
|
|
submit1.addEventListener('click', function(e) {
|
defaultSubscribe();
|
});
|
|
CloudPush.retrieveDeviceToken({
|
success : deviceTokenSuccess,
|
error : deviceTokenError
|
});
|
|
function deviceTokenSuccess(e) {
|
deviceToken = e.deviceToken;
|
}
|
|
function deviceTokenError(e) {
|
alert('Failed to register for push notifications! ' + e.error);
|
}
|
|
CloudPush.addEventListener('callback', function(evt) {
|
alert("Notification received: " + evt.payload);
|
});
|
|
CloudPush.addEventListener('trayClickLaunchedApp', function(evt) {
|
Ti.API.info('Tray Click Launched App (app was not running)');
|
});
|
|
CloudPush.addEventListener('trayClickFocusedApp', function(evt) {
|
Ti.API.info('Tray Click Focused App (app was already running)');
|
});
|
|
function loginDefault(e) {
|
Cloud.Users.login({
|
login : 'xyz',
|
password : '123456'
|
}, function(e) {
|
if (e.success) {
|
alert("Successfully Loged In");
|
} else {
|
alert('Error: ' + ((e.error && e.message) || JSON.stringify(e)));
|
}
|
});
|
}
|
|
function defaultSubscribe() {
|
Cloud.PushNotifications.subscribe({
|
channel : 'alert',
|
device_token : deviceToken,
|
type : 'android'
|
}, function(e) {
|
if (e.success) {
|
alert('Device Subscribed!');
|
} else {
|
alert('Error:' + ((e.error && e.message) || JSON.stringify(e)));
|
}
|
});
|
}
|
|
win.open();
|
2. Create the folder /Resources/sound directory.
3. Place the sound file(gsl) in the /Resources/sound directory.
4. Build your project and send custom sound from dashboard.
5. You will get default sound and get following error.
6. Custom sound not played
[INFO] : APSCloudPush: queuePayload: {"android":{"sound":"gsl","alert":"s check ","vibrate":true},"content-available":1,"priority":"high"}
|
[INFO] : APSCloudPush: showTrayNotification
|
[WARN] : W/System.err: java.io.FileNotFoundException: Resources/sound/gsl
|
[WARN] : W/System.err: at android.content.res.AssetManager.openAssetFd(Native Method)
|
[WARN] : W/System.err: at android.content.res.AssetManager.openFd(AssetManager.java:352)
|
[WARN] : W/System.err: at com.appcelerator.aps.APSCloudPush.getAndTransferFile(APSCloudPush.java:526)
|
[WARN] : W/System.err: at com.appcelerator.aps.APSCloudPush.showTrayNotification(APSCloudPush.java:441)
|
[WARN] : W/System.err: at com.appcelerator.aps.APSCloudPush.receivePayload(APSCloudPush.java:267)
|
[WARN] : W/System.err: at com.appcelerator.aps.GCMReceiver.onReceive(GCMReceiver.java:30)
|
[WARN] : W/System.err: at android.app.ActivityThread.handleReceiver(ActivityThread.java:2835)
|
[WARN] : W/System.err: at android.app.ActivityThread.access$1800(ActivityThread.java:150)
|
[WARN] : W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1489)
|
[WARN] : W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
|
[WARN] : W/System.err: at android.os.Looper.loop(Looper.java:168)
|
[WARN] : W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5885)
|
[WARN] : W/System.err: at java.lang.reflect.Method.invoke(Native Method)
|
[WARN] : W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
|
[WARN] : W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
|
[INFO] : APSCloudPush: getTrayPendingIntent
|
[INFO] : APSCloudPush: getFocusIntent payload: {"android":{"sound":"gsl","alert":"s check ","vibrate":true},"content-available":1,"priority":"high"}
|
[INFO] : APSCloudPush: processCallbackIfInstantiated payload: {"android":{"sound":"gsl","alert":"s check ","vibrate":true},"content-available":1,"priority":"high"}
|
[INFO] : APSCloudPush: processQueuedCallback
|
Test Environment:
Operating System
|
Name = Mac OS X
|
Version = 10.13
|
Architecture = 64bit
|
# CPUs = 4
|
Memory = 8589934592
|
Node.js
|
Node.js Version = 8.9.1
|
npm Version = 5.5.1
|
Titanium CLI
|
CLI Version = 5.0.14
|
Titanium SDK
|
SDK Version = 7.0.0.GA
|
Attachments
Issue Links
- relates to
-
MOD-2429 Arrow Push Custom Notification Sounds for Android 8+ Not Found
-
- Closed
-
- links to