caffeinalab / ti.goosh

GCM/FCM module for Titanium.
MIT License
52 stars 34 forks source link

Notification with vibration not came? #90

Closed ChanakyaSrinivas closed 6 years ago

ChanakyaSrinivas commented 6 years ago

When am sending notification from java server program am able to see the notification message in respective device but the notification vibration not came.

How to get the notification with vibration? Can any one help me out.

Here is my java example code:

import java.io.IOException;
import java.util.ArrayList;

import com.google.android.gcm.server.Message;
import com.google.android.gcm.server.MulticastResult;
import com.google.android.gcm.server.Sender;

public class GCMJarGCM {

    public static final String GCM_API_KEY = "AIzaSyCGisUej-7aAUkNC3GzQ0Z4TBu6kpmmzmM";
    public static final String MESSAGE_VALUE = "Hello, Sending Notifications using GCM";    
    public static final String MESSAGE_KEY = "message";
    public static final String REG_ID = "fWW1uhktBcc:APA91bHFZKDSHOYafTuIB8i6Cc-D-mUq93IkoNXch3rLjDtP6ET4og3aK2xEvp0Z7HIC3TKoCa3h4OoskJUu9HD0BPJRy_lWeCEG-_Nrp9HAAPXxW0Mnb5Ha5oLp35nG6yU1DoC1pB6u";

    public static void main(String[] args) throws IOException {
        Sender sender = new Sender(GCM_API_KEY);

        ArrayList<String> devicesList = new ArrayList<String>();
        devicesList.add(REG_ID);

        Message message = new Message.Builder().addData(MESSAGE_KEY, MESSAGE_VALUE).build();

        MulticastResult result = sender.send(message, devicesList, 1);
        sender.send(message, devicesList, 1);
        System.out.println("result.toString():  "+result.toString());
    }
}
kopiro commented 6 years ago

See the documentation, check the vibration parameter.

message.addData("vibration", true)
ChanakyaSrinivas commented 6 years ago

HI, As per your suggestion, I tried with above statement but still am not getting vibration.

progress44 commented 6 years ago

Check out the vibrate property here Either set it to true i.e. vibrate: true or to an array of representing a vibration pattern i.e. vibrate: [200,100,200,100]