I'm trying to get the application usage list in android lollipop using UsageStatsManager, for that I have gone through the android developer document https://developer.android.com/reference/android/app/usage/UsageStatsManager.html
I don't know how to use UsageStasManger, so I referred few links How to get list of recent apps with Android API 21 Lollipop?
Android Lollipop know if app as Usage Stats access
and implement in my project but I didn't get any data from UsageStausManager? how do I Use UsageStausManager in my project. Anyone help me out.
From lollipop we will not be able to use the activity manager for determining the current foreground tasks. we have to make use of the Usage Stats Manager. Wrote a small code and answered in this thread
Determining the current foreground application from a background task or service
You can have a look at this thread by me.
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.
A background service might not be working in real-time if the App turned background when Android SDK > 26 (Android OS 8.0 later), but a foreground service may work according to Ref1 & Ref2(Codes in Native Java), I'm no idea how translate it in NativeScript, could somebody make it? thanks!
Ref1: https://hackernoon.com/android-location-tracking-with-a-service-80940218f561
Ref2: https://bitbucket.org/tiitha/backgroundserviceexample/branches/
A foreground service example in NativeScript could be found here and downloaded for reference.
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.
Need to create an application in a below mentioned link format targeting all the android platform i.e. from 1.5 to 4.1
http://natieklopper.blogspot.in/2011/08/iphone-styled-bottom-aligned-tab-bar.html
Can I use tab activity class for the same? Know it is deprecated but still need to confirm if we use then will my application work on all android devices.
Not getting appropriate demo or example to start my application with fragments,action bar sherlock's tab.
Please suggest me a simple way to initiate my application. Really appreciate if some examples are available.
Your application will work in all android devices if they have a newer version than 1.5
Deprecated means obsolete, but you can continue using ;)
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...