I know this is a simple question, but I'm new here. Can I find out if it is possible to send a push notification from the Google cloud (backend, java server) to devices (Android) every 3 months before the end date. If so, how? and can I initiate a repeated notification during the time interval?
In my Android application (client), I have these classes https://github.com/googlesamples/google-services/tree/master/android/gcm/application/SRC/home/Java/gsm/playback/Android/samples/ com / gcmquickstart
then I made a backend in java and I have these classes:
public class RegisterUserDetails { public String RegisterUserDetails(String data) { DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); Entity fdUsers = new Entity("fdUser"); Logger log = Logger.getLogger(RegisterUserDetails.class.getName()); log.setLevel(Level.INFO); JsonElement jsonElement = new JsonParser().parse(data); JsonArray jsonArray = jsonElement.getAsJsonArray(); // JsonObject jsonObject = jsonArray.get(0).getAsJsonObject(); String regId = jsonArray.get(0).getAsString(); String userName = jsonArray.get(1).getAsString(); log.info("regId"+regId); log.info("userName"+userName); fdUsers.setProperty("regId", ""+regId); fdUsers.setProperty("userName", ""+userName); // fdUsers.setProperty("userName", "" + userName); datastore.put(fdUsers); return "Success"; } }
and I
import com.google.android.gcm.server.Constants; import com.google.android.gcm.server.Message; import com.google.android.gcm.server.Result; import com.google.android.gcm.server.Sender; import com.google.api.server.spi.config.Api; import com.google.api.server.spi.config.ApiNamespace; import java.io.IOException; import java.util.List; import java.util.logging.Logger; import javax.inject.Named; import static com.tiya.accountbook.backend.OfyService.ofy; @Api( name = "messaging", version = "v1", namespace = @ApiNamespace( ownerDomain = "backend.accountbook.tiya.com", ownerName = "backend.accountbook.tiya.com", packagePath = "" ) ) public class MessagingEndpoint { private static final Logger log = Logger.getLogger(MessagingEndpoint.class.getName()); private static final String API_KEY = System.getProperty("gcm.api.key"); public void sendMessage(@Named("message") String message) throws IOException { if (message == null || message.trim().length() == 0) { log.warning("Not sending message because it is empty"); return; }
what to do?
When the user saves the details of the account, he will save the start date and end date in the Google cloud. I want to send a notification to this user every 3 months from this start date to the end date. As in this case there will be many accounts, it can be from the same user or another. I want to know if this is possible? If so, how ??? -
source share