Hola a todos, tengo un problema sencillo, la función push_local_notification no me está funcionando para nada, supongo que algo estoy haciendo mal pero ya leí las instrucciones y según es tan solo escribir la función y ya pero aun no pasa nada, cabe aclarar que estoy creando el apk y no consigo nada, incluso descargué el ejemplo del marcketplace https://marketplace.yoyogames.com/assets/4818/push-notifications-example (https://marketplace.yoyogames.com/assets/4818/push-notifications-example), les agradecería si me ayudaran con alguna sugerencia, tal vez lo estoy usando mal, tal vez tengo que activar algo en las configuraciones, pero no logro nada :/ gracias de antemano.
Qué código estás usando exactamente, y en qué eventos lo tienes metido?
esto en el evento create de un objeto ya existente en la primera room:
var fireTime = date_inc_second(date_current_datetime(), 30);
var data = "push_notification_successful!";
push_local_notification(fireTime, "Testing Push Notification", "Congratulations, you have recieved the local push notifications from GMS!", data);
confirmation_message = "Now close / minimise the app and wait 30secs...";
Vale, eso en el evento Create, pero que mas tienes a nivel de codigo?
Cuando salta la notificación, con que código la gestionas?
Ningún otro, hasta donde se solo de necesita eso para enviarlo pero pues obviamente estoy haciendo algo mal jeje
Te falta la segunda parte. Lo que has hecho hasta ahí es crear una notificación, pero tu programa no responde a ellas. Tienes que meter un evento de notificación push (asíncrono), dentro del mismo objeto que te genera la notificación, y dentro de él metes esto:
var type = ds_map_find_value(async_load, "type");
var status = ds_map_find_value(async_load, "status");
if status == 0
{
//error de algun tipo
var error = ds_map_find_value(async_load, "error");
show_debug_message("error=" + string(error));
}
else
{
if type == "register"
{
global.reg_id = ds_map_find_value(async_load, "reg_id");
}
else
{
var data = ds_map_find_value(async_load, "data");
if data == "push_notification_successful!"
{
// aqui metes lo que quieras que pase al saltar la notificacion
}
}
}
Si sigues teniendo problemas me dices.
Bien, intenté hacer lo que dices pero al intentar compilar me estoy dando cuenta que seguro le moví a algo que no debía y ahora me aparase este error de compilación:
Create started: 20:24:47
"C:\Users\MAC\AppData\Roaming\GameMaker-Studio\GMAssetCompiler.exe" /fU="C:\Users\MAC\AppData\Local\Temp\gm_ttt_29786\a42040.txt" /c /m=android /config="Default" /tgt=8 /obob=True /obpp=False /obru=True /obes=False /i=3 /cvm /tp=1024 /mv=1 /iv=0 /rv=0 /bv=1757 /gn="ritmo3-c" /td="C:\Users\MAC\AppData\Local\Temp" /cd="C:\Users\MAC\Documents\GameMaker\Cache" /sh=True /dbgp="6502" /hip="192.168.0.6" /hprt="5555" /optionsini="C:\Users\MAC\AppData\Local\Temp\gm_ttt_29786\gm_ttt_69781\sfswdfsdfc.ini" /o="C:\Users\MAC\AppData\Local\Temp\gm_ttt_29786\gm_ttt_69781" "C:\Users\MAC\Dropbox\ritmo3-c.gmx\ritmo3-c.project.gmx"
Reading project file....finished.
Compile Constants...finished.
Remove DnD...finished.
Compile Scripts...finished.
Compile Objects...finished.
Compile Timelines...finished.
Compile Triggers...finished.
Compile Rooms...finished.
Compile Extensions...finished.
Final Compile...finished.
Saving IFF file... C:\Users\MAC\AppData\Local\Temp\gm_ttt_29786\gm_ttt_69781\ritmo3-c.droid
Writing Chunk... GEN8
Writing Chunk... OPTN
Writing Chunk... EXTN
Writing Chunk... SOND
Writing Chunk... AGRP
Writing Chunk... SPRT
Writing Chunk... BGND
Writing Chunk... PATH
Writing Chunk... SCPT
Writing Chunk... SHDR
Writing Chunk... FONT
Writing Chunk... TMLN
Writing Chunk... OBJT
Writing Chunk... ROOM
Writing Chunk... DAFL
Writing Chunk... TPAGE
Writing Chunk... CODE
Writing Chunk... VARI
Writing Chunk... FUNC
Writing Chunk... STRG
Writing Chunk... TXTR
0 Compressing texture... writing texture texture_0.png...
1 Compressing texture... writing texture texture_1.png...
2 Compressing texture... writing texture texture_2.png...
3 Compressing texture... writing texture texture_3.png...
4 Compressing texture... writing texture texture_4.png...
5 Compressing texture... writing texture texture_5.png...
6 Compressing texture... writing texture texture_6.png...
7 Compressing texture... writing texture texture_7.png...
8 Compressing texture... writing texture texture_8.png...
Writing Chunk... AUDO
Writing Chunk... SCPT
Writing Chunk... DBGI
Writing Chunk... INST
Writing Chunk... LOCL
Writing Chunk... STRG
Stats : GMA : Elapsed=2714,1552
Stats : GMA : sp=111,au=38,bk=27,pt=6,sc=26,sh=2,fo=2,tl=0,ob=77,ro=7,da=1,ex=1,ma=21,fm=0x4B680EF8
cmd /c ""C:\Users\MAC\AppData\Roaming\GameMaker-Studio\Android\runner\gradle\gradlew"" build -x assembleDebug
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':com.companyname.elode333'.
> Could not resolve all dependencies for configuration ':com.companyname.elode333:_debugCompile'.
> Could not find com.google.android.gms:play-services-games:9.6.1.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-games/9.6.1/play-services-games-9.6.1.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-games/9.6.1/play-services-games-9.6.1.jar
file:/C:/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-games/9.6.1/play-services-games-9.6.1.pom
file:/C:/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-games/9.6.1/play-services-games-9.6.1.jar
file:/C:/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-games/9.6.1/play-services-games-9.6.1.pom
file:/C:/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-games/9.6.1/play-services-games-9.6.1.jar
Required by:
Default:com.companyname.elode333:unspecified
> Could not find com.google.android.gms:play-services-ads:9.6.1.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-ads/9.6.1/play-services-ads-9.6.1.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-ads/9.6.1/play-services-ads-9.6.1.jar
file:/C:/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-ads/9.6.1/play-services-ads-9.6.1.pom
file:/C:/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-ads/9.6.1/play-services-ads-9.6.1.jar
file:/C:/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-ads/9.6.1/play-services-ads-9.6.1.pom
file:/C:/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-ads/9.6.1/play-services-ads-9.6.1.jar
Required by:
Default:com.companyname.elode333:unspecified
> Could not find com.google.android.gms:play-services-plus:9.6.1.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-plus/9.6.1/play-services-plus-9.6.1.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-plus/9.6.1/play-services-plus-9.6.1.jar
file:/C:/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-plus/9.6.1/play-services-plus-9.6.1.pom
file:/C:/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-plus/9.6.1/play-services-plus-9.6.1.jar
file:/C:/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-plus/9.6.1/play-services-plus-9.6.1.pom
file:/C:/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-plus/9.6.1/play-services-plus-9.6.1.jar
Required by:
Default:com.companyname.elode333:unspecified
> Could not find com.google.android.gms:play-services-gcm:9.6.1.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-gcm/9.6.1/play-services-gcm-9.6.1.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-gcm/9.6.1/play-services-gcm-9.6.1.jar
file:/C:/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-gcm/9.6.1/play-services-gcm-9.6.1.pom
file:/C:/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-gcm/9.6.1/play-services-gcm-9.6.1.jar
file:/C:/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-gcm/9.6.1/play-services-gcm-9.6.1.pom
file:/C:/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-gcm/9.6.1/play-services-gcm-9.6.1.jar
Required by:
Default:com.companyname.elode333:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 13.131 secs
Create finished: 20:25:0
Bueno no se que hice pero ya no me marca el error ejje, pero igual sigue sin funcionar el push notification
Tienes la extensión de Google Play Services añadida al proyecto? Es importante para que funcione.
hola hice todo lo que me dijiste, y no funcionaba así que terminé actualizando el sdk y funcionó !!!
así que muchas gracias ya por fin puedo hacer uso del push localmente :)
Me alegro que te funcione ;)
Ten en cuenta que si quieres publicarlo en Google Play, te dará problemas al publicarlo por tener puestas las notificaciones.
Yo tengo una app en Google Play que hace uso de notificaciones, y no me ha dado ningún problema.
Cita de: Dublan en Junio 30, 2017, 07:52:27 AM
Ten en cuenta que si quieres publicarlo en Google Play, te dará problemas al publicarlo por tener puestas las notificaciones.
Hola, me gustaría que me comentaras más al respecto, gracias
Al implementarlo, google play te pide que por fuerza incluyas la politica de privacidad. Si no la incluyes, no te deja publicarlo.
Y como incluyo las políticas de privacidad?, esto se hace en Google play? o desde Game maker? gracias
En la consola de desarrollador de Google.