Trigger broadcast receiver only if my activity is in memory, else it should not get triggered, how to do it?
Options
1) Send broadcast only when your activity is alive
2) Register a dynamic receiver in that Activity
3) Register a static receiver in manifest file
4) It is not possible to achieve
Can one application access other application's database directly?
Options
1) yes, it is possible
2) no, it is impossible
3) option 2 is right because, sqliteDB will be stored in internal memory app always. so other apps cannot access it.
4) Option 2 is wrong, because even if db tables are stored in internal memory, using Content Provider one can access database.
Options
1) If it is disabled onStatusChanged() will be called with provider name.
2) if it is disabled onProviderDisabled() will be called with provider name.
3)either one of the option 1 or 2 will happen
4) There is no way to find it out.
How to get phone locations? which is better network provider or GPS provider?
Options
1) You can use satellite to fetch your locations.
2) You can either use your cell tower information or WiFi-information to know your phone location.
3)using option 1 is faster and more accurate than second option, it also takes less battery power.
4)using option 2 is faster than option1, but how ever it will not give you exact location compared to option 1. takes less battery power.
Options
1) Pass different version number in incremental order, and put all upgrading code in onUpgrade() of helper class.
2) Pass different version number in incremental order, and put all upgrading code in onCreate() of helper class.
3) Pass different version number in any order, and put all upgrading code in onUpgrade() of helper class.
4) Pass different version number is decremental order, and put all upgrading code in onUpgrade() of helper class.
What is the difference between service and a thread?
Options
1) Service - is a component of android, which runs in the background with out any UI. Service will have default one thread to run in background. Thread - is similar to service, it also runs in the background.
2) Service - is a component of android, which runs in the background with out any UI. By default service will run in Main thread only. Thread - is not android component, but still one can use thread to do some background task. Using thread in place of service is discouraged.
3) Option 2 is right, but one can use Thread in place of Service, no problem will come.
4) Option 1 is right, but it may have UI also some times.