I have read a lot of posts about managing GPS in android using code.
All of them saying that it is not possible. But they are all using android SDK to talk about the topic. Since it is not possible with SDK, can it be done using NDK?
I am asking this question, even after reading all those, because the android settings application can enable/disable it, which means it is not impossible.
In my app, it needs to turn GPS for a while and turn it off (for power reduction) and send the GPS data to a server.
Ultimately android is Linux based. So there must a way to turn it on/off using the Linux commands/APIs right? (or using the NDK) can anyone share the ideas about that?
If it is not at all possible (last option), is there any alternate way to get location information using any other functionalists.
In general, the Android NDK interface is much more limited than the SDK interface. To supplement it, you are able to access Java functions through the JNI interface. There is no extra functionality in the NDK that does not already exist in the Java SDK.
Related
I am a novice Android-Java developer and am building a custom telephony application.
From my understanding there are 2 approaches I can take.
Build a custom app from scratch using the SDK and TelephonyManager class
Or, grab the entire native app source from source.android.com and 'hack' the existing phone application.
The application MUST run in kiosk mode and also run automatically when the device is powered on, both of which I am still researching.
It will also need to communicate via the Android Open Accessory Protocol with an external arduino device (no voice data, probably just volume levels).
Can any android experts suggest which approach, 1 or 2 is going to be easiest to implement and why?
If I am not wrong than you are going to implement it using Java in that case I would suggest 3rd Option.
Option 3: Write your own wrapper on top of existing TelephonyManager and extend the feature functionality.
I am not sure how deep you are going to change the existing API but in case you are going to enhance the feature than this option seems good.
I want to access Android API classes outside an Android project. For example is it possible to get an object to the Context of the device connected to a machine or the running emulator?
This will allow access to a system services like PowerManager or ActivityManager outside an Android device. If not via Context object, is there any other way to access the system services for a device/avd outside Android?
No way. Distributed android API classes are merely stubs good enough to compile against them.
Even most innocent stuff is stubbed out to throw RuntimeException on invocation. If you like to know status of the system, you will have to use SDK tools. Or write app exposing android objects via some remote access technology
I very much doubt that it is possible. The distributed SDK classes do not include many parts of the internal API. See, for example, this thread. Besides, what use would there be to have a system service object like PowerManager without a system (or an emulation of one) to back it up?
It sounds like what you're trying to do is not really access things on the device, as much as remotely control the device. In this case, there are some external tools that you should look into. The tools are mainly focused on testing, and are based on instrumentation for apps. You can look at robotium and monkeyrunner, to start with, as they provide a bit of functionality that might help you accomplish what you want. Other than that, you can also do what those tools do and write an app which listens for intents from adb, performs actions based on those intents, etc..., but you'll obviously be doing a lot of communication at a high level, so this might not be the most efficient (and I'm not sure how you'd transfer much data, which would be required for real RPC, which it sounds like you want to do).
I need to develop an Android application that sets up connection via WiFi with computer and then sends packets with data. Jowever, I need to control send packets, not only theirs data but also headers, there should be possible to modify any field in their header as well. In windows in it is possible with use of winpcap and jpcap, and I wonder if sth similar I may find on Android. Is there any ready API that will help with my problem?
There's no API available to a Java/Dalvik app on Android which would allow you to do that.
Android is a Linux system, though. So you could try to find/write one or two Linux applications to support your effort - or use JNI.
Bottomline: Native code will definitely be necessary to achieve what you want, no way to do this in Java alone.
I was wondering if I can do network traffic monitoring per android application?
Basically see which app is receiving/sending how much data?
I know there are many apps which already do that but I want to know how to do it.
Well you surely can. A very simple way is to use the TrafficStats class. It can manage per app (more formally, per UID) But the problem is, it can return UNSUPPORTED. When this happens, I don't think you will have some easy (i.e. using the high level Java language) method to get the network traffic data you need.
Not sure if it can be implemented in Java as I imagine you need to access some low-level Operating system functions which are just not available in Java (but don't quote me on this!).
The obvious way I see of doing this is through C language and the Android Native Development Kit.
What are the key differences between Android, iOS and Blackberry OS in terms of level of accessibility by application developers (i.e. access to the video input, sound input, phone functionalities, to which extent, etc.)?
PS: Assume latest version of each OS.
EDIT: Can someone turn this into a wiki so we can compile answers from people that don"t necessarily have experience in all 3 plaforms.
I'm not familiar with BlackBerry, but on Android and iOS you can access just about anything. Until recently iOS had some restrictions about camera access (see this), but I belive those have been solved. Because Android is open-source, you can theoretically go as deep as you want as far as accessing the hardware, but you may or may not be able to get any deeper through the standard Android API than you can through the iOS API.
On Android, you can do a lot more to override default functionality. For example, you can create your own launcher screen or phone application. The iOS approval process wouldn't allow these kinds of applications.
API hardware access really isn't an issue on either platform, the bigger concern is overriding default software (almost never possible in iOS) and what types of applications iOS allows.
Each platform has its own nice and bad parts. I have been working on both Android and BB. I wish I could take only nice parts from both to create a platform of a dev dream! :)
For instance, I could take these features from BB:
The greates feature I like in BB is the simplicity of the application architecture - you can always count on your main UIApplication instance - OS never kills it.
Also I do like the simplicity the Dialog class provides - it is very easy to implement business logic related to user choice - while Dialog screen is shown the code execution just stops and waits for user input.
From Android I'd take the following:
Network communication. On BB this is a real nightmare (BES, BIS, WIFI, Direct TCP without APN, Direct TCP with APN, WAP, WAP2, Unite - who's next? :)).
For file manipulations you just use a native/usual Java API.
Nice looking UI components are available right out of the box.
I should add I'm not happy with GPS related stuff on both platforms, however maybe it is due to GPS hardware limitations rather than API creators.
Thanks!
BlackBerry is a pain, once I made a project for it (the JDE version was 4.7 back then) and it didn't had an ArrayList. WTF?