I’ve followed this video : https://www.youtube.com/watch?v=RrXfM4255OA to use Business logic in android …
I downloaded the code for the event handler as he did … but when he open the servercode .ipr file …it’s opening in Intellij IDEA but I want to use android studio and I can’t open this file in android studio because it isn’t containing A Gradle file … and in the video he made a new project …But I want to use my current project not a new project …
what I want from using server-side code is to update a list view in my app every time a new row is created in "Messages " Table … so that mean auto refresh
How Can I do that in android studio ? And thanks
You need to use IntelliJ IDEA for that. Android Studio is used to create client-side (Android) projects. Server-side code runs on the server
Then how I can "update a list view in my app every time a new row is created in “Messages " Table” Using android studio ? I think that I havn’t understand what Server-side code means !
Server code runs on our servers and can be injected in the API invocations. There are severals ways to update list view on the client when something changes on the server. You can poll the server for changes, or you can use pub/sub messages to notify the client.
We can help you with the code, but it would be a separate team of Backendless and it costs money as it falls under the consulting side of the business.
then how I can poll the server ?
Here are the few links which should be very helpful in your case. Please read them thoroughly and try to write some code.
Backendless Messaging Subscription (a way to poll messages): https://backendless.com/documentation/messaging/android/messaging_message_subscription.htm
How to update ListView in Android: http://stackoverflow.com/questions/2250770/how-to-refresh-android-listview
By the way, you won’t be able to update your ListView from the server-side code. The reason is that the server-side code (the event handler) is executed on our servers and has no connection with the code on your Android device.
when I send a message …I want it to contain a URL of a file in backendless server … and the date that the message was sent can i do that using publish subscribe messageing ?
Yes, you can.
In your event handler you can publish a message to some Messaging channel with the URL of the file, and all the subscribed Android devices will receive it in case they have subscribed to this channel.
OK thank you Mr.sergey … can I send messages to a Specified Users , or only one user , or all users ?
This can be accomplished through Push Notifications - you would have been able to select devices to which you want to send push.
With pub/sub you can messages to individual users if you know the channel name or subtopic on which the user is subscribed to.
Alternatively, you can use “selectors” for each user and target individual users using headers in the published messages.
that’s good …but can this be done without notification ? I mean if the app is opened by the user … no notification … but if the app isn’t opened …the notification is shown …?
what I described can be done without notification, just pub/sub
If you send push notification, you define a Push Received in your code. From there you can define any behaviour you want, including what you described - to show notification or not.
With pub-sub messaging you won’t be able to receive notification when your user turns off the application. But he will be able to pull the messages from channel as soon as he enters again.
thank you … I will search for that (Y)
one more question please … by using pub/sub messages the data will updated automatically when new message is sent right ?
when client receives a published message, it is up to your code how to handle it. If you need to update something on the screen, it would be up to your code - our job is to deliver the message.
that’s looks good … I will read in the docs about pub/sub messages … Thank you " Mark ,Sergey"