How can i save data from notifications GCM into sqlite 3 for android? -
i try save data sqlite notifications , doesn't save anything, appreciate help, sorry english :p
this code:
protected void onmessage(context context, intent intent) { // todo auto-generated method stub notificationcompat.builder mbuilder = new notificationcompat.builder(this) .setcontenttitle("new todo item!") .setpriority(notification.priority_high) .setcontenttext(intent.getstringextra("message")); string message = (string) intent.getextras().getcharsequence("message"); string ju = "ja"; string jo = "je"; message = intent.getstringextra("message"); handlersql db = new handlersql(this); db.abrir(); db.insertmsg(message,ju,jo); db.cerrar(); }
first of replace line
string message = (string) intent.getextras().getcharsequence("message"); with line
string message = intent.getstringextra("message"); since don't need first one, , place following lines of code before calling notification , in onmessage() received method in gcmintentservice()
string message = intent.getstringextra("message"); string ju = "ja"; string jo = "je"; handlersql db = new handlersql(this); db.abrir(); db.insertmsg(message,ju,jo); db.cerrar(); and make sure db.insertmsg(message,ju,jo); valid method going insert strings in sqllite database.
Comments
Post a Comment