[android-developers] Digest for android-developers@googlegroups.com - 6 updates in 3 topics

Tony Pitman <tony@shatalmic.com>: Jan 28 08:53AM -0800

I have an app that currently supports bluetooth low energy on pre-lollipop.
I am using things like startLeScan to do the central role.
 
I noticed that Lollipop introduces new apis and that the old ones are
deprecated.
 
I am having one problem in particular that may be related. When I call
startLeScan with no UUIDs it finds my devices. If I pass in the UUID of the
same device that it found it doesn't work.
 
This works fine on a pre-lollipop device.
 
Could this be that the api is deprecated and I need to use the new
startScan on lollipop? If that is the case how do I do this in the same
application?
 
When I browse to the documentation on the web site for startScan it warns
me that it is only available in SDK 21. Does this mean if I use it then my
app won't work on pre- SDK 21 devices or does the sdk take care of that for
me?
 
Sorry to seem like a noob, but this is the first time I have encountered
something like this.
MathieuB <blanchmh@gmail.com>: Jan 28 05:58PM -0800

According to the official documentation :
 
You can use Android 5.0 APIs while also supporting older versions by adding
> Different Platform Versions
> <https://developer.android.com/training/basics/supporting-devices/platforms.html>
> .
 
 
Example with honeycomb :
 
// Make sure we're running on Honeycomb or higher to use ActionBar APIs
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true); }
 
 
In your case :
 
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
Tony Pitman <tony@shatalmic.com>: Jan 28 07:51PM -0800

Thank you for the quick reply.
 
I am running into a problem with the bluetooth le stuff specically,
however. I tried this:
 
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
 
mBluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();
 
}
I have the min version for my application set to 18 and the max to 21. On
the getBluetoothLeScanner call I get an error that my min sdk version is
only 18 and needs to be 21. This is my whole problem how do I support < 21
bluetooth and >= 21 bluetooth calls at the same time?
 
 
On Wednesday, January 28, 2015 at 6:58:10 PM UTC-7, MathieuB wrote:
Jose_GD <jose.gonzalez.d@gmail.com>: Jan 28 06:16PM -0800

You will get often different results given the same minWidth and minHeight
values.
With all that wild world of different screen sizes and densities and 3rd
party launchers, it's very difficult to get consistent result with home
screen widgets.
I wonder why Google opted to specify sizes with dps, doing it directly with
number of cells would be much better...
 
The best you can do is:
- don't use the old formula, that was used in the "dark ages" of appwidgets
- feel free to try different minWidth and minHeight values according to the
device specifications, i.e. experiment using different values in xml /
xml-sw600dp / xml-sw720dp etc. if you really want to achieve an specific
number of cells
- just live with the fact that some obscure launcher will do the math
according to its own criteria and will decide that your perfectly crafted
4x1 widget is a 3x1 one (I'm looking at you Google Now Launcher)
 
(I'm serious about Google Now Launcher, my widget comes in two sizes, 3x2
and 4x3, this Google-owned launcher presents them as 2x2 and 3x3. And the
minWidth and minHeight values are perfectly set to Google's specifications)
 
Good luck
 
José
https://play.google.com/store/apps/developer?id=Jos%C3%A9+Gonz%C3%A1lez+D%27Amico
 
 
El domingo, 25 de enero de 2015, 8:59:20 (UTC-3), BArtWell escribió:
Stefan Alder <twigbranch@gmail.com>: Jan 27 11:49PM -0800

I need to get logcat output from our app is which appears to be crashing on
load for a beta tester. I have not been able to replicate the issue myself.
 
Is there an easy way a beta tester (who is not a developer and doesn't have
adb) to capture logcat output?
Mukesh Srivastav <mukichamps@gmail.com>: Jan 28 04:33PM +0530

Hi Stefan,
 
Here it is , if you are talking about Crash/FC that needs to be capture at
the class level/function level and the which line it fails,then you need to
handle it UncaughtExceptionHandler exception.
 
here is the code for you which needs to be included in the Application
class.
 
private Thread.UncaughtExceptionHandler androidDefaultUEH;
 
private Thread.UncaughtExceptionHandler handler = new
Thread.UncaughtExceptionHandler() {
public void uncaughtException(Thread thread, Throwable ex) {
StackTraceElement[] stackTrace = ex.getStackTrace();
FileLogger.appendLog("uncaughtException", ex.toString());
for (int i = 0; i < stackTrace.length; i++) {
//Here the filelogger is your class where you put the application logs and
here, I am logging the crash in the file logger.
FileLogger.appendLog(
"uncaughtException",
stackTrace[i].getClassName() + " : "
+ stackTrace[i].getMethodName() + " : "
+ stackTrace[i].getLineNumber());
}
 
androidDefaultUEH.uncaughtException(thread, ex);
}
};
 
 
and call this onCreate of the Application.
 
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
//Here the filelogger is your class where you put the application logs.
FileLogger.appendLog("PalsApplication", "onCreate");
androidDefaultUEH = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(handler);
}
 
 
 
 
 
 
 
 
 
--
Warm Regards,
*Mukesh Kumar*,
Android Consultant/Freelancer,
India,Hyderabad.
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to android-developers+unsubscribe@googlegroups.com.

No comments:

Post a Comment