I'm trying to create an app to work with ROximity beacons. I've tried to use Roximity 1.2 SDK, but had no success launching the app with it and because time is short - I was forced to use a demo project with 0.2 SDK, which was workin +/- ok.
Problem is - I cannot find any method in SDK to stop scanning for beacons and update interface, so when I close the app - scanning thread is still scanning (it is started somewhere in SDK automagically) and instead of proper closing it crashes.
Unfortunately, Roximity support isn't supporting much and they cannot provide any documentation, because there's not to much of it anyway and what is there - it is very very minimal: http://roximity.github.io/ROXDOX/roxandroid_s_d_k.html
The Roximity SDK is a modified version of an older version of the open source Android Beacon Library. You can review the documentation for the open source library at the link provided to see if helps with any questions. Obviously, Roximity's modifications may change the way things work. Worst case, you can simply switch to using the open source library.
With the open source library, you can stop scanning two ways:
Unbind all BeaconConsumer instances from the BeaconManager. (Preferred)
beaconManager.unbind(this);
Set the background between scan period to be very large and put the BeaconManager into background mode.
beaconManager.setBackgroundBetweenScanPeriod(Long.MAX_VALUE);
beaconManager.setBackgroundMode(true);
Full disclosure: I am the author of the open source library.
Related
I have a Flutter app that I'm running a background service on and it works fine even if the user swipes it away. I see that there're a lot of guides targeting native android implementations of this issue but none for Flutter. I'm using flutter_background_service and it works just fine when the app is in the background but not when it is killed. The app needs to be running all the time to listen to accelerometer events and I've tried a lot of packages like workmanager and flutter_foreground_task but they don't work as I'd like. Workmanager can only run every 15 min but that's too long of a duration and foreground_task although it claims it prevents the app from closing, it doesn't actually do that.
I have no Kotlin experience so using Method channels is not viable at the moment for me,I can copy-paste code though :) and I know some Java. Are there any packages that I'm not aware of that can help me to always listen in the background for events and launch or bring the app to the foreground when I want it to?
Using the embedder, Flutter code can be integrated into an existing application as a module, or the code may be the entire content of the application. [Flutter architectural overview]
In other words, your Flutter app running on Android is a regular Android app which has the same constraints like any other Android app.
And as mentionend in the README file of workmanager:
Android will automatically change your frequency to 15 min if you have configured a lower frequency.
This statement can also be be found in the Android documentation:
Note: The minimum repeat interval that can be defined is 15 minutes (same as the JobScheduler API.
So, I'd say that you should respect that constraint for your Android app and not try to come up with a hack which works around it.
I am making an andriod app using 'andriod for processing lib" of processing (ie. running android mode in processing 2.0.3 and lauching it on my device).
Spacebrew (http://docs.spacebrew.cc) is a easy to use web socket library for processing , also availabel as javascript.
if i run the spacebrew example codes in andriod mode, the app gets launched in my device but doesnt show up in my spacebrew admin. whereas if i run the same thing in my mac, it shows up correctly. guess the websocket communication is not happening while using "andriod for processing". But this is the easiest way to use web sockets. So can anyone help me figure out on how to make spacebrew work in processing (android mode)
this is for my college project. any suggestions on how to get this running please? thankyou in advance
Thanks for pointing me to Spacebrew, didn't know about that!
I've just tested it from Android Mode and it does work, but there is a tiny quirk you might be missing out: permissions!
Normally, if your app uses extra permissions, the application's manifest allows you to use these. In Processing, that's also possible via Android > Sketch Permissions and in the case of Spacebrew, INTERNET is the permission you need enabled, as you can see below:
I just a did a test myself and it seems to work just fine with the amazon hosted demo:
Note that the Spacebrew Processing library uses the java websocket library, but only sets up a WsClient client. You can if you want use this jar in an Android SDK eclipse project and have your Android app act as a websockets server as well, not just a client (just in case this will become handy to you at some point in the future)
i want to make an application or more like a tweak for android
i want to write some code that's gonna work on an android device and will do curtain actions based on an input from a Bluetooth device
this application needs to run in the background at all times (as if it was part of the device's operation system)
and be getting input every second
i need it to be able to bring up i custom keyboard i am gonna design and to set up a courser just like in a desktop which can be controlled by the application.
i read about something called a ROM and i dont know if thats what i am looking for.
i also know that the android operation system can be modified or replaced with another operation systems like the one called cyanogen .
i am a beginner and i have got some background in java
i tried creating an android app but i dont know how to make this thing work on the OS
i need someone to give me a very detailed explanation cause i know nothing about these stuff
It sound like your trying to make an App that takes Bluetooth input...
It doesn't sound like you need to edit the OS itself...
You need to set up the Android SDK to start development...
http://developer.android.com/sdk/installing/index.html
1. Download the SDK
2. Install the Eclipse Plugin
3. Write the code, and run it on the emulator or your connected device(make sure debugging is enabled under Setting->Applications->Developer)
Here's some info on getting started w/ Bluetooth...
http://developer.android.com/guide/topics/connectivity/bluetooth.html
Since you want this to run all the time, I would look into Android Services also...
http://developer.android.com/reference/android/app/Service.html
You may want to also take a look at the Sample Projects included w/ the SDK after you download the SDK and set up your IDE and Emulator(or phone)...
http://developer.android.com/tools/samples/index.html
Hope this helps clear some stuff up...
I need to profile dynamic library calls of android application and have decided to profile using "ltrace" tool for this purpose. I combined "ltrace" tool into android package, then compiled together successfully. It works fine with shell program just like usual linux console application.
However, I cannot properly profile android applications, which are forked from "Zygote" process. I tried attaching ltrace to "Zygote" process to follow child processes of it, but I only got SIGCHLD and SIGSTOP signals and terminated abnormally, showing the following errors.
unexpected instruction 0xffffffff at 0xffff0508
I'm just wondering if anyone has ever tried this kind of profiling on android system. Any short comments can be very helpful for me.
Thank you in advance.
Try attaching ltrace to your android application's process after it is it forked off zygote. You will need an ltrace built for android's bionic libc, and one that has reasonable handling of threads.
There is a way to set a debuggable android app to wait for connection of the java debugger, you could use that, connect ltrace, and then connect and disconnect the java debugger to start it going again. This should capture most of your own logic, though not the entirety of the startup.
IIRC you are under a time limit to connect and get it going again, otherwise it may resume on its own to avoid triggering an application not responding situation.
It may be that you will learn more by using the java debugger to see what is going on, and then reading the source to see how that is implemented on the native side.
Mr. Chris Stratton's way will work.
LoadLibrary() is another point to break for debbuging jni.
I just started testing my app on android 1.5, and it doesn't want to run at all. I have a breakpoint in onCreate on my main activity, but I get a ClassNotFound exception even before reaching that. The class not found appears to be the class of my main activity. The exception happens in:
ActivityThread.performLaunchActivity
It runs fine on 1.6 and later, so I assume I'm using something that isn't supported on 1.5. But how can I find out what it is? Any tips on how to debug this would be greatly appreciated.
Thanks.
If you have imported jars, verify that they are in the /libs directory and not in the /lib directory and they are imported as jars and not as external jars
I had the same problem today. It's difficult to identify which class is not supported. The stack trace doesn't really shed any light on it, it just gives the somewhat misleading message that your activity class cannot be found. A couple API's that I have used that I know are not in Android 1.5 are:
- Bluetooth (2.0 and up)
- Text to Speech (1.6 and up)
I ran into this issue because I added support for text to speech to my app and didn't think to check the docs first to make sure text to speech is supported on Android 1.5. I was dismayed to learn it was only added in Android 1.6. To work around the problem I had to do a couple things:
Remove the "import android.speech.tts.*" from my activity
Create wrapper classes that mirror the text to speech API and call the real text to speech classes from there.
Put if statements around the calls to my wrapper class to make sure I only call out to it if the Android SDK level is 1.6 or above. You can check the Android SDK level by inspecting android.os.Build.VERSION.SDK
In your Android Market listing, indicate that the text to speech functionality is only available if you have Android 1.6 or higher installed.
The nice thing about this approach is that in the future, when I decide to abandon support for Android 1.5 I can easily change my calls to my wrapper class to just call the text to speech API directly and rip out the wrapper classes.
I did something similar for my Bluetooth code.