9

I want to write a native application in c to get the value of region in Tizen. The compiled c code must be run on the Tizen phone and I need to get the Value of language region. The callback function i got from Tizen source is

int app_cb_broker_appcore_region_changed(void *data)
{
    app_region_format_changed_cb region_changed_cb;

    region_changed_cb = app_context.callbacks->region_format_changed;

    if (region_changed_cb != NULL)
    {
            region_changed_cb(app_context.user_data);
    }

    return 0;
}

How to use this function to get the value of current region?

Eduard Florinescu
  • 16,747
  • 28
  • 113
  • 179
Ajay Soman
  • 1,631
  • 4
  • 19
  • 37
  • Can you explain the difference between this question and your previous question, besides the obvious language/region difference? _What_ is it you have problem with, callbacks in general, or something else? – Some programmer dude Aug 21 '12 at 05:44
  • i need to implement current language, current region and current position(via gps) using the callback functions. I have done the callback for gps. but in the same way i can't implement the region and language. thats why i am asking both – Ajay Soman Aug 21 '12 at 05:48
  • and i am not much familiar with these kinds of callbacks. hard to find the necessary codes from tizen source code – Ajay Soman Aug 21 '12 at 05:49
  • Then can you explain _why_ you can't implement the callbacks for region/language? Do you have errors? Don't you know which functions to call? Have you searched the API documentation? Have you tried the suggestion in the comments to your previous question? Did it work or not? In other words, [what have you tried](http://mattgemmell.com/2008/12/08/what-have-you-tried/)? – Some programmer dude Aug 21 '12 at 05:51
  • tizen documentation is not giving necessary information. and for my previous qtn, i didn't got any useful answers. i have no errors,but the value is not getting. the problem is code gets complex when i add necessary dependencies like structures,other functions,header files etc. – Ajay Soman Aug 21 '12 at 06:10
  • In your previous question someone asked you to try `getenv("LANG")`. Did you do that? I.e. `char *lang = getenv("LANG");` What did it return? – Some programmer dude Aug 21 '12 at 06:15
  • its not giving any values. the same is working in meego, but not in tizen – Ajay Soman Aug 21 '12 at 06:18
  • Did you try using the Tizen's core API functions related to "Location" ? Language is stored under this category. – shr Aug 26 '12 at 09:59

1 Answers1

1

I am not familiar with Tizen, but as far as I can see in the code, there is a struct variable (app_context) that has an attribute (callbacks) which should be a pointer to a struct of callback function pointers. One of those function pointers is region_format_changed. So you should define your function and pass it to that pointer so that it gets called (back) and you can handle the parameters which is passed (app_context.user_data).

For example.

Step 1. You define and write your callback function

void my_region_changed_cb(typeof(app_context.user_data) data)
{
     //The code of your handler here
}

Step 2. Somewhere in your initialization code you set the callback attribute

//...
app_context.callbacks->region_format_changed = (&my_region_changed_cb);
//...

Hope it helps.

Javier Uria
  • 119
  • 6